ERC721 implementation and modifiers

Hello guys, how are you? :slight_smile:

I am near the end of the Ethereum dApp course, and I have a question:

Does adding modifiers into the ERC721 functions headers hinders the standard?

We have a lot of checks to be done in there so I thought a good idea to make modifiers instead of multiple similar “Require” checks in the code.

Ex:

function approve(address _approved, uint256 _tokenId) override external catMustExist(_tokenId) onlyCatOwner(_tokenId) {
        _approve(_approved, _tokenId);
        emit Approval(msg.sender, _approved, _tokenId);
    }

Does this cause any problem when actually deployed in the mainnet?

Thank you so much!

Hello @AnesB ! Yeah is ok to modify it like that. Erc only defines the prototypes of the functions not what they do.

Thank you very much, @kenn.eth !

1 Like