You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the NFT standard only allows retrieving a particular token based on its tokenId.
The Enumerable extension for ERC721 tokens, typically represented in smart contracts by interfaces such as IERC721Enumerable, adds functionality for discovering and navigating through all tokens in a contract, as well as querying tokens owned by a particular account. This extension enhances the ERC721 standard by providing a way to enumerate over all tokens or all tokens owned by a user, which is particularly useful for contracts that need to display or operate on a collection of NFTs.
User flow
For NFT Owners and Collectors:
Viewing Owned NFTs:
A collector can view a list of all NFTs they own within a particular collection. This is made possible by the tokenOfOwnerByIndex(address owner, uint256 index) function, which returns the token ID owned by a user at a given index within their list of owned tokens.
This enables user interfaces (UIs) to iterate over all NFTs owned by a user and display them, even if the total number is unknown beforehand.
Exploring the Entire Collection:
Users can explore the entire collection of NFTs issued by the contract. The totalSupply() function returns the total number of tokens in existence, and tokenByIndex(uint256 index) allows enumeration over all tokens based on their indices.
This feature supports the creation of gallery views or marketplaces where users can browse through every NFT in a collection, facilitating discovery and trading.
For Developers and Marketplaces:
Building Dynamic Interfaces:
Developers can leverage the Enumerable extension to build dynamic and responsive interfaces that automatically update to reflect the total supply and ownership distribution of NFTs in real-time.
This includes creating features like leaderboards, galleries, and personalized user dashboards that showcase NFT collections.
Implementing Advanced Querying and Filtering:
With the ability to enumerate tokens, developers can implement advanced querying and filtering logic to allow users to search for NFTs based on various criteria (e.g., rarity, attributes) within a collection.
This enhances the user experience by making it easier to find specific NFTs in potentially large and diverse collections.
Facilitating Efficient Transactions and Interactions:
The Enumerable extension makes it easier for contracts, such as marketplaces or games, to interact with NFT collections by providing structured ways to access and iterate over tokens.
This can lead to more efficient batch processing or aggregation operations, improving transaction efficiency and reducing costs.
NFT-enumerable-internals which defines the datastructure and internals function of an enumerable NFT
NFT-enumerable-example which is an example implementation of an enumerable NFT and showcases how to use the methods defined in the corresponding -internals file
The text was updated successfully, but these errors were encountered:
Context
Currently, the NFT standard only allows retrieving a particular token based on its tokenId.
The Enumerable extension for ERC721 tokens, typically represented in smart contracts by interfaces such as
IERC721Enumerable
, adds functionality for discovering and navigating through all tokens in a contract, as well as querying tokens owned by a particular account. This extension enhances the ERC721 standard by providing a way to enumerate over all tokens or all tokens owned by a user, which is particularly useful for contracts that need to display or operate on a collection of NFTs.User flow
For NFT Owners and Collectors:
Viewing Owned NFTs:
tokenOfOwnerByIndex(address owner, uint256 index)
function, which returns the token ID owned by a user at a given index within their list of owned tokens.Exploring the Entire Collection:
totalSupply()
function returns the total number of tokens in existence, andtokenByIndex(uint256 index)
allows enumeration over all tokens based on their indices.For Developers and Marketplaces:
Building Dynamic Interfaces:
Implementing Advanced Querying and Filtering:
Facilitating Efficient Transactions and Interactions:
Technical details
Based on openzeplin's implementation https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721Enumerable.sol
Implement
NFT-enumerable-internals
which defines the datastructure and internals function of an enumerable NFTNFT-enumerable-example
which is an example implementation of an enumerable NFT and showcases how to use the methods defined in the corresponding -internals fileThe text was updated successfully, but these errors were encountered: