From 4f3b9b9fa55b4eae285ef94a09374ff2213921a0 Mon Sep 17 00:00:00 2001 From: Jongwon Park Date: Mon, 8 Apr 2024 06:17:47 -0500 Subject: [PATCH] fix(test): Integrate tests with new license system (1/3) --- .../modules/dispute/ArbitrationPolicySP.t.sol | 33 ++++++----------- .../modules/dispute/DisputeModule.t.sol | 33 ++++++----------- .../modules/royalty/RoyaltyModule.t.sol | 35 ++++++------------- 3 files changed, 31 insertions(+), 70 deletions(-) diff --git a/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol b/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol index bcc2be82c..a4a2a3a7f 100644 --- a/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol +++ b/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol @@ -7,7 +7,6 @@ import { ERC6551AccountLib } from "erc6551/lib/ERC6551AccountLib.sol"; // contracts import { Errors } from "contracts/lib/Errors.sol"; import { ArbitrationPolicySP } from "contracts/modules/dispute/policies/ArbitrationPolicySP.sol"; -import { PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; @@ -26,27 +25,14 @@ contract TestArbitrationPolicySP is BaseTest { USDC.mint(ipAccount1, 10000 * 10 ** 6); - _setPILPolicyFrameworkManager(); - _addPILPolicy( - "cheap_flexible", - true, - address(royaltyPolicyLAP), - PILPolicy({ - attribution: false, - commercialUse: true, - commercialAttribution: true, - commercializerChecker: address(0), - commercializerCheckerData: "", - commercialRevShare: 10, - derivativesAllowed: true, - derivativesAttribution: true, - derivativesApproval: false, - derivativesReciprocal: false, - territories: new string[](0), - distributionChannels: new string[](0), - contentRestrictions: new string[](0) - }) - ); + registerSelectedPILicenseTerms_Commercial({ + selectionName: "cheap_flexible", + transferable: true, + derivatives: true, + reciprocal: false, + commercialRevShare: 10, + mintingFee: 0 + }); mockNFT.mintId(u.admin, 0); @@ -62,7 +48,8 @@ contract TestArbitrationPolicySP is BaseTest { vm.startPrank(u.admin); ipAddr = ipAssetRegistry.register(address(mockNFT), 0); - licensingModule.addPolicyToIp(ipAddr, policyIds["pil_cheap_flexible"]); + + licensingModule.attachLicenseTerms(ipAddr, address(pilTemplate), getSelectedPILicenseTermsId("cheap_flexible")); // set arbitration policy vm.startPrank(ipAddr); diff --git a/test/foundry/modules/dispute/DisputeModule.t.sol b/test/foundry/modules/dispute/DisputeModule.t.sol index 1cd987fce..4768aac9e 100644 --- a/test/foundry/modules/dispute/DisputeModule.t.sol +++ b/test/foundry/modules/dispute/DisputeModule.t.sol @@ -9,7 +9,6 @@ import { Errors } from "contracts/lib/Errors.sol"; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; import { ArbitrationPolicySP } from "contracts/modules/dispute/policies/ArbitrationPolicySP.sol"; import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; -import { PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; import { TestProxyHelper } from "test/foundry/utils/TestProxyHelper.sol"; @@ -58,27 +57,14 @@ contract DisputeModuleTest is BaseTest { disputeModule.setBaseArbitrationPolicy(address(arbitrationPolicySP2)); vm.stopPrank(); - _setPILPolicyFrameworkManager(); - _addPILPolicy( - "cheap_flexible", - true, - address(royaltyPolicyLAP), - PILPolicy({ - attribution: false, - commercialUse: true, - commercialAttribution: true, - commercializerChecker: address(0), - commercializerCheckerData: "", - commercialRevShare: 10, - derivativesAllowed: true, - derivativesAttribution: true, - derivativesApproval: false, - derivativesReciprocal: false, - territories: new string[](0), - distributionChannels: new string[](0), - contentRestrictions: new string[](0) - }) - ); + registerSelectedPILicenseTerms_Commercial({ + selectionName: "cheap_flexible", + transferable: true, + derivatives: true, + reciprocal: false, + commercialRevShare: 10, + mintingFee: 0 + }); mockNFT.mintId(u.alice, 0); @@ -94,7 +80,8 @@ contract DisputeModuleTest is BaseTest { vm.startPrank(u.alice); ipAddr = ipAssetRegistry.register(address(mockNFT), 0); - licensingModule.addPolicyToIp(ipAddr, policyIds["pil_cheap_flexible"]); + + licensingModule.attachLicenseTerms(ipAddr, address(pilTemplate), getSelectedPILicenseTermsId("cheap_flexible")); // set arbitration policy vm.startPrank(ipAddr); diff --git a/test/foundry/modules/royalty/RoyaltyModule.t.sol b/test/foundry/modules/royalty/RoyaltyModule.t.sol index fdf0778ef..85f335191 100644 --- a/test/foundry/modules/royalty/RoyaltyModule.t.sol +++ b/test/foundry/modules/royalty/RoyaltyModule.t.sol @@ -7,11 +7,10 @@ import { ERC6551AccountLib } from "erc6551/lib/ERC6551AccountLib.sol"; import { Errors } from "../../../../contracts/lib/Errors.sol"; import { RoyaltyModule } from "../../../../contracts/modules/royalty/RoyaltyModule.sol"; import { RoyaltyPolicyLAP } from "../../../../contracts/modules/royalty/policies/RoyaltyPolicyLAP.sol"; -import { PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; -import { TestProxyHelper } from "test/foundry/utils/TestProxyHelper.sol"; // tests import { BaseTest } from "../../utils/BaseTest.t.sol"; +import { TestProxyHelper } from "../../utils/TestProxyHelper.sol"; contract TestRoyaltyModule is BaseTest { event RoyaltyPolicyWhitelistUpdated(address royaltyPolicy, bool allowed); @@ -69,27 +68,14 @@ contract TestRoyaltyModule is BaseTest { USDC.mint(ipAccount1, 1000 * 10 ** 6); - _setPILPolicyFrameworkManager(); - _addPILPolicy( - "cheap_flexible", - true, - address(royaltyPolicyLAP), - PILPolicy({ - attribution: false, - commercialUse: true, - commercialAttribution: true, - commercializerChecker: address(0), - commercializerCheckerData: "", - commercialRevShare: 10, - derivativesAllowed: true, - derivativesAttribution: true, - derivativesApproval: false, - derivativesReciprocal: false, - territories: new string[](0), - distributionChannels: new string[](0), - contentRestrictions: new string[](0) - }) - ); + registerSelectedPILicenseTerms_Commercial({ + selectionName: "cheap_flexible", + transferable: true, + derivatives: true, + reciprocal: false, + commercialRevShare: 10, + mintingFee: 0 + }); mockNFT.mintId(u.alice, 0); @@ -105,7 +91,8 @@ contract TestRoyaltyModule is BaseTest { vm.startPrank(u.alice); ipAddr = ipAssetRegistry.register(address(mockNFT), 0); - licensingModule.addPolicyToIp(ipAddr, policyIds["pil_cheap_flexible"]); + + licensingModule.attachLicenseTerms(ipAddr, address(pilTemplate), getSelectedPILicenseTermsId("cheap_flexible")); // set arbitration policy vm.startPrank(ipAddr);