The IPRoyaltyVault contract manages the claiming of royalty and revenue tokens for a given IP. It allows token holders to claim their share of revenue tokens based on snapshots, and ancestors to collect their royalty tokens.
The IP ID to which this royalty vault belongs.
The set of revenue tokens in the vault.
The amount of unclaimed royalty tokens.
The timestamp of the last snapshot.
Maps token addresses to the amount in the ancestors vault.
Indicates whether an ancestor has collected their royalty tokens.
Maps token addresses to the amount in the claim vault.
Maps snapshot IDs and token addresses to the claimable amount at that snapshot.
Maps snapshot IDs to the amount of unclaimed tokens at that snapshot.
Indicates whether a claimer has claimed a token at a specific snapshot.
Initializer for this implementation contract.
Parameters:
name
: The name of the royalty token.symbol
: The symbol of the royalty token.totalSupply
: The total supply of the royalty token.royaltyStack
: The royalty stack of the IP asset.ipId_
: The IP ID to which this royalty vault belongs.Adds a token to the royalty vault.
Parameters:
token
: The token address to add.Returns:
isAdded
: True if the token was added, false if it was already in the vault.Takes a snapshot of the claimable revenue and royalty token amounts.
Returns:
snapshotId
: The ID of the snapshot.Allows token holders to claim their share of revenue tokens.
Parameters:
snapshotIds
: The snapshot IDs to claim from.token
: The revenue token to claim.Allows ancestors to claim the royalty tokens and any accrued revenue tokens.
Parameters:
ancestorIpId
: The IP ID of the ancestor to whom the royalty tokens belong.Returns the IP ID to which this royalty vault belongs.
Returns:
Returns the amount of unclaimed royalty tokens.
Returns:
Returns the last snapshotted timestamp.
Returns:
Returns the amount of revenue token in the ancestors vault.
Parameters:
token
: The address of the revenue token.Returns:
Indicates whether the ancestor has collected the royalty tokens.
Parameters:
ancestorIpId
: The ancestor IP ID address.Returns:
Returns the amount of revenue token in the claim vault.
Parameters:
token
: The address of the revenue token.Returns:
Returns the amount of revenue token claimable at a given snapshot.
Parameters:
snapshotId
: The snapshot ID.token
: The address of the revenue token.Returns:
Returns the amount of unclaimed revenue tokens at the snapshot.
Parameters:
snapshotId
: The snapshot ID.Returns:
Indicates whether the claimer has claimed the revenue tokens at a given snapshot.
Parameters:
snapshotId
: The snapshot ID.claimer
: The address of the claimer.token
: The address of the revenue token.Returns:
Returns the list of revenue tokens in the vault.
Returns:
The IPRoyaltyVault contract implements several security measures:
Access Control: Functions for adding tokens, taking snapshots, and claiming tokens are protected with appropriate modifiers.
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.
Snapshot Mechanism: The contract uses a snapshot mechanism to ensure fair distribution of revenue tokens based on holdings at specific points in time.
Claim Verification: The contract tracks claimed tokens to prevent double-claiming by the same address.