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

Introduce Group IPA Feature #192

Merged
merged 25 commits into from
Aug 26, 2024

Conversation

kingster-will
Copy link

@kingster-will kingster-will commented Aug 2, 2024

Description

This PR introduces a new Group IPA feature, enabling the creation and management of groups of IP Assets. The Group IPA feature supports a royalty pool for the group and allows the Group IPA to function equivalently to a normal IP Asset. This includes the ability to attach license terms, create derivatives, execute with modules, and perform other interactions.

This PR mainly defines the external interfaces of Group IPA.

Summary by CodeRabbit

  • New Features
    • Introduced interfaces for managing Group NFTs, including minting, grouping, and reward functionalities.
    • Added functionalities for registering and tracking Group IP Assets, enhancing management of intellectual property groups.
  • Events
    • Implemented events to capture key actions, such as minting Group NFTs and adding/removing IPs from groups, improving transparency.
  • Functions
    • Provided methods for adding/removing IPs, claiming rewards, and retrieving information about group policies and members.

Copy link

coderabbitai bot commented Aug 2, 2024

Walkthrough

The recent changes introduce several interfaces aimed at enhancing the management of Group NFTs and their related functionalities within a blockchain ecosystem. These interfaces facilitate the minting of Group NFTs, organization of Intellectual Properties (IPs) into groups, claiming of rewards, and registration of Group IP Assets. Collectively, they establish a robust framework that ensures secure interactions and efficient operations for NFTs and IPs.

Changes

Files Change Summary
contracts/interfaces/IGroupNFT.sol Introduced IGroupNFT interface for minting Group NFTs, including the GroupNFTMinted event and mintGroupNft function.
contracts/interfaces/modules/grouping/IGroupingModule.sol New IGroupingModule interface for managing grouping actions, with events for adding/removing IPs and claiming rewards.
contracts/interfaces/modules/grouping/IGroupingPolicy.sol Added IGroupingPolicy interface to retrieve rewards for IPs in a group via the getReward function.
contracts/interfaces/registries/IGroupIPAssetRegistry.sol Created IGroupIPAssetRegistry interface for managing Group IP registrations, including functions for registration, status checks, and member retrieval.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GroupNFT
    participant GroupingModule
    participant GroupIPRegistry

    User->>GroupNFT: mintGroupNft(minter, receiver)
    GroupNFT-->>User: GroupNFTMinted event
    User->>GroupingModule: addIp(groupIpId, ipIds)
    GroupingModule-->>User: AddedIpToGroup event
    User->>GroupingModule: claimReward(groupId, token, ipIds)
    GroupingModule-->>User: ClaimedReward event
    User->>GroupIPRegistry: registerGroup(groupPolicy)
    GroupIPRegistry-->>User: IPGroupRegistered event
Loading

🐰 In the meadow where NFTs bloom,
A rabbit hops with joy, dispelling gloom.
Grouped IPs dance in a merry parade,
Minting and claiming, they’ve got it made!
With every event, their stories grow bright,
In the blockchain’s embrace, they take flight! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kingster-will kingster-will marked this pull request as ready for review August 9, 2024 20:06
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 226cf1c and cf87887.

Files selected for processing (4)
  • contracts/interfaces/IGroupNFT.sol (1 hunks)
  • contracts/interfaces/modules/grouping/IGroupingModule.sol (1 hunks)
  • contracts/interfaces/modules/grouping/IGroupingPolicy.sol (1 hunks)
  • contracts/interfaces/registries/IGroupIPAssetRegistry.sol (1 hunks)
Additional comments not posted (14)
contracts/interfaces/modules/grouping/IGroupingPolicy.sol (1)

12-16: Verify the correctness of function parameters and return type.

Ensure that the parameters groupId, token, and ipIds are appropriate for calculating rewards. The return type uint256[] memory suggests multiple rewards are returned. Confirm that this aligns with the intended design.

contracts/interfaces/IGroupNFT.sol (2)

17-21: Verify the function parameters and return type.

Ensure that the parameters minter and receiver are appropriate for minting a Group NFT. The return type uint256 suggests the ID of the minted NFT is returned. Confirm that this aligns with the intended design.


11-15: Verify the event parameters and documentation.

Ensure that the parameters minter, receiver, and tokenId accurately represent the event's purpose. Check if the documentation clearly describes the event's context and usage.

