forked from cerc-io/laconicd-deprecated
c9639c3860
* tests: add solidity test suite * tests: remove require strings * Update tests-solidity/init-test-node.sh * Update tests-solidity/init-test-node.sh Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
22 lines
629 B
Solidity
22 lines
629 B
Solidity
pragma solidity ^0.4.24;
|
|
|
|
|
|
contract IsContract {
|
|
/*
|
|
* NOTE: this should NEVER be used for authentication
|
|
* (see pitfalls: https://github.com/fergarrui/ethereum-security/tree/master/contracts/extcodesize).
|
|
*
|
|
* This is only intended to be used as a sanity check that an address is actually a contract,
|
|
* RATHER THAN an address not being a contract.
|
|
*/
|
|
function isContract(address _target) internal view returns (bool) {
|
|
if (_target == address(0)) {
|
|
return false;
|
|
}
|
|
|
|
uint256 size;
|
|
assembly { size := extcodesize(_target) }
|
|
return size > 0;
|
|
}
|
|
}
|