Skip to content

Commit 9d5ab4b

Browse files
authored
fix: update periphery to align with PoC core changes (#101)
* chore: update poc core dependency * fix(contracts): resolve issues introduced by updating poc core * fix(scripts & tests): resolve issues introduced by updating poc core
1 parent 5ba250a commit 9d5ab4b

16 files changed

+159
-61
lines changed

contracts/lib/WorkflowStructs.sol

+2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ library WorkflowStructs {
3232
/// @param licenseTemplate The address of the license template to be used for the linking.
3333
/// @param licenseTermsIds The IDs of the license terms to be used for the linking.
3434
/// @param royaltyContext The context for royalty module, should be empty for Royalty Policy LAP.
35+
/// @param maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
3536
struct MakeDerivative {
3637
address[] parentIpIds;
3738
address licenseTemplate;
3839
uint256[] licenseTermsIds;
3940
bytes royaltyContext;
41+
uint256 maxMintingFee;
4042
}
4143
}

contracts/story-nft/BaseStoryNFT.sol

+5-2
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,22 @@ abstract contract BaseStoryNFT is IStoryNFT, ERC721URIStorage, Ownable, Initiali
116116
/// @param licenseTemplate The address of the license template.
117117
/// @param licenseTermsIds The IDs of the license terms.
118118
/// @param royaltyContext The royalty context, should be empty for Royalty Policy LAP.
119+
/// @param maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
119120
function _makeDerivative(
120121
address ipId,
121122
address[] memory parentIpIds,
122123
address licenseTemplate,
123124
uint256[] memory licenseTermsIds,
124-
bytes memory royaltyContext
125+
bytes memory royaltyContext,
126+
uint256 maxMintingFee
125127
) internal virtual {
126128
LICENSING_MODULE.registerDerivative({
127129
childIpId: ipId,
128130
parentIpIds: parentIpIds,
129131
licenseTermsIds: licenseTermsIds,
130132
licenseTemplate: licenseTemplate,
131-
royaltyContext: royaltyContext
133+
royaltyContext: royaltyContext,
134+
maxMintingFee: maxMintingFee
132135
});
133136
}
134137

contracts/story-nft/OrgNFT.sol

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ contract OrgNFT is IOrgNFT, ERC721URIStorageUpgradeable, AccessManagedUpgradeabl
135135
parentIpIds: parentIpIds,
136136
licenseTermsIds: licenseTermsIds,
137137
licenseTemplate: LICENSE_TEMPLATE,
138-
royaltyContext: ""
138+
royaltyContext: "",
139+
maxMintingFee: 0
139140
});
140141

141142
_safeTransfer(address(this), recipient, orgTokenId);

contracts/story-nft/StoryBadgeNFT.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ contract StoryBadgeNFT is IStoryBadgeNFT, BaseStoryNFT, ERC721Holder {
8686
licenseTermsIds[0] = DEFAULT_LICENSE_TERMS_ID;
8787

8888
// Make the badge a derivative of the organization IP
89-
_makeDerivative(ipId, parentIpIds, PIL_TEMPLATE, licenseTermsIds, "");
89+
_makeDerivative(ipId, parentIpIds, PIL_TEMPLATE, licenseTermsIds, "", 0);
9090

9191
// Transfer the badge to the recipient
9292
_safeTransfer(address(this), recipient, tokenId);

contracts/workflows/DerivativeWorkflows.sol

+4-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ contract DerivativeWorkflows is
145145
parentIpIds: derivData.parentIpIds,
146146
licenseTermsIds: derivData.licenseTermsIds,
147147
licenseTemplate: derivData.licenseTemplate,
148-
royaltyContext: derivData.royaltyContext
148+
royaltyContext: derivData.royaltyContext,
149+
maxMintingFee: 0
149150
});
150151

151152
ISPGNFT(spgNftContract).safeTransferFrom(address(this), recipient, tokenId, "");
@@ -198,7 +199,8 @@ contract DerivativeWorkflows is
198199
parentIpIds: derivData.parentIpIds,
199200
licenseTermsIds: derivData.licenseTermsIds,
200201
licenseTemplate: derivData.licenseTemplate,
201-
royaltyContext: derivData.royaltyContext
202+
royaltyContext: derivData.royaltyContext,
203+
maxMintingFee: derivData.maxMintingFee
202204
});
203205
}
204206

