Files

20 lines
578 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
library LibAddress {
/**
* @notice Will return true if provided address is a contract
* @param account Address to verify if contract or not
* @dev This contract will return false if called within the constructor of
* a contract's deployment, as the code is not yet stored on-chain.
*/
function isContract(address account) internal view returns (bool) {
uint256 csize;
assembly {
csize := extcodesize(account)
}
return csize != 0;
}
}