Skip to content

Commit 3fc7b22

Browse files
authored
Simplify Royalty Claims in RoyaltyWorkflows and GroupingWorkflows by Removing Snapshots (#118)
* refactor(grouping & royalty): update interfaces * refactor(grouping & royalty): adopt simplified royalty api * refactor(grouping & royalty): update tests * Update yarn.lock * fix lint * fix(royalty): fix comments * docs(royalty): update royalty docs * chore(royalty workflows): update comments
1 parent 41ddd68 commit 3fc7b22

10 files changed

+314
-803
lines changed

contracts/interfaces/workflows/IGroupingWorkflows.sol

-2
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ interface IGroupingWorkflows {
8282
/// @notice Collect royalties for the entire group and distribute the rewards to each member IP's royalty vault
8383
/// @param groupIpId The ID of the group IP.
8484
/// @param currencyTokens The addresses of the currency (revenue) tokens to claim.
85-
/// @param groupSnapshotIds The IDs of the snapshots to collect royalties on.
8685
/// @param memberIpIds The IDs of the member IPs to distribute the rewards to.
8786
/// @return collectedRoyalties The amounts of royalties collected for each currency token.
8887
function collectRoyaltiesAndClaimReward(
8988
address groupIpId,
9089
address[] calldata currencyTokens,
91-
uint256[] calldata groupSnapshotIds,
9290
address[] calldata memberIpIds
9391
) external returns (uint256[] memory collectedRoyalties);
9492
}

contracts/interfaces/workflows/IRoyaltyWorkflows.sol

+35-63
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,45 @@ pragma solidity 0.8.26;
44
/// @title Royalty Workflows Interface
55
/// @notice Interface for IP royalty workflows.
66
interface IRoyaltyWorkflows {
7-
/// @notice Details for claiming royalties from a child IP.
8-
/// @param childIpId The address of the child IP.
9-
/// @param royaltyPolicy The address of the royalty policy.
10-
/// @param currencyToken The address of the currency (revenue) token to claim.
11-
/// @param amount The amount of currency (revenue) token to claim.
12-
struct RoyaltyClaimDetails {
13-
address childIpId;
14-
address royaltyPolicy;
15-
address currencyToken;
16-
uint256 amount;
17-
}
18-
19-
/// @notice Transfers royalties from royalty policy to the ancestor IP's royalty vault, takes a snapshot,
20-
/// and claims revenue on that snapshot for each specified currency token.
21-
/// @param ancestorIpId The address of the ancestor IP.
22-
/// @param claimer The address of the claimer of the revenue tokens (must be a royalty token holder).
23-
/// @param royaltyClaimDetails The details of the royalty claim from child IPs,
24-
/// see {IRoyaltyWorkflows-RoyaltyClaimDetails}.
25-
/// @return snapshotId The ID of the snapshot taken.
26-
/// @return amountsClaimed The amount of revenue claimed for each currency token.
27-
function transferToVaultAndSnapshotAndClaimByTokenBatch(
7+
/// @notice Transfers specified amounts of royalties from various royalty policies to the royalty
8+
/// vault of an ancestor IP, and claims all the revenue for each currency token from the
9+
/// ancestor IP's royalty vault to the claimer.
10+
/// @param ancestorIpId The address of the ancestor IP from which the revenue is being claimed.
11+
/// @param claimer The address of the claimer of the currency (revenue) tokens.
12+
/// @param childIpIds The addresses of the child IPs from which royalties are derived.
13+
/// @param royaltyPolicies The addresses of the royalty policies, where royaltyPolicies[i] governs
14+
/// the royalty flow for childIpIds[i].
15+
/// @param currencyTokens The addresses of the currency tokens in which royalties will be claimed,
16+
/// where currencyTokens[i] is the token used for royalties from childIpIds[i].
17+
/// @param amounts The amounts to transfer and claim, where amounts[i] represents the amount of
18+
/// royalties in currencyTokens[i] to transfer from childIpIds[i]'s royaltyPolicies[i] to the ancestor's
19+
/// royalty vault.
20+
/// @return amountsClaimed The amounts of successfully claimed revenue for each specified currency token.
21+
function transferToVaultAndClaimByTokenBatch(
2822
address ancestorIpId,
2923
address claimer,
30-
RoyaltyClaimDetails[] calldata royaltyClaimDetails
31-
) external returns (uint256 snapshotId, uint256[] memory amountsClaimed);
24+
address[] calldata childIpIds,
25+
address[] calldata royaltyPolicies,
26+
address[] calldata currencyTokens,
27+
uint256[] calldata amounts
28+
) external returns (uint256[] memory amountsClaimed);
3229

33-
/// @notice Transfers royalties to the ancestor IP's royalty vault, takes a snapshot, claims revenue for each
34-
/// specified currency token both on the new snapshot and on each specified unclaimed snapshots.
35-
/// @param ancestorIpId The address of the ancestor IP.
36-
/// @param claimer The address of the claimer of the revenue tokens (must be a royalty token holder).
37-
/// @param unclaimedSnapshotIds The IDs of unclaimed snapshots to include in the claim.
38-
/// @param royaltyClaimDetails The details of the royalty claim from child IPs,
39-
/// see {IRoyaltyWorkflows-RoyaltyClaimDetails}.
40-
/// @return snapshotId The ID of the snapshot taken.
41-
/// @return amountsClaimed The amounts of revenue claimed for each currency token.
42-
function transferToVaultAndSnapshotAndClaimBySnapshotBatch(
30+
/// @notice Transfers all avaiable royalties from various royalty policies to the royalty
31+
/// vault of an ancestor IP, and claims all the revenue for each currency token
32+
/// from the ancestor IP's royalty vault to the claimer.
33+
/// @param ancestorIpId The address of the ancestor IP from which the revenue is being claimed.
34+
/// @param claimer The address of the claimer of the currency (revenue) tokens.
35+
/// @param childIpIds The addresses of the child IPs from which royalties are derived.
36+
/// @param royaltyPolicies The addresses of the royalty policies, where royaltyPolicies[i] governs
37+
/// the royalty flow for childIpIds[i].
38+
/// @param currencyTokens The addresses of the currency tokens in which royalties will be claimed,
39+
/// where currencyTokens[i] is the token used for royalties from childIpIds[i].
40+
/// @return amountsClaimed The amounts of successfully claimed revenue for each specified currency token.
41+
function claimAllRevenue(
4342
address ancestorIpId,
4443
address claimer,
45-
uint256[] calldata unclaimedSnapshotIds,
46-
RoyaltyClaimDetails[] calldata royaltyClaimDetails
47-
) external returns (uint256 snapshotId, uint256[] memory amountsClaimed);
48-
49-
/// @notice Takes a snapshot of the IP's royalty vault and claims revenue on that snapshot for each
50-
/// specified currency token.
51-
/// @param ipId The address of the IP.
52-
/// @param claimer The address of the claimer of the revenue tokens (must be a royalty token holder).
53-
/// @param currencyTokens The addresses of the currency (revenue) tokens to claim.
54-
/// @return snapshotId The ID of the snapshot taken.
55-
/// @return amountsClaimed The amounts of revenue claimed for each currency token.
56-
function snapshotAndClaimByTokenBatch(
57-
address ipId,
58-
address claimer,
59-
address[] calldata currencyTokens
60-
) external returns (uint256 snapshotId, uint256[] memory amountsClaimed);
61-
62-
/// @notice Takes a snapshot of the IP's royalty vault and claims revenue for each specified currency token
63-
/// both on the new snapshot and on each specified unclaimed snapshot.
64-
/// @param ipId The address of the IP.
65-
/// @param claimer The address of the claimer of the revenue tokens (must be a royalty token holder).
66-
/// @param unclaimedSnapshotIds The IDs of unclaimed snapshots to include in the claim.
67-
/// @param currencyTokens The addresses of the currency (revenue) tokens to claim.
68-
/// @return snapshotId The ID of the snapshot taken.
69-
/// @return amountsClaimed The amounts of revenue claimed for each currency token.
70-
function snapshotAndClaimBySnapshotBatch(
71-
address ipId,
72-
address claimer,
73-
uint256[] calldata unclaimedSnapshotIds,
44+
address[] calldata childIpIds,
45+
address[] calldata royaltyPolicies,
7446
address[] calldata currencyTokens
75-
) external returns (uint256 snapshotId, uint256[] memory amountsClaimed);
47+
) external returns (uint256[] memory amountsClaimed);
7648
}

contracts/workflows/GroupingWorkflows.sol

+2-3
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,18 @@ contract GroupingWorkflows is
288288
/// @notice Collect royalties for the entire group and distribute the rewards to each member IP's royalty vault
289289
/// @param groupIpId The ID of the group IP.
290290
/// @param currencyTokens The addresses of the currency (revenue) tokens to claim.
291-
/// @param groupSnapshotIds The IDs of the snapshots to collect royalties on.
292291
/// @param memberIpIds The IDs of the member IPs to distribute the rewards to.
293292
/// @return collectedRoyalties The amounts of royalties collected for each currency token.
294293
function collectRoyaltiesAndClaimReward(
295294
address groupIpId,
296295
address[] calldata currencyTokens,
297-
uint256[] calldata groupSnapshotIds,
298296
address[] calldata memberIpIds
299297
) external returns (uint256[] memory collectedRoyalties) {
300298
(address groupLicenseTemplate, uint256 groupLicenseTermsId) = LICENSE_REGISTRY.getAttachedLicenseTerms(
301299
groupIpId,
302300
0
303301
);
302+
304303
for (uint256 i = 0; i < memberIpIds.length; i++) {
305304
// check if given member IPs already have a royalty vault
306305
if (ROYALTY_MODULE.ipRoyaltyVaults(memberIpIds[i]) == address(0)) {
@@ -320,7 +319,7 @@ contract GroupingWorkflows is
320319
collectedRoyalties = new uint256[](currencyTokens.length);
321320
for (uint256 i = 0; i < currencyTokens.length; i++) {
322321
if (currencyTokens[i] == address(0)) revert Errors.GroupingWorkflows__ZeroAddressParam();
323-
collectedRoyalties[i] = GROUPING_MODULE.collectRoyalties(groupIpId, currencyTokens[i], groupSnapshotIds);
322+
collectedRoyalties[i] = GROUPING_MODULE.collectRoyalties(groupIpId, currencyTokens[i]);
324323
GROUPING_MODULE.claimReward(groupIpId, currencyTokens[i], memberIpIds);
325324
}
326325
}

0 commit comments

Comments
 (0)