script/deployment/Main.s.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ contract Main is DeployHelper {
1717
/// --verify --verifier=$VERIFIER_NAME --verifier-url=$VERIFIER_URL
1818
///
1919
/// For detailed examples, see the documentation in `../../docs/DEPLOY_UPGRADE.md`.
20-
function run() public virtual override {
20+
function run() public virtual {
2121
_run(CREATE3_DEFAULT_SEED);
2222
}
2323

script/deployment/StoryNFT.s.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contract StoryNFT is DeployHelper {
1010
uint256 private constant CREATE3_DEFAULT_SEED = 1234567890;
1111
constructor() DeployHelper(CREATE3_DEPLOYER) {}
1212

13-
function run() public override {
13+
function run() public {
1414
create3SaltSeed = CREATE3_DEFAULT_SEED;
1515
writeDeploys = true;
1616

script/utils/DeployHelper.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ contract DeployHelper is
141141
writeDeploys = writeDeploys_;
142142

143143
// This will run OZ storage layout check for all contracts. Requires --ffi flag.
144-
if (runStorageLayoutCheck) super.run();
144+
if (runStorageLayoutCheck) _validate(); // StorageLayoutChecker.s.sol
145145

146146
if (isTest) {
147147
// local test deployment
@@ -641,7 +641,7 @@ contract DeployHelper is
641641
_getSalt(type(IpRoyaltyVault).name),
642642
abi.encodePacked(
643643
type(IpRoyaltyVault).creationCode,
644-
abi.encode(address(disputeModule), address(royaltyModule))
644+
abi.encode(address(disputeModule), address(royaltyModule), address(ipAssetRegistry), _getDeployedAddress(type(GroupingModule).name))
645645
)
646646
)
647647
);
@@ -832,7 +832,7 @@ contract DeployHelper is
832832
ipRoyaltyVaultBeacon.transferOwnership(address(royaltyPolicyLAP));
833833

834834
// add evenSplitGroupPool to whitelist of group pools
835-
groupingModule.whitelistGroupRewardPool(address(evenSplitGroupPool));
835+
groupingModule.whitelistGroupRewardPool(address(evenSplitGroupPool), true);
836836
}
837837

838838
/// @dev get the salt for the contract deployment with CREATE3

test/hooks/TotalLicenseTokenLimitHook.t.sol

+60-9
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
4848
isSet: true,
4949
mintingFee: 100,
5050
licensingHook: address(totalLimitHook),
51-
hookData: ""
51+
hookData: "",
52+
commercialRevShare: 0
5253
});
5354

5455
vm.startPrank(ipOwner1);
@@ -68,9 +69,33 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
6869
assertEq(totalLimitHook.getTotalLicenseTokenLimit(ipId3, address(pilTemplate), socialRemixTermsId), 0);
6970
vm.stopPrank();
7071

71-
licensingModule.mintLicenseTokens(ipId1, address(pilTemplate), socialRemixTermsId, 10, u.alice, "");
72-
licensingModule.mintLicenseTokens(ipId2, address(pilTemplate), socialRemixTermsId, 20, u.alice, "");
73-
licensingModule.mintLicenseTokens(ipId3, address(pilTemplate), socialRemixTermsId, 10, u.alice, "");
72+
licensingModule.mintLicenseTokens({
73+
licensorIpId: ipId1,
74+
licenseTemplate: address(pilTemplate),
75+
licenseTermsId: socialRemixTermsId,
76+
amount: 10,
77+
receiver: u.alice,
78+
royaltyContext: "",
79+
maxMintingFee: 0
80+
});
81+
licensingModule.mintLicenseTokens({
82+
licensorIpId: ipId2,
83+
licenseTemplate: address(pilTemplate),
84+
licenseTermsId: socialRemixTermsId,
85+
amount: 20,
86+
receiver: u.alice,
87+
royaltyContext: "",
88+
maxMintingFee: 0
89+
});
90+
licensingModule.mintLicenseTokens({
91+
licensorIpId: ipId3,
92+
licenseTemplate: address(pilTemplate),
93+
licenseTermsId: socialRemixTermsId,
94+
amount: 10,
95+
receiver: u.alice,
96+
royaltyContext: "",
97+
maxMintingFee: 0
98+
});
7499

75100
vm.expectRevert(
76101
abi.encodeWithSelector(
@@ -80,7 +105,15 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
80105
10
81106
)
82107
);
83-
licensingModule.mintLicenseTokens(ipId1, address(pilTemplate), socialRemixTermsId, 5, u.alice, "");
108+
licensingModule.mintLicenseTokens({
109+
licensorIpId: ipId1,
110+
licenseTemplate: address(pilTemplate),
111+
licenseTermsId: socialRemixTermsId,
112+
amount: 5,
113+
receiver: u.alice,
114+
royaltyContext: "",
115+
maxMintingFee: 0
116+
});
84117

85118
vm.expectRevert(
86119
abi.encodeWithSelector(
@@ -90,7 +123,15 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
90123
20
91124
)
92125
);
93-
licensingModule.mintLicenseTokens(ipId2, address(pilTemplate), socialRemixTermsId, 5, u.alice, "");
126+
licensingModule.mintLicenseTokens({
127+
licensorIpId: ipId2,
128+
licenseTemplate: address(pilTemplate),
129+
licenseTermsId: socialRemixTermsId,
130+
amount: 5,
131+
receiver: u.alice,
132+
royaltyContext: "",
133+
maxMintingFee: 0
134+
});
94135
}
95136

