Skip to content

Overriding IERC721A in later solidity version breaks compile #31

@DLzer

Description

@DLzer

When implementing the OperatorFilterer.sol on a base ERC721A the compiler ran into an issue referencing the override of the IERC721A interface. My solution was to remove the reference to IERC721A in the OperatorFilterer methods considering in later solidity versions overriding interfaces is not necessary for functions that override a single interface function.

Issue

The implemented setApprovalForAll function:

    function setApprovalForAll(address operator, bool approved)
        public
        override(IERC721A,ERC721A)
        onlyAllowedOperatorApproval(operator)
    {
        super.setApprovalForAll(operator, approved);
    }

Error received:

TypeError: Invalid contract specified in override list: "IERC721A".
   --> contracts/721AToken.sol:169:9:
    |
169 |         override(IERC721A, ERC721A)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: This contract: 
  --> erc721a/contracts/IERC721A.sol:10:1:
   |
10 | interface IERC721A {
   | ^ (Relevant source part starts here and spans across multiple lines).

My Solution

Implement OperatorFilterer methods without overriding the ERC721 Interface

    function setApprovalForAll(address operator, bool approved)
        public
        override(ERC721A)
        onlyAllowedOperatorApproval(operator)
    {
        super.setApprovalForAll(operator, approved);
    }

If this fix goes against the grain please let me know, or if there is a better proposed solution that I could implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions