Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
refactor: rebase renaming to PIL
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubpark committed Feb 17, 2024
1 parent f8572d9 commit 9f7c026
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion contracts/modules/licensing/PILPolicyFrameworkManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/foundry/integration/big-bang/SingleNftCollection.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"]);
Expand Down
8 changes: 4 additions & 4 deletions test/foundry/modules/licensing/LicensingModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

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

Expand Down
52 changes: 26 additions & 26 deletions test/foundry/modules/licensing/UMLPolicyFramework.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -187,59 +187,59 @@ contract PILPolicyFrameworkTest is BaseTest {
vm.expectRevert(
PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers.selector
);
umlFramework.registerPolicy(inputA);
pilFramework.registerPolicy(inputA);

// reset
inputA.policy.commercializerChecker = address(0);
inputA.policy.commercializerCheckerData = "";

// 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,
Expand All @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions test/foundry/utils/LicensingHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9f7c026

Please sign in to comment.