96137
function test_TotalLicenseTokenLimitHook_revert_nonIpOwner_setLimit() public {
@@ -108,7 +149,8 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
108149
isSet: true,
109150
mintingFee: 100,
110151
licensingHook: address(totalLimitHook),
111-
hookData: ""
152+
hookData: "",
153+
commercialRevShare: 0
112154
});
113155

114156
vm.startPrank(ipOwner1);
@@ -145,15 +187,24 @@ contract TotalLicenseTokenLimitHookTest is BaseTest {
145187
isSet: true,
146188
mintingFee: 100,
147189
licensingHook: address(totalLimitHook),
148-
hookData: ""
190+
hookData: "",
191+
commercialRevShare: 0
149192
});
150193

151194
vm.startPrank(ipOwner1);
152195
licensingModule.setLicensingConfig(ipId1, address(pilTemplate), socialRemixTermsId, licensingConfig);
153196
totalLimitHook.setTotalLicenseTokenLimit(ipId1, address(pilTemplate), socialRemixTermsId, 10);
154197
assertEq(totalLimitHook.getTotalLicenseTokenLimit(ipId1, address(pilTemplate), socialRemixTermsId), 10);
155198

156-
licensingModule.mintLicenseTokens(ipId1, address(pilTemplate), socialRemixTermsId, 10, u.alice, "");
199+
licensingModule.mintLicenseTokens({
200+
licensorIpId: ipId1,
201+
licenseTemplate: address(pilTemplate),
202+
licenseTermsId: socialRemixTermsId,
203+
amount: 10,
204+
receiver: u.alice,
205+
royaltyContext: "",
206+
maxMintingFee: 0
207+
});
157208

