8

When implementing ERC721, why it is necessary to use ERC165 standard?

pragma solidity ^0.6.6;

interface ERC165 {
    function supportsInterface(bytes4 interfaceID) 
       external view returns (bool);
}

1 Answer 1

11

ERC165 is an interface to check if a contract supports an interface, it's a meta-interface so to say. This is useful if we want to interact with a contract but we don't know if it supports an interface such as ERC20 or ERC721.

As you can guess supportsInterface for ERC165 returns true. Each interface has an interfaceID. For ERC165 it is 0x01ffc9a7. Check the EIP for detailed info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.