Skip to content

Refactor ERC721 Ethscriptions Collection and Manager Contracts#138

Merged
RogerPodacter merged 1 commit into
evm-backend-demofrom
fix_collections
Nov 7, 2025
Merged

Refactor ERC721 Ethscriptions Collection and Manager Contracts#138
RogerPodacter merged 1 commit into
evm-backend-demofrom
fix_collections

Conversation

@RogerPodacter

@RogerPodacter RogerPodacter commented Nov 7, 2025

Copy link
Copy Markdown
Member
  • Updated the ERC721EthscriptionsCollection to replace the factory address with a manager contract for improved control and management.
  • Enhanced the ERC721EthscriptionsCollectionManager to utilize a deduplicated storage approach for string fields, optimizing metadata handling.
  • Introduced new functions for retrieving collection metadata and membership details, improving data accessibility.
  • Adjusted tests to reflect changes in data structures and ensure accurate validation of collection metadata retrieval.

Note

Switch collection to a typed manager, add collection-level contractURI, refactor manager to deduplicate string metadata with new view getters, and update tests accordingly.

  • Contracts
    • ERC721EthscriptionsCollection:
      • Replace factory address with manager (ERC721EthscriptionsCollectionManager) and update access control/lookups.
      • Add contractURI() returning OpenSea-style collection JSON.
      • Simplify tokenURI to use manager directly.
    • ERC721EthscriptionsCollectionManager:
      • Introduce deduplicated string storage via DedupedBlobStore; CollectionRecord now stores bytes32 refs; add CollectionMetadata view struct.
      • getCollection(bytes32) now returns CollectionMetadata; add getCollectionByAddress(address) and getMembershipOfEthscription(bytes32).
      • Store string fields on creation/edit; make internal mappings internal; minor initialization cleanup.
    • Ethscriptions:
      • Restrict contentStorage/metadataStorage visibility to internal.
    • Library:
      • DedupedBlobStore: add readString(bytes32) helper.
  • Tests
    • Update to consume CollectionMetadata getters and new manager API; adjust address prediction and protocol tests accordingly.

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

- Updated the `ERC721EthscriptionsCollection` to replace the `factory` address with a `manager` contract for improved control and management.
- Enhanced the `ERC721EthscriptionsCollectionManager` to utilize a deduplicated storage approach for string fields, optimizing metadata handling.
- Introduced new functions for retrieving collection metadata and membership details, improving data accessibility.
- Adjusted tests to reflect changes in data structures and ensure accurate validation of collection metadata retrieval.
@RogerPodacter RogerPodacter requested a review from Copilot November 7, 2025 18:39

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 collection storage system to use deduplicated blob storage instead of storing strings directly in storage, significantly reducing gas costs for duplicate values. The changes introduce a new internal CollectionRecord struct that stores references to deduplicated blobs, while the existing struct is renamed to CollectionMetadata for external API consumption.

Key changes:

  • Introduces deduplicated blob storage for collection string fields (name, symbol, description, URIs, links)
  • Renames the external-facing struct from CollectionRecord to CollectionMetadata
  • Adds new helper functions (readString, getCollectionByAddress, getMembershipOfEthscription)
  • Changes visibility modifiers from private/public to internal for better extensibility

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
contracts/src/ERC721EthscriptionsCollectionManager.sol Introduces deduplicated storage system with CollectionRecord (internal) and CollectionMetadata (external view struct), updates all collection creation and editing logic to use DedupedBlobStore
contracts/src/libraries/DedupedBlobStore.sol Adds readString convenience wrapper to avoid repetitive string() casting when reading stored blobs
contracts/src/ERC721EthscriptionsCollection.sol Refactors factory field to manager with proper type, adds contractURI function for OpenSea integration
contracts/src/Ethscriptions.sol Changes contentStorage and metadataStorage visibility from public to internal for consistency
contracts/test/CollectionsProtocol.t.sol Updates type references from CollectionRecord to CollectionMetadata to match refactored API
contracts/test/CollectionsManager.t.sol Updates type references from CollectionRecord to CollectionMetadata to match refactored API
contracts/test/AddressPrediction.t.sol Updates type references from CollectionRecord to CollectionMetadata to match refactored API
Gemfile.lock Updates facet_rails_common dependency revision

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// @dev Convenience wrapper to avoid repetitive string() casting
/// @param ref The storage reference (packed or SSTORE2 pointer)
/// @return str The retrieved data as string
function readString(bytes32 ref) internal view returns (string memory) {

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

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

The return value documentation at line 98 specifies @return str but the function signature doesn't name the return value. For consistency with the NatSpec comment, consider adding the name to the return declaration: returns (string memory str) or update the documentation to @return The retrieved data as string.

Suggested change
function readString(bytes32 ref) internal view returns (string memory) {
function readString(bytes32 ref) internal view returns (string memory str) {

Copilot uses AI. Check for mistakes.
@RogerPodacter RogerPodacter merged commit c75340f into evm-backend-demo Nov 7, 2025
8 checks passed
@RogerPodacter RogerPodacter deleted the fix_collections branch November 7, 2025 18:47
@RogerPodacter RogerPodacter removed the request for review from Copilot March 23, 2026 21:43
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