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

🗞️ feat: add ONFT721Enumerable to onft-evm #1184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

St0rmBr3w
Copy link
Contributor

@St0rmBr3w St0rmBr3w commented Jan 22, 2025

In this PR:

This PR introduces the ONFT721Enumerable contract to the onft-evm library, extending the functionality of ONFT721Core by integrating OpenZeppelin's ERC721Enumerable. This enhancement allows for enumeration of tokens owned by an address and all tokens within the contract, providing developers with advanced querying capabilities for ONFTs.

Key Features:

  • Extension of ONFT721Core with ERC721Enumerable:
    • Enables token enumeration features such as tokenOfOwnerByIndex and tokenByIndex.

Usage Considerations:

  • Gas-Implications Updates to Data Structures:
    • Implements additional mappings (_allTokens, _allTokensIndex, _ownedTokens, _ownedTokensIndex) to track tokens globally and per owner.
    • Requires updating these data structures during minting, burning, and transferring tokens:
      • Minting: Adds token IDs to _allTokens and _ownedTokens.
      • Burning: Removes token IDs from both _allTokens and _ownedTokens.
      • Transferring: Updates _ownedTokens for both sender and recipient.

For projects sensitive to gas costs, careful evaluation is necessary to determine whether the enumeration features outweigh the added costs.

@St0rmBr3w St0rmBr3w changed the title feat: add ONFT721Enumerable to onft-evm 🗞️ feat: add ONFT721Enumerable to onft-evm Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants