* Update to ganache-cli v6.1.0 and truffle v4.1.0 * Update to stable version of ganache-cli * fix: update event emission warning - Fix event emission warnings for solidity 4.21 after truffle has been updated to use this version * fix pr review comments * update to truffle v4.1.5 * update package-lock * add additional emit keywords * update solidity-coverage to 0.4.15 * update to solium 1.1.6 * fix MerkleProof coverage analysis by testing through wrapper * change version pragma to ^0.4.21 * fix solium linting errors
29 lines
1010 B
Solidity
29 lines
1010 B
Solidity
pragma solidity ^0.4.21;
|
|
|
|
|
|
/**
|
|
* Utility library of inline functions on addresses
|
|
*/
|
|
library AddressUtils {
|
|
|
|
/**
|
|
* Returns whether the target address is a contract
|
|
* @dev This function will return false if invoked during the constructor of a contract,
|
|
* as the code is not actually created until after the constructor finishes.
|
|
* @param addr address to check
|
|
* @return whether the target address is a contract
|
|
*/
|
|
function isContract(address addr) internal view returns (bool) {
|
|
uint256 size;
|
|
// XXX Currently there is no better way to check if there is a contract in an address
|
|
// than to check the size of the code at that address.
|
|
// See https://ethereum.stackexchange.com/a/14016/36603
|
|
// for more details about how this works.
|
|
// TODO Check this again before the Serenity release, because all addresses will be
|
|
// contracts then.
|
|
assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly
|
|
return size > 0;
|
|
}
|
|
|
|
}
|