huff-language / huffmate

A library of modern, hyper-optimized, and extensible Huff contracts with extensive testing and documentation built by Huff maintainers.
https://github.com/pentagonxyz/huffmate
MIT License
430 stars 55 forks source link

Shouldnt the ERC721 implementation revert on `ownerOf(address(0))`? #125

Closed eugenioclrc closed 10 months ago

eugenioclrc commented 1 year ago

This is a quote from eip-721

/// @notice Find the owner of an NFT /// @param _tokenId The identifier for an NFT /// @dev NFTs assigned to zero addresses are considered invalid, and queries /// about them do throw. /// @return The address of the owner of the NFT function ownerOf(uint256 _tokenId) external view returns (address);

I dig into other implementations and see that ownerOf(address(0)) reverts;

But in the Huffmate implementation is returning always 0, shoulndt revert instead? Please view ERC721.t.sol#L821-L824

Buttplug

MathisGD commented 1 year ago

Do you mean that the view function returning the owner of a given tokenId should revert when the "owner" is address zero ? If yes it seems that your are right.