0

I have two identical ERC721 contracts that allow for minting nfts with one exception. One of the contracts has the following bit of code:

function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) {
    if(interfaceId == _INTERFACE_ID_ERC2981) {
        return true;
    }
    return false;
} 

this is to support royalties. and that is all it takes to prevent my item from showing up on OpenSea. The contract compiles just fine and I can even interact with it and I am able to mint, get the tokenUri and any other function. I just can't see the item on OS.

Any ideas why this may be?

contract1 (works): https://rinkeby.etherscan.io/address/0xEA8d1638bDAA19A4c6C3F7fD0AA4dC98060fcB84#code

you can see the item here: https://testnets.opensea.io/assets/0xEA8d1638bDAA19A4c6C3F7fD0AA4dC98060fcB84/1

contract2 (works but item won't list): https://rinkeby.etherscan.io/address/0x8B6972cc712f115A3726f086932ac2d7a22F551e#code

And I just get a 404 error: https://testnets.opensea.io/assets/0x8B6972cc712f115A3726f086932ac2d7a22F551e/1

If you look at the contract code and scroll all the way down you can see the only difference is that contract1 has the code commented out and contract2 has it included in the build. In both cases we are pointing to the same item and same metadata. You can test this by interacting with the contract and finding tokenURI of tokenId 1

How to go about debugging?

UPDATE This broken item does show up on Rarible's testnet: https://rinkeby.rarible.com/token/tezos/0x8B6972cc712f115A3726f086932ac2d7a22F551e:1?tab=owners

Therefore we know this is something specific to OpenSea. But again no idea how to approach resolving this at this point

1 Answer 1

1

By overriding supportsInterface that way the contract will return false for any other interface except ERC2981. It returns false for ERC721!

The correct way to override is to call the parent contract for other interfaces.

function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) {
    if (interfaceId == _INTERFACE_ID_ERC2981) {
        return true;
    }
    return super.supportsInterface(interfaceId);
} 
1
  • worked like a charm Feb 9, 2022 at 3:48

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.