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(spg-nft): add deduplication option to mint functions #108

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

sebsadface
Copy link
Member

Description

This PR adds a new deduplication option to the mint and mintByPeriphery functions in SPGNFT, integrating this option into the existing workflow functions that use SPGNFT.

Function Behaviors

  • In SPGNFT, themint and mintByPeriphery functions will check if the dedup parameter is set to true and skip the minting process if the nftMetadataHash has already been used. Instead, the function will return the token ID of the original mint associated with that metadata hash.
  • In RegistrationWorkflows, DerivativeWorkflows, LicenseAttachmentWorkflows, and GroupingWorkflows, attempting to mint with a duplicated nftMetadataHash while dedup is enabled will throw an error containing information about the IP that was first registered with the metadata hash.
  • If the dedup flag is set to false, the same nftMetadataHash can be reused for minting and registering multiple IPs.

Test Plan

Refactored existing tests to include the deduplication parameter. Added new tests to ensure the functions correctly revert when deduplication occurs.

Related Issue

contracts/SPGNFT.sol Outdated Show resolved Hide resolved
contracts/SPGNFT.sol Outdated Show resolved Hide resolved
Copy link

@kingster-will kingster-will left a comment

Choose a reason for hiding this comment

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

LGTM.

@sebsadface sebsadface merged commit 8edb5f3 into storyprotocol:main Oct 30, 2024
3 checks passed
@sebsadface sebsadface deleted the unique-check branch December 4, 2024 05:38
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.

Add Uniqueness Check for nftMetadataHash During IP Registration
2 participants