~/snippets/detect-if-address-is-smart-contract
Published on

Address Detection

145 words1 min read
pragma solidity ^0.8.7;

contract Assembly {

    //detect if address is smart contract or not
    function isSmartContract(address _address) external view returns (bool) {
        uint size;
        assembly {
            size := extcodesize(_address)
        }

        return size > 0 ? true : false;
    }
}