Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ERC721 interface is not supported after supportsInterface override #304

Closed
LeonTing1010 opened this issue May 30, 2022 · 2 comments
Closed

Comments

@LeonTing1010
Copy link

This inheritance method will cause the contract to not support the ERC721 standard, and the 4.0.0 version does not support this inheritance method, and the previous version is OK.

contract Contract is
    ERC721A,
    AccessControl
{
  function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(AccessControl, ERC721A)
        returns (bool)
    {
        return
            super.supportsInterface(interfaceId);
    }

}

I found that the latest version modifies the following code

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes of the XOR of
        // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
        // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

If it is modified to this way, there is no problem

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(AccessControl, ERC721A)
        returns (bool)
    {
        return
            super.supportsInterface(interfaceId) ||
            ERC721A.supportsInterface(interfaceId);
    }
@Vectorized
Copy link
Collaborator

Vectorized commented May 30, 2022

I have updated the docs with a migration to v4 section. Will make an announcement on the issues page later.

@cygaar
Copy link
Collaborator

cygaar commented May 30, 2022

Closing this issue since we have #306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants