Skip to content

Commit db8159b

Browse files
authored
fix: disallow private license minting for group IPs (#412)
1 parent 564c130 commit db8159b

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

contracts/registries/LicenseRegistry.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ contract LicenseRegistry is ILicenseRegistry, AccessManagedUpgradeable, UUPSUpgr
339339
if (_isExpiredNow(licensorIpId)) {
340340
revert Errors.LicenseRegistry__ParentIpExpired(licensorIpId);
341341
}
342-
if (isMintedByIpOwner) {
342+
if (isMintedByIpOwner && !GROUP_IP_ASSET_REGISTRY.isRegisteredGroup(licensorIpId)) {
343343
if (!_exists(licenseTemplate, licenseTermsId)) {
344344
revert Errors.LicenseRegistry__LicenseTermsNotExists(licenseTemplate, licenseTermsId);
345345
}

test/foundry/modules/grouping/GroupingModule.t.sol

+55
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,61 @@ contract GroupingModuleTest is BaseTest, ERC721Holder {
13091309
vm.stopPrank();
13101310
}
13111311

1312+
function test_GroupingModule_mintLicenseToken_revert_groupIpHasNoLicenseTerms() public {
1313+
uint256 attachedTermsId = pilTemplate.registerLicenseTerms(
1314+
PILFlavors.commercialRemix({
1315+
mintingFee: 0,
1316+
commercialRevShare: 10,
1317+
currencyToken: address(erc20),
1318+
royaltyPolicy: address(royaltyPolicyLRP)
1319+
})
1320+
);
1321+
1322+
Licensing.LicensingConfig memory licensingConfig = Licensing.LicensingConfig({
1323+
isSet: true,
1324+
mintingFee: 0,
1325+
licensingHook: address(0),
1326+
hookData: "",
1327+
commercialRevShare: 0,
1328+
disabled: false,
1329+
expectMinimumGroupRewardShare: 0,
1330+
expectGroupRewardPool: address(evenSplitGroupPool)
1331+
});
1332+
1333+
vm.startPrank(ipOwner1);
1334+
licensingModule.attachLicenseTerms(ipId1, address(pilTemplate), attachedTermsId);
1335+
licensingModule.setLicensingConfig(ipId1, address(pilTemplate), attachedTermsId, licensingConfig);
1336+
vm.stopPrank();
1337+
1338+
vm.startPrank(alice);
1339+
address groupId = groupingModule.registerGroup(address(rewardPool));
1340+
licensingModule.attachLicenseTerms(groupId, address(pilTemplate), attachedTermsId);
1341+
address[] memory ipIds = new address[](1);
1342+
ipIds[0] = ipId1;
1343+
groupingModule.addIp(groupId, ipIds, 100e6);
1344+
vm.stopPrank();
1345+
1346+
vm.startPrank(alice);
1347+
uint256 notAttachedTermsId = pilTemplate.registerLicenseTerms(
1348+
PILFlavors.commercialRemix({
1349+
mintingFee: 0,
1350+
commercialRevShare: 50,
1351+
currencyToken: address(erc20),
1352+
royaltyPolicy: address(royaltyPolicyLRP)
1353+
})
1354+
);
1355+
vm.expectRevert(
1356+
abi.encodeWithSelector(
1357+
Errors.LicenseRegistry__LicensorIpHasNoLicenseTerms.selector,
1358+
groupId,
1359+
address(pilTemplate),
1360+
notAttachedTermsId
1361+
)
1362+
);
1363+
licensingModule.mintLicenseTokens(groupId, address(pilTemplate), notAttachedTermsId, 1, ipOwner1, "", 0, 0);
1364+
vm.stopPrank();
1365+
}
1366+
13121367
function test_GroupingModule_registerDerivative_revert_registerGroupAsChild() public {
13131368
uint256 termsId = pilTemplate.registerLicenseTerms(
13141369
PILFlavors.commercialRemix({

0 commit comments

Comments
 (0)