-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor/Optimize Contract for multi series minting #4
Comments
Hi @caseywescott , can I work on this ASAP? I can’t see where to apply via Onlydust. |
Hey @od-hunter! |
Hi @caseywescott can i please be assigned to this issue |
Hey @ShantelPeters! |
Title: Refactor to Use ERC721Component for Series Management Description: We need to refactor the current implementation of our NFT series smart contract to better align with common practices for ERC721 contracts. Specifically, we want to transition to using an ERC721Component within the Series struct. This refactoring will make the contract more modular, maintainable, and scalable by reusing standard ERC721 functionality while incorporating additional series-specific metadata. Current Implementation: The current contract uses a custom Series struct that manages its own mapping of token IDs to TokenData. Refactored Design: Series Struct: Integrate the ERC721Component as a substorage within the Series struct.
Token Management: The ERC721Component will manage token ownership and metadata through its standard methods. Remove Custom TokenData Struct and Mapping: The TokenData struct and the token_ids mapping are no longer needed because the ERC721Component will handle all token-related data. Remove the following:
Remove the following from Series Struct:
Update the minting logic to leverage the ERC721Component for creating and managing new tokens within a series.
Storage Struct Adjustments:
Updated Storage Struct: Tasks:
|
I understand what we are trying to achieved here, |
I am applying to this issue via OnlyDust platform. My background and how it can be leveragedI am a Cairo smart contract developer with experience working on projects such as Just Art Peace, Dojo, Kart, TBA, and Shinigami. Before transitioning to Cairo development, I was a backend developer specializing in Rust. My recent work with cairo starknet
How I plan on tackling this issueimplement the series management using openzeppelin ERC721Component |
The maintainer caseywescott has assigned mubarak23 to this issue via OnlyDust Platform. |
**THIS LINKS TO THE NEW UPDATED SPEC:
#4 (comment)**
This contract could be further optimized and better aligned with common practices for NFT series smart contracts.
Typically, NFT series contracts are structured in a way that encapsulates series and artist information in a more cohesive and organized manner. This often includes the use of a Series struct that not only contains metadata about the series and the artist but also manages the NFTs associated with that series.
A More Common Structure for NFT Series Contracts:
Series Struct:
A Series struct would encapsulate all data related to a series, including the series metadata, artist information, and a mapping of NFTs belonging to that series.
Example:
struct Series {
name: ByteArray,
description: ByteArray,
artist: ArtistMetadata,
base_uri: felt252,
token_ids: LegacyMap<u256, TokenData>, // Map of token IDs to their data -
}
Artist Struct:
The ArtistMetadata can be part of the Series struct or managed separately if there is a need for more complex relationships between artists and series. (I'm open to something different here if it makes more sense)
Example:
struct ArtistMetadata {
name: ByteArray,
bio: ByteArray,
wallet_address: ContractAddress,
}
Token Data:
Instead of just mapping a token ID to an owner, a TokenData struct could be used to encapsulate all information related to an individual SVG NFT, including its ownership, metadata, and any other relevant properties.
Example:
(Have a think about this as it might need more thought)
struct TokenData {
owner: ContractAddress,
token_uri: ByteArray, // URI or direct SVG data
}
Mapping and Management:
The contract would maintain a mapping of series IDs to Series structs, where each Series struct internally manages its associated NFTs.
#[storage]
struct Storage {
_name: ByteArray,
_symbol: ByteArray,
_owner: ContractAddress,
_series_counter: u256,
_series_data: LegacyMap<u256, Series>, // Series now contains all token data
}
Minting Process:
During minting, the contract would add the NFT to the appropriate series by updating the token_ids mapping within the relevant Series struct.
Rough Mint Function Idea:
fn mint(ref self: ContractState, to: ContractAddress, series_id: u256, token_uri: felt252) {
assert(!to.is_zero(), 'ERC721: invalid receiver');
let token_id: u256 = self._series_counter.read() + 1.into();
assert(!self._exists(token_id), 'ERC721: token already minted');
}
This is rough so please reach out to me to discuss
The text was updated successfully, but these errors were encountered: