Skip to content

Commit

Permalink
fix(test): Integrate tests with new license system (1/3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubpark committed Apr 8, 2024
1 parent 861e65a commit 4f3b9b9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 70 deletions.
33 changes: 10 additions & 23 deletions test/foundry/modules/dispute/ArbitrationPolicySP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);

Expand All @@ -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);
Expand Down
33 changes: 10 additions & 23 deletions test/foundry/modules/dispute/DisputeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down
35 changes: 11 additions & 24 deletions test/foundry/modules/royalty/RoyaltyModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down

0 comments on commit 4f3b9b9

Please sign in to comment.