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 NFT Storage Requirement to Collection and forEachID() #211

Merged
merged 5 commits into from Apr 15, 2024

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Apr 11, 2024

Description

FLIP

Based on this discussion in discord and this comment on the NFT standard PR, we have come to the conclusion that it probably makes sense to enforce how NFTs are stored for standardization and in this specific case, to allow projects to easily iterate through IDs in a collection that has many stored NFTs.

Enforcing the ownedNFTs field does not restrict projects who want to store their NFTs in unique ways because they can just ignore the field if they want, so having it for the 99% of projects who do and will follow it is very useful.


For contributor use:

  • Targeted PR against standard-v2 branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@cody-evaluate
Copy link

cody-evaluate commented Apr 11, 2024

looks great, one thing i would add is a default implementation for Collection.getLength() as:

return self.ownedNFTs.length

then you could remove the getLength() implementation from ExampleNFT.cdc to make it more concise

@joshuahannan

contracts/ExampleNFT.cdc Outdated Show resolved Hide resolved
contracts/NonFungibleToken.cdc Show resolved Hide resolved
transactions/scripts/iterate_ids.cdc Outdated Show resolved Hide resolved
transactions/scripts/iterate_ids.cdc Outdated Show resolved Hide resolved
contracts/ExampleNFT.cdc Show resolved Hide resolved
contracts/NonFungibleToken.cdc Outdated Show resolved Hide resolved
contracts/NonFungibleToken.cdc Show resolved Hide resolved
@joshuahannan joshuahannan merged commit 39036ac into standard-v2 Apr 15, 2024
2 checks passed
@joshuahannan joshuahannan deleted the forEachKey branch April 15, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants