[Solidity] NFT contract check

in #sct2 years ago

Let's look at how to check whether the contract is an NFT contract on the Ethereum mainnet (or EVM chains).

The ERC-721 standard is intended to be implemented by implementing the EIP-165 interface.
And EIP-165 has a supports Interface function, and if you enter 0x80ac58cd, which is the NFT interface ID, and return true, you can confirm that it is an NFT contract.

C3TZR1g81UNaPs7vzNXHueW5ZM76DSHWEY7onmfLxcK2iQBtxTY6amMSNFPFYo1qmAbTDiSFuji9tPJqZY2B36zWYrse2fdXewN8UHjeUVatE1og54HvCPx.png

As shown in the image above, the ERC-721 Contract will have supportsInterface function, and returns True when interfaceIddp 0x80ac58cd is entered.

When I call it from the famous BAYC Contract, it returns true as expected..!!

Coin Marketplace

STEEM 0.20
TRX 0.15
JST 0.030
BTC 65144.58
ETH 2627.08
USDT 1.00
SBD 2.83