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>
25 lines
785 B
Solidity
25 lines
785 B
Solidity
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/IsContract.sol
|
|
// Adapted to use pragma ^0.5.8 and satisfy our linter rules
|
|
|
|
pragma solidity ^0.5.8;
|
|
|
|
|
|
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;
|
|
}
|
|
}
|