From 9f7c026d400e7297388dc2c92705252870ad1ca8 Mon Sep 17 00:00:00 2001 From: Jongwon Park Date: Sat, 17 Feb 2024 07:15:44 -0600 Subject: [PATCH] refactor: rebase renaming to PIL --- .../licensing/PILPolicyFrameworkManager.sol | 2 +- .../big-bang/SingleNftCollection.t.sol | 8 +-- .../modules/licensing/LicensingModule.t.sol | 8 +-- .../licensing/UMLPolicyFramework.t.sol | 52 +++++++++---------- test/foundry/utils/LicensingHelper.t.sol | 12 ++--- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/contracts/modules/licensing/PILPolicyFrameworkManager.sol b/contracts/modules/licensing/PILPolicyFrameworkManager.sol index 1c83d7dc..0f76c6fe 100644 --- a/contracts/modules/licensing/PILPolicyFrameworkManager.sol +++ b/contracts/modules/licensing/PILPolicyFrameworkManager.sol @@ -354,7 +354,7 @@ contract PILPolicyFrameworkManager is /// @param royaltyPolicy The address of the royalty policy // solhint-disable-next-line code-complexity function _verifyComercialUse( - UMLPolicy calldata policy, + PILPolicy calldata policy, address royaltyPolicy, uint256 mintingFee, address mintingFeeToken diff --git a/test/foundry/integration/big-bang/SingleNftCollection.t.sol b/test/foundry/integration/big-bang/SingleNftCollection.t.sol index 8b11d94d..2cc6ead1 100644 --- a/test/foundry/integration/big-bang/SingleNftCollection.t.sol +++ b/test/foundry/integration/big-bang/SingleNftCollection.t.sol @@ -32,8 +32,8 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { _setPILPolicyFrameworkManager(); - _addUMLPolicyWihtMintPayment( - "com_deriv_cheap_flexible", // ==> policyIds["uml_com_deriv_cheap_flexible"] + _addPILPolicyWihtMintPayment( + "com_deriv_cheap_flexible", // ==> policyIds["pil_com_deriv_cheap_flexible"] true, address(royaltyPolicyLAP), 100 ether, // mint payment (100 * 10^18) @@ -117,8 +117,8 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { ///////////////////////////////////////////////////////////////*/ vm.startPrank(u.alice); - licensingModule.addPolicyToIp(ipAcct[1], policyIds["uml_com_deriv_cheap_flexible"]); - licensingModule.addPolicyToIp(ipAcct[100], policyIds["uml_noncom_deriv_reciprocal_derivative"]); + licensingModule.addPolicyToIp(ipAcct[1], policyIds["pil_com_deriv_cheap_flexible"]); + licensingModule.addPolicyToIp(ipAcct[100], policyIds["pil_noncom_deriv_reciprocal_derivative"]); vm.startPrank(u.bob); licensingModule.addPolicyToIp(ipAcct[3], policyIds["pil_com_deriv_cheap_flexible"]); diff --git a/test/foundry/modules/licensing/LicensingModule.t.sol b/test/foundry/modules/licensing/LicensingModule.t.sol index b23b5cf4..928e795e 100644 --- a/test/foundry/modules/licensing/LicensingModule.t.sol +++ b/test/foundry/modules/licensing/LicensingModule.t.sol @@ -109,11 +109,11 @@ contract LicensingModuleTest is BaseTest { } function test_LicensingModule_registerPFM() public { - PIPPolicyFrameworkManager pfm1 = new PIPPolicyFrameworkManager( + PILPolicyFrameworkManager pfm1 = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "PIPPolicyFrameworkManager", + "PILPolicyFrameworkManager", licenseUrl ); @@ -127,11 +127,11 @@ contract LicensingModuleTest is BaseTest { } function test_LicensingModule_registerPFM_revert_emptyLicenseUrl() public { - PIPPolicyFrameworkManager pfm1 = new PIPPolicyFrameworkManager( + PILPolicyFrameworkManager pfm1 = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "PIPPolicyFrameworkManager", + "PILPolicyFrameworkManager", "" ); diff --git a/test/foundry/modules/licensing/UMLPolicyFramework.t.sol b/test/foundry/modules/licensing/UMLPolicyFramework.t.sol index 20b72487..7c8ece65 100644 --- a/test/foundry/modules/licensing/UMLPolicyFramework.t.sol +++ b/test/foundry/modules/licensing/UMLPolicyFramework.t.sol @@ -87,8 +87,8 @@ contract PILPolicyFrameworkTest is BaseTest { assertEq(keccak256(abi.encode(policy)), keccak256(abi.encode(inputA.policy))); } - function test_UMLPolicyFrameworkManager__verifyLink_false_commercializerCheckerFailedVerify() public { - UMLPolicy memory policyData = UMLPolicy({ + function test_PILPolicyFrameworkManager__verifyLink_false_commercializerCheckerFailedVerify() public { + PILPolicy memory policyData = PILPolicy({ attribution: true, commercialUse: false, commercialAttribution: false, @@ -109,8 +109,8 @@ contract PILPolicyFrameworkTest is BaseTest { assertFalse(verified); } - function test_UMLPolicyFrameworkManager__verifyMint_false_commercializerCheckerFailedVerify() public { - UMLPolicy memory policyData = UMLPolicy({ + function test_PILPolicyFrameworkManager__verifyMint_false_commercializerCheckerFailedVerify() public { + PILPolicy memory policyData = PILPolicy({ attribution: true, commercialUse: false, commercialAttribution: false, @@ -127,7 +127,7 @@ contract PILPolicyFrameworkTest is BaseTest { }); vm.prank(address(licensingModule)); - bool verified = umlFramework.verifyMint(alice, false, ipId1, alice, 2, abi.encode(policyData)); + bool verified = pilFramework.verifyMint(alice, false, ipId1, alice, 2, abi.encode(policyData)); assertFalse(verified); } @@ -162,21 +162,21 @@ contract PILPolicyFrameworkTest is BaseTest { ////// COMMERCIAL USE TERMS ////// ///////////////////////////////////////////////////////////// - function test_UMLPolicyFrameworkManager__commercialUseDisabled_revert_settingIncompatibleTerms() public { + function test_PILPolicyFrameworkManager__commercialUseDisabled_revert_settingIncompatibleTerms() public { // If commercial values are NOT allowed - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: false, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); // CHECK: commercialAttribution = true should revert inputA.policy.commercialAttribution = true; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddAttribution.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddAttribution.selector); + pilFramework.registerPolicy(inputA); // reset inputA.policy.commercialAttribution = false; @@ -187,7 +187,7 @@ contract PILPolicyFrameworkTest is BaseTest { vm.expectRevert( PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers.selector ); - umlFramework.registerPolicy(inputA); + pilFramework.registerPolicy(inputA); // reset inputA.policy.commercializerChecker = address(0); @@ -195,51 +195,51 @@ contract PILPolicyFrameworkTest is BaseTest { // CHECK: No rev share should be set; revert inputA.policy.commercialRevShare = 1; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddRevShare.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddRevShare.selector); + pilFramework.registerPolicy(inputA); // reset inputA.policy.commercialRevShare = 0; // CHECK: royaltyPolicy != address(0) should revert inputA.royaltyPolicy = address(0x123123); - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy.selector); + pilFramework.registerPolicy(inputA); // reset inputA.royaltyPolicy = address(0); // CHECK: mintingFee > 0 should revert inputA.mintingFee = 100; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddMintingFee.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddMintingFee.selector); + pilFramework.registerPolicy(inputA); // reset inputA.mintingFee = 0; } - function test_UMLPolicyFrameworkManager__commercialUseEnabled_revert_settingIncompatibleTerms() public { + function test_PILPolicyFrameworkManager__commercialUseEnabled_revert_settingIncompatibleTerms() public { // If commercial values are NOT allowed - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: true, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); // CHECK: royaltyPolicy == address(0) should revert inputA.royaltyPolicy = address(0); - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialEnabled_RoyaltyPolicyRequired.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommercialEnabled_RoyaltyPolicyRequired.selector); + pilFramework.registerPolicy(inputA); // reset inputA.royaltyPolicy = address(0x123123); } - function test_UMLPolicyFrameworkManager__commercialUseEnabled_valuesSetCorrectly() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__commercialUseEnabled_valuesSetCorrectly() public { + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, @@ -255,11 +255,11 @@ contract PILPolicyFrameworkTest is BaseTest { assertEq(keccak256(abi.encode(policy)), keccak256(abi.encode(inputA.policy))); } - function test_UMLPolicyFrameworkManager__commercialUseEnabled_invalidCommericalizerChecker() public { + function test_PILPolicyFrameworkManager__commercialUseEnabled_invalidCommericalizerChecker() public { address invalidCommercializerChecker = address(new MockERC721("Fake Commercializer Checker")); bytes memory invalideCommercializerCheckerData = abi.encode(address(0x456)); - UMLPolicy memory policyData = UMLPolicy({ + PILPolicy memory policyData = PILPolicy({ attribution: false, commercialUse: true, commercialAttribution: true, diff --git a/test/foundry/utils/LicensingHelper.t.sol b/test/foundry/utils/LicensingHelper.t.sol index 3a3786a9..d8c05ac9 100644 --- a/test/foundry/utils/LicensingHelper.t.sol +++ b/test/foundry/utils/LicensingHelper.t.sol @@ -92,26 +92,26 @@ contract LicensingHelper { policyIds[pName] = PILPolicyFrameworkManager(pfm["pil"]).registerPolicy(policies[pName]); } - function _addUMLPolicyWihtMintPayment( + function _addPILPolicyWihtMintPayment( string memory policyName, bool transferable, address royaltyPolicy, uint256 mintingFee, address mintingFeeToken, - UMLPolicy memory policy + PILPolicy memory policy ) internal { - string memory pName = string(abi.encodePacked("uml_", policyName)); - policies[pName] = RegisterUMLPolicyParams({ + string memory pName = string(abi.encodePacked("pil_", policyName)); + policies[pName] = RegisterPILPolicyParams({ transferable: transferable, royaltyPolicy: royaltyPolicy, mintingFee: mintingFee, mintingFeeToken: mintingFeeToken, policy: policy }); - policyIds[pName] = UMLPolicyFrameworkManager(pfm["uml"]).registerPolicy(policies[pName]); + policyIds[pName] = PILPolicyFrameworkManager(pfm["pil"]).registerPolicy(policies[pName]); } - function _mapUMLPolicySimple( + function _mapPILPolicySimple( string memory name, bool commercial, bool derivatives,