RoyaltyModule
The RoyaltyModule is the main entry point for handling royalty payments on Story. It allows IP owners to set royalty policies for their IP assets and enables derivative IP owners to pay royalties to their parent IPs.
State Variables
LICENSE_REGISTRY
The address of the License Registry contract that tracks license terms and tokens.
DISPUTE_MODULE
The address of the Dispute Module contract that handles dispute resolution.
licensingModule
The address of the Licensing Module contract.
isWhitelistedRoyaltyPolicy
Indicates if a royalty policy is whitelisted.
isWhitelistedRoyaltyToken
Indicates if a royalty token is whitelisted.
royaltyPolicies
Maps IP IDs to their royalty policies.
Functions
initialize
Initializer for this implementation contract.
Parameters:
accessManager
: The address of the protocol admin roles contract.
setLicensingModule
Sets the licensing module.
Parameters:
licensing
: The address of the license module.
whitelistRoyaltyPolicy
Whitelist a royalty policy.
Parameters:
royaltyPolicy
: The address of the royalty policy.allowed
: Indicates if the royalty policy is whitelisted or not.
whitelistRoyaltyToken
Whitelist a royalty token.
Parameters:
token
: The token address.allowed
: Indicates if the token is whitelisted or not.
onLicenseMinting
Executes royalty related logic on license minting.
Parameters:
ipId
: The ipId whose license is being minted (licensor).royaltyPolicy
: The royalty policy address of the license being minted.licenseData
: The license data custom to each the royalty policy.externalData
: The external data custom to each the royalty policy.
onLinkToParents
Executes royalty related logic on linking to parents.
Parameters:
ipId
: The children ipId that is being linked to parents.royaltyPolicy
: The common royalty policy address of all the licenses being burned.parentIpIds
: The parent ipIds that the children ipId is being linked to.licenseData
: The license data custom to each the royalty policy.externalData
: The external data custom to each the royalty policy.
payRoyaltyOnBehalf
Allows the function caller to pay royalties to the receiver IP asset on behalf of the payer IP asset.
Parameters:
receiverIpId
: The ipId that receives the royalties.payerIpId
: The ipId that pays the royalties.token
: The token to use to pay the royalties.amount
: The amount to pay.
payLicenseMintingFee
Allows to pay the minting fee for a license.
Parameters:
receiverIpId
: The ipId that receives the royalties.payerAddress
: The address that pays the royalties.licenseRoyaltyPolicy
: The royalty policy of the license being minted.token
: The token to use to pay the royalties.amount
: The amount to pay.
licensingModule
Returns the licensing module address.
Returns:
- The address of the licensing module.
isWhitelistedRoyaltyPolicy
Indicates if a royalty policy is whitelisted.
Parameters:
royaltyPolicy
: The address of the royalty policy.
Returns:
isWhitelisted
: True if the royalty policy is whitelisted.
isWhitelistedRoyaltyToken
Indicates if a royalty token is whitelisted.
Parameters:
token
: The address of the royalty token.
Returns:
isWhitelisted
: True if the royalty token is whitelisted.
royaltyPolicies
Indicates the royalty policy for a given IP asset.
Parameters:
ipId
: The ID of IP asset.
Returns:
royaltyPolicy
: The address of the royalty policy.
supportsInterface
IERC165 interface support.
Parameters:
interfaceId
: The interface identifier.
Returns:
- Returns true if the interface is supported.
Security Considerations
The RoyaltyModule contract implements several security measures:
-
Access Control: Most administrative functions are restricted to be called only by the protocol admin through the
restricted
modifier. -
Module Interaction Control: Functions like
onLicenseMinting
andpayLicenseMintingFee
can only be called by the Licensing Module through theonlyLicensingModule
modifier. -
Reentrancy Protection: The
nonReentrant
modifier is used on functions that handle token transfers to prevent reentrancy attacks. -
Pausability: The contract can be paused in emergency situations using the
whenNotPaused
modifier. -
Whitelisting Mechanism: The contract implements whitelisting for royalty policies and tokens to ensure that only approved components can interact with the royalty system.
-
Dispute Resolution Integration: The contract integrates with the Dispute Module to handle any disputes related to royalty payments.