158209
vm.expectRevert(
159210
abi.encodeWithSelector(

test/integration/workflows/DerivativeIntegration.t.sol

+10-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ contract DerivativeIntegration is BaseIntegration {
5151
parentIpIds: parentIpIds,
5252
licenseTemplate: parentLicenseTemplate,
5353
licenseTermsIds: parentLicenseTermIds,
54-
royaltyContext: ""
54+
royaltyContext: "",
55+
maxMintingFee: 0
5556
}),
5657
ipMetadata: testIpMetadata,
5758
recipient: testSender
@@ -117,7 +118,8 @@ contract DerivativeIntegration is BaseIntegration {
117118
parentIpIds: parentIpIds,
118119
licenseTemplate: parentLicenseTemplate,
119120
licenseTermsIds: parentLicenseTermIds,
120-
royaltyContext: ""
121+
royaltyContext: "",
122+
maxMintingFee: 0
121123
}),
122124
ipMetadata: testIpMetadata,
123125
sigMetadata: WorkflowStructs.SignatureData({
@@ -163,7 +165,8 @@ contract DerivativeIntegration is BaseIntegration {
163165
licenseTermsId: parentLicenseTermIds[0],
164166
amount: 1,
165167
receiver: testSender,
166-
royaltyContext: ""
168+
royaltyContext: "",
169+
maxMintingFee: 0
167170
});
168171

169172
// Need so that derivative workflows can transfer the license tokens
@@ -222,7 +225,8 @@ contract DerivativeIntegration is BaseIntegration {
222225
licenseTermsId: parentLicenseTermIds[0],
223226
amount: 1,
224227
receiver: testSender,
225-
royaltyContext: ""
228+
royaltyContext: "",
229+
maxMintingFee: 0
226230
});
227231

228232
uint256[] memory licenseTokenIds = new uint256[](1);
@@ -299,7 +303,8 @@ contract DerivativeIntegration is BaseIntegration {
299303
parentIpIds: parentIpIds,
300304
licenseTemplate: parentLicenseTemplate,
301305
licenseTermsIds: parentLicenseTermIds,
302-
royaltyContext: ""
306+
royaltyContext: "",
307+
maxMintingFee: 0
303308
}),
304309
testIpMetadata,
305310
testSender

test/integration/workflows/RoyaltyIntegration.t.sol

+12-6
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ contract RoyaltyIntegration is BaseIntegration {
382382
parentIpIds: parentIpIds,
383383
licenseTemplate: pilTemplateAddr,
384384
licenseTermsIds: licenseTermsIds,
385-
royaltyContext: ""
385+
royaltyContext: "",
386+
maxMintingFee: 0
386387
}),
387388
ipMetadata: emptyIpMetadata,
388389
sigMetadata: emptySigData,
@@ -444,7 +445,8 @@ contract RoyaltyIntegration is BaseIntegration {
444445
parentIpIds: parentIpIds,
445446
licenseTemplate: address(pilTemplate),
446447
licenseTermsIds: licenseTermsIds,
447-
royaltyContext: ""
448+
royaltyContext: "",
449+
maxMintingFee: 0
448450
}),
449451
ipMetadata: emptyIpMetadata,
450452
sigMetadata: emptySigData,
@@ -493,7 +495,8 @@ contract RoyaltyIntegration is BaseIntegration {
493495
parentIpIds: parentIpIds,
494496
licenseTemplate: address(pilTemplate),
495497
licenseTermsIds: licenseTermsIds,
496-
royaltyContext: ""
498+
royaltyContext: "",
499+
maxMintingFee: 0
497500
}),
498501
ipMetadata: emptyIpMetadata,
499502
sigMetadata: emptySigData,
@@ -545,7 +548,8 @@ contract RoyaltyIntegration is BaseIntegration {
545548
parentIpIds: parentIpIds,
546549
licenseTemplate: address(pilTemplate),
547550
licenseTermsIds: licenseTermsIds,
548-
royaltyContext: ""
551+
royaltyContext: "",
552+
maxMintingFee: 0
549553
}),
550554
ipMetadata: emptyIpMetadata,
551555
sigMetadata: emptySigData,
@@ -570,7 +574,8 @@ contract RoyaltyIntegration is BaseIntegration {
570574
licenseTermsId: commRemixTermsIdA,
571575
amount: amountLicenseTokensToMint,
572576
receiver: testSender,
573-
royaltyContext: ""
577+
royaltyContext: "",
578+
maxMintingFee: 0
574579
});
575580

576581
// mint `amountLicenseTokensToMint` childIpC's license tokens
@@ -580,7 +585,8 @@ contract RoyaltyIntegration is BaseIntegration {
580585
licenseTermsId: commRemixTermsIdC,
581586
amount: amountLicenseTokensToMint,
582587
receiver: testSender,
583-
royaltyContext: ""
588+
royaltyContext: "",
589+
maxMintingFee: 0
584590
});
585591
}
586592
}

0 commit comments

Comments
 (0)