Skip to content

feat: implement IP registration fee payment#199

Open
sebsadface wants to merge 1 commit intostoryprotocol:mainfrom
sebsadface:fix/register-fee
Open

feat: implement IP registration fee payment#199
sebsadface wants to merge 1 commit intostoryprotocol:mainfrom
sebsadface:fix/register-fee

Conversation

@sebsadface
Copy link
Member

Description

This PR adds support for potential IP registration fees by integrating payment logic into interactions with the IPAssetRegistry. While the fee is currently zero, this prepares the system for future requirements and allows the protocol to enable registration fees when needed.

Changes

  • Added a reusable internal function _collectRegistrationFeeAndApprove in BaseWorkflow to handle fee collection and approval
  • Updated IOrgNFT interface to include registrationFeePayer parameter in mint functions
  • Added fee collection logic to OrgNFT and BaseStoryNFT contracts
  • Integrated fee collection into all workflow contracts that register IPs
  • Added SafeERC20 utility for secure token transfers

Implementation Details

  • The fee is collected from the specified payer (typically msg.sender) using safeTransferFrom
  • The workflow contract then approves the IP Asset Registry to spend the collected fee
  • Fee collection happens immediately before calling IP_ASSET_REGISTRY.register()
  • Zero fee amounts are handled gracefully (no transfers occur)

Testing

  • Updated existing StoryNFT tests to accommodate the new registrationFeePayer parameter
  • Verified fee collection works properly when IpAssetRegistry.getFeeAmount() returns non-zero values
  • Confirmed existing functionality works when fee amount is zero

Introduces a mechanism for paying IP registration fees.
Adds a registrationFeePayer parameter to OrgNFT.mintRootOrgNft and OrgNFT.mintOrgNft functions and their corresponding interface IOrgNFT.
Implements fee collection logic within BaseStoryNFT and OrgNFT by transferring the fee from the specified payer (msg.sender or registrationFeePayer) and approving the IP_ASSET_REGISTRY.
Creates a reusable internal function _collectRegistrationFeeAndApprove in BaseWorkflow to handle fee collection and approval, taking the registrationFeePayer as an argument.
Integrates the _collectRegistrationFeeAndApprove function call into all workflow contracts (DerivativeWorkflows, GroupingWorkflows, LicenseAttachmentWorkflows, RegistrationWorkflows, RoyaltyTokenDistributionWorkflows) before calling IP_ASSET_REGISTRY.register.
Updates OrgStoryNFTFactory to pass msg.sender as the registrationFeePayer when minting OrgNFTs.
Updates OrgNFT.t.sol tests to reflect the new registrationFeePayer parameter.
@sebsadface sebsadface closed this May 19, 2025
@sebsadface sebsadface deleted the fix/register-fee branch May 19, 2025 22:48
@sebsadface sebsadface restored the fix/register-fee branch May 19, 2025 23:10
@sebsadface sebsadface reopened this May 19, 2025
@sebsadface sebsadface changed the title Implement IP Registration Fee Payment feat: implement IP registration fee payment May 20, 2025
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.

1 participant