Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usedId purpose in ERC721 #56

Open
pcaversaccio opened this issue Apr 23, 2024 · 1 comment
Open

usedId purpose in ERC721 #56

pcaversaccio opened this issue Apr 23, 2024 · 1 comment

Comments

@pcaversaccio
Copy link

pcaversaccio commented Apr 23, 2024

In the IERC721Internal interface you define the following function usedId:

function usedId(uint256 tokenId) external view returns (bool);

I'm having a hard time to understand what is the reason behind using this as part of the interface. In your ERC721Compliant contract, you declare it but not use it:

mapping(uint256 => bool) public usedId;

If someone adds something like usedId[id] = true to the _customMint function, the following property always fails obviously:

assertWithMsg(!token.usedId(tokenId), "Token ID minted is not new");

If you want to track the used ids, you should update it after the above test assertion to make sense.

Furthermore, the README section on the ERC721 is outdated. There is no ITokenMock in the ERC721 case for example, but IERC721Internal. I would recommend making it consistent with the ERC20 example tho & updating the docs about the latest status quo.

@tuturu-tech
Copy link
Contributor

Hey @pcaversaccio , appreciate you opening an issue. I think usedId was just to facilitate checking that the same tokenId cannot be minted more than once, but it might not have been implemented fully/properly. Good point on the README being outdated, I can probably get to fixing this sometime next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants