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

Add an ERC721Enumerable extension to the contract #3

Open
PopcornPaws opened this issue Dec 13, 2023 · 1 comment
Open

Add an ERC721Enumerable extension to the contract #3

PopcornPaws opened this issue Dec 13, 2023 · 1 comment

Comments

@PopcornPaws
Copy link
Contributor

Description

The frontend needs a tokenOfOwnerByIndex method from the contract which returns the pin_id of a given user, based on the index of the pin among the user's tokens. To understand better, here's an example flow of how the respective storage map should look like:

  • the user mints three pins with ids 234, 240 and 345
address -> balance_id -> pin_id
0xabc.. -> 0 -> 234
0xabc.. -> 1 -> 240
0xabc.. -> 2 -> 345
  • the user burns pin 234
address -> balance_id -> pin_id
0xabc.. -> 0 -> 345 // the last pin id is written to the burned balance id
0xabc.. -> 1 -> 240
  • the user mints pin 567
address -> balance_id -> pin_id
0xabc.. -> 0 -> 345
0xabc.. -> 1 -> 240
0xabc.. -> 2 -> 567

@TomiOhl does this look correct?

@PopcornPaws PopcornPaws self-assigned this Dec 13, 2023
@TomiOhl
Copy link
Contributor

TomiOhl commented Dec 15, 2023

Looks good! Let me add some reference links:

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