Skip to content

More efficient enumerable#129

Merged
RogerPodacter merged 3 commits into
evm-backend-demofrom
rename
Oct 22, 2025
Merged

More efficient enumerable#129
RogerPodacter merged 3 commits into
evm-backend-demofrom
rename

Conversation

@RogerPodacter

@RogerPodacter RogerPodacter commented Oct 22, 2025

Copy link
Copy Markdown
Member

Note

Extract enumerable logic into mixins and switch Ethscriptions to sequential enumerable while Collections uses general enumerable; add tests for both paths.

  • Core ERC721 (ethscriptions):
    • Split enumerable features out of ERC721EthscriptionsUpgradeable into hooks (_afterTokenMint, _beforeTokenRemoval) and per-owner tracking; removed global _allTokens management and IERC721Enumerable from base.
    • Added ERC721EthscriptionsEnumerableUpgradeable (sparse IDs, supports burns) and ERC721EthscriptionsSequentialEnumerableUpgradeable (sequential IDs, no burns) implementing IERC721Enumerable via the new hooks.
  • Contracts:
    • Ethscriptions now extends ERC721EthscriptionsSequentialEnumerableUpgradeable (sequential supply, indexable by position).
    • CollectionsERC721 now extends ERC721EthscriptionsEnumerableUpgradeable; updated overrides to conform with IERC721/metadata interfaces and enumeration mixin.
  • Tests:
    • Added ERC721EthscriptionsMixins.t.sol with harnesses and tests covering sequential ID enforcement, burn forbiddance, sparse ID tracking across burns, and owner enumeration updates on transfer.

Written by Cursor Bugbot for commit c0b8975. This will update automatically on new commits. Configure here.

@RogerPodacter RogerPodacter requested a review from Copilot October 22, 2025 19:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the ERC721 enumerable implementation to support two distinct patterns: a sequential enumerable variant for collections with sequential, immutable token IDs, and a general enumerable variant for collections supporting arbitrary IDs and burns. The sequential variant eliminates the need for expensive storage operations by leveraging the predictable ID structure.

Key Changes:

  • Split enumerable functionality into two specialized mixins based on token ID patterns
  • Removed enumerable logic from the base contract and replaced it with extension hooks
  • Updated the main Ethscriptions contract to use the optimized sequential enumerable variant

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ERC721EthscriptionsUpgradeable.sol Removed enumerable interface and moved token tracking to hooks for derived contracts
ERC721EthscriptionsSequentialEnumerableUpgradeable.sol New mixin implementing efficient enumeration for sequential, immutable token IDs
ERC721EthscriptionsEnumerableUpgradeable.sol New mixin implementing general enumeration with full token tracking for arbitrary IDs
Ethscriptions.sol Updated to inherit from sequential enumerable variant
CollectionsERC721.sol Updated to inherit from general enumerable variant with explicit override declarations
ERC721EthscriptionsMixins.t.sol New comprehensive test suite for both enumerable implementations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread contracts/src/ERC721EthscriptionsSequentialEnumerableUpgradeable.sol Outdated
cursor[bot]

This comment was marked as outdated.

@RogerPodacter RogerPodacter merged commit 91cb359 into evm-backend-demo Oct 22, 2025
2 checks passed
@RogerPodacter RogerPodacter deleted the rename branch October 22, 2025 19:59
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

Successfully merging this pull request may close these issues.

2 participants