cienicera / nft-svg-onchain-multiseries

Multi Series On-chain SVG NFT contract for p5mint
Apache License 2.0
0 stars 2 forks source link

Add Series Creation Functionality with Artist Metadata #1

Closed caseywescott closed 2 weeks ago

caseywescott commented 3 weeks ago

Description:

We need to implement a function to allow the creation of NFT series within the smart contract, including metadata for the artist who created the series. This will enable artists to create and manage multiple series of NFTs, with each series associated with artist-specific information such as name, bio, and profile links.

Tasks:

1. Define the Series Data Structure:

Create a new data structure in the smart contract to store information about each series. This structure should include fields for the series name, description, base URI, and any other necessary metadata.

struct Series { name: felt252, description: felt252, base_uri: felt252, }

2. Define an ArtistMetadata struct to store artist-specific information:

struct ArtistMetadata { name: felt252, bio: felt252, profile_link: felt252, }

3. Define a Function to Create Series:

The function signature is as follows:

fn create_series(ref self: ContractState, name: felt252, description: felt252, artist_info: ArtistMetadata, base_uri: felt252, ) -> u256 { // Function implementation goes here }

Implement the create_series function to:

Update ContractState:

Modify the ContractState to include mappings or lists that track all created series and their associated artist metadata by their unique IDs.

Validation and Error Handling:

Ensure that series names are unique within the contract to avoid conflicts. Implement error handling to manage cases where invalid or duplicate data is provided.

Testing:

Write unit tests to verify the functionality of the create_series function, including the handling of artist metadata.

Test cases should include:

4. Update Storage Struct to Support NFT Series and Artist Metadata

To implement the series creation functionality with artist metadata, we need to update the Storage struct to include additional fields for managing both NFT series and associated artist information. This update will allow the smart contract to store and manage multiple series, each with its own metadata and linked artist data.

Current Storage Struct:

[storage]

struct Storage { _name: felt252, _symbol: felt252, _owners: LegacyMap<u256, ContractAddress>, _balances: LegacyMap<ContractAddress, u256>, _token_approvals: LegacyMap<u256, ContractAddress>, _operator_approvals: LegacyMap<(ContractAddress, ContractAddress), bool>, _token_uri: LegacyMap<u256, felt252>, _owner: ContractAddress, }

Add Series to the Storage Struct:

Update the Storage struct to include the following fields for series and artist management

[storage]

struct Storage { _name: felt252, _symbol: felt252, _owners: LegacyMap<u256, ContractAddress>, _balances: LegacyMap<ContractAddress, u256>, _token_approvals: LegacyMap<u256, ContractAddress>, _operator_approvals: LegacyMap<(ContractAddress, ContractAddress), bool>, _token_uri: LegacyMap<u256, felt252>, _owner: ContractAddress, _series_counter: u256, // Counter to track the number of series created _series_data: LegacyMap<u256, Series>, // Mapping of series ID to Series struct }

Explanation:

_series_counter: A counter that increments with each new series created, ensuring each series has a unique ID. _series_data: A mapping from series ID to a Series struct, which will store the series metadata, including artist information.

Expected Outcome:

After implementing these changes, the contract will be capable of storing and managing multiple NFT series, each with its own unique metadata, including artist-specific information, enabling enhanced functionality for the p5mint platform.

ikemHood commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hey, I am ikem Peter. a fullstack software developer with 3+ years of working experience, I would love to help out with this issue...

How I plan on tackling this issue

To approach this issue, I'd start by focusing on the data structures and storage. I'd update the Storage struct in our smart contract to include new fields for managing NFT series and artist metadata. This would involve adding mappings or lists to track created series by their unique IDs, as well as associated artist information. I'd make sure these new structures can efficiently store and retrieve the series name, description, base URI, and artist details like name, bio, and profile links.

Next, I'd implement the create_series function. This function would take in the series details and artist metadata as inputs, generate a unique ID for the new series, and store all this information in our updated contract state. I'd include validation to ensure series names are unique and handle any potential errors. After implementation, I'd write comprehensive unit tests to verify the function works correctly, including tests for successful creation, duplicate name attempts, and various edge cases. Throughout this process, I'd keep the code clean, well-documented, and optimized for gas efficiency on Starknet.

od-hunter commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, please I'd love to be given the opportunity to contribute to this rep, I am a blockchain developer html, css, react, JavaScript, typescript, solidity and Cairo.

How I plan on tackling this issue

I'd take the fooling steps to solve this issue:

  1. I'll define the structures: Series: which includes name, description, and base_uri. ArtistMetadata: which includes name, bio, and profile_link.
  2. I'll implement create_series Function(accepts name, description, artist_info, and base_uri. I'll generates a unique ID for the series, also store the series and artist metadata in the contract state.
  3. I'll update Storage Struct, that is, Add _series_counter to track series creation & Add _series_data to map series IDs to series details. 4.I'll ensure series names are unique and make sure to handle cases of invalid or duplicate data.

Please assign this issue to me, I'm ready to work. Give me the opportunity to contribute to this repo.

Abeeujah commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm a Web and Systems engineer

How I plan on tackling this issue

By ticking through all the tasks sequentially

PedroCo3lho commented 3 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a software developer, who worked in different projects contributing to Starknet Ecosystem as a full-stack and smart-contracts programmer. I'm also graduating at Computer Science I started contribute by participating of the Starknet Hacker House where i built a dApp in the Starknet ecosystem

How I plan on tackling this issue

Modifying the Cairo contract adding the new features requested and write test to guarantee all the behaviors expected

onlydustapp[bot] commented 3 weeks ago

The maintainer caseywescott has assigned od-hunter to this issue via OnlyDust Platform. Good luck!

caseywescott commented 3 weeks ago

Hey @od-hunter ! Stoked to have you tackling this issue. Let me know if you have any questions!