Skip to content

Commit

Permalink
Replace excodesize assembly with address.code.length (https://github.…
Browse files Browse the repository at this point in the history
  • Loading branch information
k06a authored Dec 15, 2021
1 parent 4a9cc8b commit d95cdaa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions contracts/utils/Address.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ library Address {
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.

uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
return account.code.length > 0;
}

/**
Expand Down

0 comments on commit d95cdaa

Please sign in to comment.