Skip to content

Commit 0f6c753

Browse files
authored
fix: prevent license terms with derivative approval on group IPs (#413)
1 parent 221b7bb commit 0f6c753

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

contracts/modules/licensing/PILicenseTemplate.sol

+3
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ contract PILicenseTemplate is
338338
/// @return True if the license terms support associate with group IP assets, false otherwise.
339339
function canAttachToGroupIp(uint256 licenseTermsId) external view returns (bool) {
340340
PILTerms memory terms = _getPILicenseTemplateStorage().licenseTerms[licenseTermsId];
341+
if (terms.derivativesApproval) {
342+
return false;
343+
}
341344
address royaltyPolicy = terms.royaltyPolicy;
342345
if (royaltyPolicy == address(0)) {
343346
return true;

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

+35
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,41 @@ contract GroupingModuleTest is BaseTest, ERC721Holder {
823823
vm.stopPrank();
824824
}
825825

826+
function test_GroupingModule_addIp_revert_derivativeApprovalRequired() public {
827+
uint256 termsId = pilTemplate.registerLicenseTerms(
828+
PILTerms({
829+
transferable: true,
830+
royaltyPolicy: address(0),
831+
defaultMintingFee: 0,
832+
expiration: 0,
833+
commercialUse: false,
834+
commercialAttribution: false,
835+
commercializerChecker: address(0),
836+
commercializerCheckerData: "",
837+
commercialRevShare: 0,
838+
commercialRevCeiling: 0,
839+
derivativesAllowed: true,
840+
derivativesAttribution: true,
841+
derivativesApproval: true, // derivative approval required
842+
derivativesReciprocal: true,
843+
derivativeRevCeiling: 0,
844+
currency: address(0),
845+
uri: ""
846+
})
847+
);
848+
vm.startPrank(alice);
849+
address groupId1 = groupingModule.registerGroup(address(rewardPool));
850+
vm.expectRevert(
851+
abi.encodeWithSelector(
852+
Errors.LicenseRegistry__LicenseTermsCannotAttachToGroupIp.selector,
853+
address(pilTemplate),
854+
termsId
855+
)
856+
);
857+
licensingModule.attachLicenseTerms(groupId1, address(pilTemplate), termsId);
858+
vm.stopPrank();
859+
}
860+
826861
function test_GroupingModule_addIp_revert_DisputedIp() public {
827862
bytes32 disputeEvidenceHashExample = 0xb7b94ecbd1f9f8cb209909e5785fb2858c9a8c4b220c017995a75346ad1b5db5;
828863
uint256 termsId = pilTemplate.registerLicenseTerms(

0 commit comments

Comments
 (0)