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);
}
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.