ERC721.isApprovedForAll check inside contract

Hello,

I was using ERC721 from 0.7 version of open-zeppelin contract and had no issues with approve and _isApprovedOrOwner function check. But I just upgraded to 0.8 version and saw that both these functions are using ERC721.isApprovedForAll to check for approveAll permission. We overwrote isApprovedForAll function in our token contract and this change is causing the tokencontract to use the isApprovedForAll function inside ERC721.sol. Does this mean we need to override approve and _isApprovedOrOwner function as well?

Changing

require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),

to

require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),

fixes my issue.

1 Like

Hi @yash,

Welcome to the community :wave:

You said that you were using Solidity 0.8. The latest version of OpenZeppelin Contracts is 3.4 and supports Solidity 0.6 and Solidity 0.7.

I assume you are using OpenZeppelin Contracts via GitHub master branch for Solidity 0.8. You should only use an official release of OpenZeppelin Contracts.

As for your question, when there is a version of OpenZeppelin Contracts that supports Solidity 0.8 then you may need to override additional functions depending on your usecase. The design decision is covered in the OpenZeppelin Contracts 3.4 blog post.

...the responsibility to ensure correctness when functions are overriden will be on the users and not on the OpenZeppelin maintainers
_From: https://blog.openzeppelin.com/openzeppelin-contracts-3-4/_