Correct documentation for isContract check (#2017)
* Correct documentation for isContract check * Update Address.sol * Update Address.sol * add missing newline before asciidoc list
This commit is contained in:
committed by
Nicolás Venturo
parent
3eaf50005f
commit
5d47aa85bc
@ -7,19 +7,21 @@ library Address {
|
|||||||
/**
|
/**
|
||||||
* @dev Returns true if `account` is a contract.
|
* @dev Returns true if `account` is a contract.
|
||||||
*
|
*
|
||||||
* This test is non-exhaustive, and there may be false-negatives: during the
|
* [IMPORTANT]
|
||||||
* execution of a contract's constructor, its address will be reported as
|
* ====
|
||||||
* not containing a contract.
|
* It is unsafe to assume that an address for which this function returns
|
||||||
|
* false is an externally-owned account (EOA) and not a contract.
|
||||||
*
|
*
|
||||||
* IMPORTANT: It is unsafe to assume that an address for which this
|
* Among others, `isContract` will return false for the following
|
||||||
* function returns false is an externally-owned account (EOA) and not a
|
* types of addresses:
|
||||||
* contract.
|
*
|
||||||
|
* - an externally-owned account
|
||||||
|
* - a contract in construction
|
||||||
|
* - an address where a contract will be created
|
||||||
|
* - an address where a contract lived, but was destroyed
|
||||||
|
* ====
|
||||||
*/
|
*/
|
||||||
function isContract(address account) internal view returns (bool) {
|
function isContract(address account) internal view returns (bool) {
|
||||||
// This method relies in extcodesize, which returns 0 for contracts in
|
|
||||||
// construction, since the code is only stored at the end of the
|
|
||||||
// constructor execution.
|
|
||||||
|
|
||||||
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
|
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
|
||||||
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
|
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
|
||||||
// for accounts without code, i.e. `keccak256('')`
|
// for accounts without code, i.e. `keccak256('')`
|
||||||
|
|||||||
Reference in New Issue
Block a user