State Variables
ipId
tokens
unclaimedRoyaltyTokens
lastSnapshotTimestamp
ancestorsVaultAmount
isCollectedByAncestor
claimVaultAmount
claimableAtSnapshot
unclaimedAtSnapshot
isClaimedAtSnapshot
Functions
initialize
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.
addIpRoyaltyVaultTokens
token: The token address to add.
isAdded: True if the token was added, false if it was already in the vault.
snapshot
snapshotId: The ID of the snapshot.
claimRevenueToken
snapshotIds: The snapshot IDs to claim from.token: The revenue token to claim.
collectRoyaltyTokens
ancestorIpId: The IP ID of the ancestor to whom the royalty tokens belong.
ipId
- The IP ID address.
unclaimedRoyaltyTokens
- The amount of unclaimed royalty tokens.
lastSnapshotTimestamp
- The last snapshot timestamp.
ancestorsVaultAmount
token: The address of the revenue token.
- The amount of revenue token in the ancestors vault.
isCollectedByAncestor
ancestorIpId: The ancestor IP ID address.
- True if the ancestor has collected the royalty tokens.
claimVaultAmount
token: The address of the revenue token.
- The amount of revenue token in the claim vault.
claimableAtSnapshot
snapshotId: The snapshot ID.token: The address of the revenue token.
- The amount of revenue token claimable at the snapshot.
unclaimedAtSnapshot
snapshotId: The snapshot ID.
- The amount of unclaimed revenue tokens at the snapshot.
isClaimedAtSnapshot
snapshotId: The snapshot ID.claimer: The address of the claimer.token: The address of the revenue token.
- True if the claimer has claimed the revenue tokens at the snapshot.
tokens
- The array of revenue token addresses.
Security Considerations
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
nonReentrantmodifier is used on functions that handle token transfers to prevent reentrancy attacks. -
Pausability: The contract can be paused in emergency situations using the
whenNotPausedmodifier. - 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.