contracts/interfaces/modules/grouping/IGroupingModule.sol (4)

28-38: Verify the function parameters and documentation for addIp and removeIp.

Ensure that the parameters groupIpId and ipIds are appropriate for adding and removing IPs from a group. Confirm that the documentation aligns with the intended design.

Verification successful

Function Parameters and Documentation Verified

The parameters groupIpId and ipIds for the addIp and removeIp functions are appropriate for their intended operations. The documentation aligns with the design, specifying the necessary permissions for executing these functions. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `addIp` and `removeIp` function parameters in the codebase.

# Test: Search for the functions usage. Expect: Consistent parameter usage and clear documentation.
ast-grep --lang solidity --pattern $'function addIp(address $_, address[] calldata $_) external' 
ast-grep --lang solidity --pattern $'function removeIp(address $_, address[] calldata $_) external' 

Length of output: 432


Script:

#!/bin/bash
# Description: Verify the usage of `addIp` and `removeIp` function parameters in the codebase using ripgrep.

# Search for occurrences of `addIp` function in Solidity files
rg 'addIp\s*\(address' --glob '*.sol' -A 3

# Search for occurrences of `removeIp` function in Solidity files
rg 'removeIp\s*\(address' --glob '*.sol' -A 3

Length of output: 913


11-19: Verify the event parameters and documentation for AddedIpToGroup and RemovedIpFromGroup.

Ensure that the parameters groupId and ipId accurately represent the events' purposes. Check if the documentation clearly describes the events' contexts and usages.


40-44: Verify the function parameters and documentation for claimReward.

Ensure that the parameters groupId, token, and ipIds are appropriate for claiming rewards. Confirm that the documentation aligns with the intended design.


21-26: Verify the event parameters and documentation for ClaimedReward.

Ensure that the parameters groupId, token, ipId, and amount accurately represent the event's purpose. Check if the documentation clearly describes the event's context and usage.

contracts/interfaces/registries/IGroupIPAssetRegistry.sol (7)

12-17: Event declaration is well-designed.

The IPGroupRegistered event is appropriately structured with indexed parameters to facilitate efficient log searches.


19-22: Function declaration is clear and appropriate.

The registerGroup function is well-defined with a clear parameter and return type.


24-27: Function declaration is well-structured.

The isGroupRegistered function is clearly defined with an appropriate return type for its purpose.


29-32: Function declaration is clear and appropriate.

The getGroupPolicy function is well-defined with a clear parameter and return type.


34-43: Function declaration supports efficient data retrieval.

The getGroupMembers function is well-structured with clear parameters for pagination.


45-49: Function declaration is well-structured.

The containsIp function is clearly defined with an appropriate return type for its purpose.


51-54: Function declaration is clear and appropriate.

The totalMembers function is well-defined with a clear parameter and return type.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cf87887 and e872ffa.

Files selected for processing (4)
  • contracts/interfaces/IGroupNFT.sol (1 hunks)
  • contracts/interfaces/modules/grouping/IGroupingModule.sol (1 hunks)
  • contracts/interfaces/modules/grouping/IGroupingPolicy.sol (1 hunks)
  • contracts/interfaces/registries/IGroupIPAssetRegistry.sol (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • contracts/interfaces/IGroupNFT.sol
  • contracts/interfaces/modules/grouping/IGroupingModule.sol
  • contracts/interfaces/modules/grouping/IGroupingPolicy.sol
  • contracts/interfaces/registries/IGroupIPAssetRegistry.sol

contracts/GroupNFT.sol Outdated Show resolved Hide resolved
@Spablob
Copy link

Spablob commented Aug 22, 2024

Can group NFTs have ancestors? What does it mean for a Group NFT to be a derivative?
Or should Group NFTs always be roots?

@kingster-will
Copy link
Author

Can group NFTs have ancestors? What does it mean for a Group NFT to be a derivative? Or should Group NFTs always be roots?

Yes, Group IP could be a derivative.

contracts/GroupNFT.sol Outdated Show resolved Hide resolved
contracts/LicenseToken.sol Outdated Show resolved Hide resolved
contracts/LicenseToken.sol Outdated Show resolved Hide resolved
@kingster-will kingster-will merged commit 0c3949b into storyprotocol:main Aug 26, 2024
2 checks passed
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