Cyfrin / foundry-nft-cu

22 stars 25 forks source link

_isApprovedOrOwner and _exists are no longer included on open zeppelinERC721 contract #14

Closed CaeraDenoir closed 1 year ago

CaeraDenoir commented 1 year ago

As the title says, _isApprovedOrOwner and _exists will not be defined when importing the open zeppelin ERC721 contract.

PatrickAlphaC commented 1 year ago

Thanks! You'll have to use the older version of openzeppelin... or remove those. What do you think is better/easier?

CaeraDenoir commented 1 year ago

Found a way using the functions on the newer version of openzeppelin. I think it's doing exactly the same checks as the old functions but i am not sure. For the _isApprovedOrOwner, the newer _isAuthorized should do the trick. _isAuthorized(_ownerOf(tokenId), msg.sender, tokenId) should be equal to _isApprovedOrOwner(msg.sender, tokenId).

For the _exists it is quite simple, the openzeppelin changelogs advise to just change it for _ownerOf(tokenId) != address(0)

Not sure about the _isApprovedOrOwner one.

cromewar commented 1 year ago

Added this to chronological updates, thanks a lot @CaeraDenoir