* Adding solhint, working on style fixes. * Upgraded to solhint 1.5.0. * Removed all references to Solium * Updated mocks to make the pass the new linter rules. * Reformatted the .solhint.json file a bit. * Removed Solium configuration files. * Remove Solium dependency. * Add comment explaing disabled time rule in TokenVesting. * Revert to the old (ugly?) style. * Revert SignatureBouncerMock style. * Fix ERC165InterfacesSupported interface.
27 lines
1.1 KiB
Solidity
27 lines
1.1 KiB
Solidity
pragma solidity ^0.5.0;
|
|
|
|
/**
|
|
* Utility library of inline functions on addresses
|
|
*/
|
|
library Address {
|
|
/**
|
|
* 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 account address of the account to check
|
|
* @return whether the target address is a contract
|
|
*/
|
|
function isContract(address account) 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.
|
|
// solhint-disable-next-line no-inline-assembly
|
|
assembly { size := extcodesize(account) }
|
|
return size > 0;
|
|
}
|
|
}
|