diff --git a/contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol b/contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol similarity index 84% rename from contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol rename to contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol index a4abdc73..96cc4060 100644 --- a/contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol +++ b/contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.23; import { IPolicyFrameworkManager } from "../../../interfaces/modules/licensing/IPolicyFrameworkManager.sol"; -/// @notice Licensing parameters for the Universal Media License v1 (UML) standard +/// @notice Licensing parameters for the Programmable IP License v1 (PIL) standard /// @param transferable Whether or not the license is transferable /// @param attribution Whether or not attribution is required when reproducing the work /// @param commercialUse Whether or not the work can be used commercially @@ -20,7 +20,7 @@ import { IPolicyFrameworkManager } from "../../../interfaces/modules/licensing/I /// @param distributionChannels List of distribution channels where the license is valid. Empty if no restrictions. /// @param royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments /// TODO: DO NOT deploy on production networks without hashing string[] instead of storing them -struct UMLPolicy { +struct PILPolicy { bool attribution; bool commercialUse; bool commercialAttribution; @@ -40,13 +40,13 @@ struct UMLPolicy { /// @param royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments /// @param mintingFee Fee to be paid when minting a license /// @param mintingFeeToken Token to be used to pay the minting fee -/// @param umlPolicy UMLPolicy compliant licensing term values -struct RegisterUMLPolicyParams { +/// @param policy PILPolicy compliant licensing term values +struct RegisterPILPolicyParams { bool transferable; address royaltyPolicy; uint256 mintingFee; address mintingFeeToken; - UMLPolicy policy; + PILPolicy policy; } /// @notice Struct that accumulates values of inherited policies so we can verify compatibility when inheriting @@ -59,7 +59,7 @@ struct RegisterUMLPolicyParams { /// @param territoriesAcc The last hash of the territories array /// @param distributionChannelsAcc The last hash of the distributionChannels array /// @param contentRestrictionsAcc The last hash of the contentRestrictions array -struct UMLAggregator { +struct PILAggregator { bool commercial; bool derivativesReciprocal; uint256 lastPolicyId; @@ -68,23 +68,23 @@ struct UMLAggregator { bytes32 contentRestrictionsAcc; } -/// @title IUMLPolicyFrameworkManager -/// @notice Defines the interface for a Policy Framework Manager compliant with the UML standard -interface IUMLPolicyFrameworkManager is IPolicyFrameworkManager { +/// @title IPILPolicyFrameworkManager +/// @notice Defines the interface for a Policy Framework Manager compliant with the PIL standard +interface IPILPolicyFrameworkManager is IPolicyFrameworkManager { /// @notice Registers a new policy to the registry /// @dev Internally, this function must generate a Licensing.Policy struct and call registerPolicy. - /// @param params parameters needed to register a UMLPolicy + /// @param params parameters needed to register a PILPolicy /// @return policyId The ID of the newly registered policy - function registerPolicy(RegisterUMLPolicyParams calldata params) external returns (uint256 policyId); + function registerPolicy(RegisterPILPolicyParams calldata params) external returns (uint256 policyId); /// @notice Returns the aggregation data for inherited policies of an IP asset. /// @param ipId The ID of the IP asset to get the aggregator for - /// @return rights The UMLAggregator struct - function getAggregator(address ipId) external view returns (UMLAggregator memory rights); + /// @return rights The PILAggregator struct + function getAggregator(address ipId) external view returns (PILAggregator memory rights); - /// @notice gets the UMLPolicy for a given policy ID decoded from Licensing.Policy.frameworkData + /// @notice gets the PILPolicy for a given policy ID decoded from Licensing.Policy.frameworkData /// @dev Do not call this function from a smart contract, it is only for off-chain /// @param policyId The ID of the policy to get - /// @return policy The UMLPolicy struct - function getUMLPolicy(uint256 policyId) external view returns (UMLPolicy memory policy); + /// @return policy The PILPolicy struct + function getPILPolicy(uint256 policyId) external view returns (PILPolicy memory policy); } diff --git a/contracts/lib/PILFrameworkErrors.sol b/contracts/lib/PILFrameworkErrors.sol new file mode 100644 index 00000000..92a6a1eb --- /dev/null +++ b/contracts/lib/PILFrameworkErrors.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: UNLICENSED +// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf +pragma solidity ^0.8.23; + +/// @title PILFrameworkErrors Errors Library +/// @notice Library for all PILFramework related contract errors. +library PILFrameworkErrors { + //////////////////////////////////////////////////////////////////////////// + // PILPolicyFrameworkManager // + //////////////////////////////////////////////////////////////////////////// + + error PILPolicyFrameworkManager__CommecialDisabled_CantAddAttribution(); + error PILPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers(); + error PILPolicyFrameworkManager__CommecialDisabled_CantAddRevShare(); + error PILPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution(); + error PILPolicyFrameworkManager__DerivativesDisabled_CantAddApproval(); + error PILPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal(); + error PILPolicyFrameworkManager__RightsNotFound(); + error PILPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy(); + error PILPolicyFrameworkManager__CommecialEnabled_RoyaltyPolicyRequired(); + error PILPolicyFrameworkManager__ReciprocalButDifferentPolicyIds(); + error PILPolicyFrameworkManager__ReciprocalValueMismatch(); + error PILPolicyFrameworkManager__CommercialValueMismatch(); + error PILPolicyFrameworkManager__StringArrayMismatch(); + error PILPolicyFrameworkManager__CommecialDisabled_CantAddMintingFee(); + error PILPolicyFrameworkManager__CommecialDisabled_CantAddMintingFeeToken(); +} diff --git a/contracts/lib/UMLFrameworkErrors.sol b/contracts/lib/UMLFrameworkErrors.sol deleted file mode 100644 index 2e327e0c..00000000 --- a/contracts/lib/UMLFrameworkErrors.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf -pragma solidity ^0.8.23; - -/// @title UMLFrameworkErrors Errors Library -/// @notice Library for all UMLFramework related contract errors. -library UMLFrameworkErrors { - //////////////////////////////////////////////////////////////////////////// - // UMLPolicyFrameworkManager // - //////////////////////////////////////////////////////////////////////////// - - error UMLPolicyFrameworkManager__CommecialDisabled_CantAddAttribution(); - error UMLPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers(); - error UMLPolicyFrameworkManager__CommecialDisabled_CantAddRevShare(); - error UMLPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution(); - error UMLPolicyFrameworkManager__DerivativesDisabled_CantAddApproval(); - error UMLPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal(); - error UMLPolicyFrameworkManager__RightsNotFound(); - error UMLPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy(); - error UMLPolicyFrameworkManager__CommecialEnabled_RoyaltyPolicyRequired(); - error UMLPolicyFrameworkManager__ReciprocalButDifferentPolicyIds(); - error UMLPolicyFrameworkManager__ReciprocalValueMismatch(); - error UMLPolicyFrameworkManager__CommercialValueMismatch(); - error UMLPolicyFrameworkManager__StringArrayMismatch(); - error UMLPolicyFrameworkManager__CommecialDisabled_CantAddMintingFee(); - error UMLPolicyFrameworkManager__CommecialDisabled_CantAddMintingFeeToken(); -} diff --git a/contracts/modules/licensing/UMLPolicyFrameworkManager.sol b/contracts/modules/licensing/PILPolicyFrameworkManager.sol similarity index 87% rename from contracts/modules/licensing/UMLPolicyFrameworkManager.sol rename to contracts/modules/licensing/PILPolicyFrameworkManager.sol index 70091800..4430df9b 100644 --- a/contracts/modules/licensing/UMLPolicyFrameworkManager.sol +++ b/contracts/modules/licensing/PILPolicyFrameworkManager.sol @@ -13,17 +13,17 @@ import { ILicensingModule } from "../../interfaces/modules/licensing/ILicensingM import { IRoyaltyModule } from "../../interfaces/modules/royalty/IRoyaltyModule.sol"; import { Licensing } from "../../lib/Licensing.sol"; import { Errors } from "../../lib/Errors.sol"; -import { UMLFrameworkErrors } from "../../lib/UMLFrameworkErrors.sol"; +import { PILFrameworkErrors } from "../../lib/PILFrameworkErrors.sol"; // solhint-disable-next-line max-line-length -import { IUMLPolicyFrameworkManager, UMLPolicy, UMLAggregator, RegisterUMLPolicyParams } from "../../interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol"; +import { IPILPolicyFrameworkManager, PILPolicy, PILAggregator, RegisterPILPolicyParams } from "../../interfaces/modules/licensing/IPILPolicyFrameworkManager.sol"; import { BasePolicyFrameworkManager } from "../../modules/licensing/BasePolicyFrameworkManager.sol"; import { LicensorApprovalChecker } from "../../modules/licensing/parameter-helpers/LicensorApprovalChecker.sol"; -/// @title UMLPolicyFrameworkManager -/// @notice UML Policy Framework Manager implements the UML Policy Framework logic for encoding and decoding UML +/// @title PILPolicyFrameworkManager +/// @notice PIL Policy Framework Manager implements the PIL Policy Framework logic for encoding and decoding PIL /// policies into the LicenseRegistry and verifying the licensing parameters for linking, minting, and transferring. -contract UMLPolicyFrameworkManager is - IUMLPolicyFrameworkManager, +contract PILPolicyFrameworkManager is + IPILPolicyFrameworkManager, BasePolicyFrameworkManager, LicensorApprovalChecker, ReentrancyGuard @@ -52,9 +52,9 @@ contract UMLPolicyFrameworkManager is /// @notice Registers a new policy to the registry /// @dev Internally, this function must generate a Licensing.Policy struct and call registerPolicy. - /// @param params parameters needed to register a UMLPolicy + /// @param params parameters needed to register a PILPolicy /// @return policyId The ID of the newly registered policy - function registerPolicy(RegisterUMLPolicyParams calldata params) external nonReentrant returns (uint256 policyId) { + function registerPolicy(RegisterPILPolicyParams calldata params) external nonReentrant returns (uint256 policyId) { /// Minting fee amount & address checked in LicensingModule, no need to check here. /// We don't limit charging for minting to commercial use, you could sell a NC license in theory. _verifyComercialUse(params.policy, params.royaltyPolicy, params.mintingFee, params.mintingFeeToken); @@ -89,7 +89,7 @@ contract UMLPolicyFrameworkManager is address parentIpId, bytes calldata policyData ) external override nonReentrant onlyLicensingModule returns (bool) { - UMLPolicy memory policy = abi.decode(policyData, (UMLPolicy)); + PILPolicy memory policy = abi.decode(policyData, (PILPolicy)); // Trying to burn a license to create a derivative, when the license doesn't allow derivatives. if (!policy.derivativesAllowed) { @@ -129,7 +129,7 @@ contract UMLPolicyFrameworkManager is uint256 mintAmount, bytes memory policyData ) external nonReentrant onlyLicensingModule returns (bool) { - UMLPolicy memory policy = abi.decode(policyData, (UMLPolicy)); + PILPolicy memory policy = abi.decode(policyData, (PILPolicy)); // If the policy defines no reciprocal derivatives are allowed (no derivatives of derivatives), // and we are mintingFromADerivative we don't allow minting if (!policy.derivativesReciprocal && mintingFromADerivative) { @@ -149,22 +149,22 @@ contract UMLPolicyFrameworkManager is /// @notice Returns the aggregation data for inherited policies of an IP asset. /// @param ipId The ID of the IP asset to get the aggregator for - /// @return rights The UMLAggregator struct - function getAggregator(address ipId) external view returns (UMLAggregator memory rights) { + /// @return rights The PILAggregator struct + function getAggregator(address ipId) external view returns (PILAggregator memory rights) { bytes memory policyAggregatorData = LICENSING_MODULE.policyAggregatorData(address(this), ipId); if (policyAggregatorData.length == 0) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__RightsNotFound(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__RightsNotFound(); } - rights = abi.decode(policyAggregatorData, (UMLAggregator)); + rights = abi.decode(policyAggregatorData, (PILAggregator)); } - /// @notice gets the UMLPolicy for a given policy ID decoded from Licensing.Policy.frameworkData + /// @notice gets the PILPolicy for a given policy ID decoded from Licensing.Policy.frameworkData /// @dev Do not call this function from a smart contract, it is only for off-chain /// @param policyId The ID of the policy to get - /// @return policy The UMLPolicy struct - function getUMLPolicy(uint256 policyId) external view returns (UMLPolicy memory policy) { + /// @return policy The PILPolicy struct + function getPILPolicy(uint256 policyId) external view returns (PILPolicy memory policy) { Licensing.Policy memory pol = LICENSING_MODULE.policy(policyId); - return abi.decode(pol.frameworkData, (UMLPolicy)); + return abi.decode(pol.frameworkData, (PILPolicy)); } /// @notice Verify compatibility of one or more policies when inheriting them from one or more parent IPs. @@ -183,11 +183,11 @@ contract UMLPolicyFrameworkManager is uint256 policyId, bytes memory policy ) external view onlyLicensingModule returns (bool changedAgg, bytes memory newAggregator) { - UMLAggregator memory agg; - UMLPolicy memory newPolicy = abi.decode(policy, (UMLPolicy)); + PILAggregator memory agg; + PILPolicy memory newPolicy = abi.decode(policy, (PILPolicy)); if (aggregator.length == 0) { // Initialize the aggregator - agg = UMLAggregator({ + agg = PILAggregator({ commercial: newPolicy.commercialUse, derivativesReciprocal: newPolicy.derivativesReciprocal, lastPolicyId: policyId, @@ -197,21 +197,21 @@ contract UMLPolicyFrameworkManager is }); return (true, abi.encode(agg)); } else { - agg = abi.decode(aggregator, (UMLAggregator)); + agg = abi.decode(aggregator, (PILAggregator)); // Either all are reciprocal or none are if (agg.derivativesReciprocal != newPolicy.derivativesReciprocal) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__ReciprocalValueMismatch(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__ReciprocalValueMismatch(); } else if (agg.derivativesReciprocal && newPolicy.derivativesReciprocal) { // Ids are uniqued because we hash them to compare on creation in LicenseRegistry, // so we can compare the ids safely. if (agg.lastPolicyId != policyId) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__ReciprocalButDifferentPolicyIds(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__ReciprocalButDifferentPolicyIds(); } } else { // Both non reciprocal if (agg.commercial != newPolicy.commercialUse) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialValueMismatch(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommercialValueMismatch(); } bytes32 newHash = _verifHashedParams( @@ -251,7 +251,7 @@ contract UMLPolicyFrameworkManager is /// @param policyData The encoded licensing policy data to be decoded by the PFM /// @return jsonString The OpenSea-compliant metadata URI of the policy function policyToJson(bytes memory policyData) public pure returns (string memory) { - UMLPolicy memory policy = abi.decode(policyData, (UMLPolicy)); + PILPolicy memory policy = abi.decode(policyData, (PILPolicy)); /* solhint-disable */ // Follows the OpenSea standard for JSON metadata. @@ -297,9 +297,9 @@ contract UMLPolicyFrameworkManager is return json; } - /// @dev Encodes the commercial traits of UML policy into a JSON string for OpenSea + /// @dev Encodes the commercial traits of PIL policy into a JSON string for OpenSea /// @param policy The policy to encode - function _policyCommercialTraitsToJson(UMLPolicy memory policy) internal pure returns (string memory) { + function _policyCommercialTraitsToJson(PILPolicy memory policy) internal pure returns (string memory) { /* solhint-disable */ // NOTE: TOTAL_RNFT_SUPPLY = 1000 in trait with max_value. For numbers, don't add any display_type, so that // they will show up in the "Ranking" section of the OpenSea UI. @@ -324,9 +324,9 @@ contract UMLPolicyFrameworkManager is /* solhint-enable */ } - /// @dev Encodes the derivative traits of UML policy into a JSON string for OpenSea + /// @dev Encodes the derivative traits of PIL policy into a JSON string for OpenSea /// @param policy The policy to encode - function _policyDerivativeTraitsToJson(UMLPolicy memory policy) internal pure returns (string memory) { + function _policyDerivativeTraitsToJson(PILPolicy memory policy) internal pure returns (string memory) { /* solhint-disable */ // NOTE: TOTAL_RNFT_SUPPLY = 1000 in trait with max_value. For numbers, don't add any display_type, so that // they will show up in the "Ranking" section of the OpenSea UI. @@ -354,29 +354,29 @@ contract UMLPolicyFrameworkManager is /// @param policy The policy to verify /// @param royaltyPolicy The address of the royalty policy // solhint-disable-next-line code-complexity - function _verifyComercialUse(UMLPolicy calldata policy, address royaltyPolicy, uint256 mintingFee, address mintingFeeToken) internal view { + function _verifyComercialUse(PILPolicy calldata policy, address royaltyPolicy, uint256 mintingFee, address mintingFeeToken) internal view { if (!policy.commercialUse) { if (policy.commercialAttribution) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddAttribution(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddAttribution(); } if (policy.commercializerChecker != address(0)) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers(); } if (policy.commercialRevShare > 0) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddRevShare(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddRevShare(); } if (royaltyPolicy != address(0)) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddRoyaltyPolicy(); } if (mintingFee > 0) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddMintingFee(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddMintingFee(); } if (mintingFeeToken != address(0)) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddMintingFeeToken(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddMintingFeeToken(); } } else { if (royaltyPolicy == address(0)) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialEnabled_RoyaltyPolicyRequired(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__CommecialEnabled_RoyaltyPolicyRequired(); } if (policy.commercializerChecker != address(0)) { if (!policy.commercializerChecker.supportsInterface(type(IHookModule).interfaceId)) { @@ -391,16 +391,16 @@ contract UMLPolicyFrameworkManager is /// @notice Checks the configuration of derivative parameters and throws if the policy is not compliant /// @param policy The policy to verify - function _verifyDerivatives(UMLPolicy calldata policy) internal pure { + function _verifyDerivatives(PILPolicy calldata policy) internal pure { if (!policy.derivativesAllowed) { if (policy.derivativesAttribution) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution(); } if (policy.derivativesApproval) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddApproval(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddApproval(); } if (policy.derivativesReciprocal) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal(); } } } @@ -419,7 +419,7 @@ contract UMLPolicyFrameworkManager is return newHash; } if (oldHash != permissive && newHash != permissive) { - revert UMLFrameworkErrors.UMLPolicyFrameworkManager__StringArrayMismatch(); + revert PILFrameworkErrors.PILPolicyFrameworkManager__StringArrayMismatch(); } if (oldHash != permissive) { return oldHash; diff --git a/contracts/modules/licensing/parameter-helpers/LicensorApprovalChecker.sol b/contracts/modules/licensing/parameter-helpers/LicensorApprovalChecker.sol index 1bdf5dd3..66a995c4 100644 --- a/contracts/modules/licensing/parameter-helpers/LicensorApprovalChecker.sol +++ b/contracts/modules/licensing/parameter-helpers/LicensorApprovalChecker.sol @@ -6,7 +6,7 @@ import { ILicenseRegistry } from "../../../interfaces/registries/ILicenseRegistr /// @title LicensorApprovalChecker /// @notice Manages the approval of derivative IP accounts by the licensor. Used to verify -/// licensing terms like "Derivatives With Approval" in UML. +/// licensing terms like "Derivatives With Approval" in PIL. abstract contract LicensorApprovalChecker is AccessControlled { /// @notice Emits when a derivative IP account is approved by the licensor. /// @param licenseId The ID of the license waiting for approval diff --git a/script/foundry/deployment/Main.s.sol b/script/foundry/deployment/Main.s.sol index c618343e..d19c601c 100644 --- a/script/foundry/deployment/Main.s.sol +++ b/script/foundry/deployment/Main.s.sol @@ -33,7 +33,7 @@ import { RoyaltyPolicyLAP } from "contracts/modules/royalty-module/policies/Roya import { DisputeModule } from "contracts/modules/dispute-module/DisputeModule.sol"; import { ArbitrationPolicySP } from "contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol"; // solhint-disable-next-line max-line-length -import { UMLPolicyFrameworkManager, UMLPolicy, RegisterUMLPolicyParams } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager, PILPolicy, RegisterPILPolicyParams } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; import { MODULE_TYPE_HOOK } from "contracts/lib/modules/Module.sol"; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; import { IHookModule } from "contracts/interfaces/modules/base/IHookModule.sol"; @@ -381,29 +381,29 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { CREATE POLICY FRAMEWORK MANAGERS ///////////////////////////////////////////////////////////////*/ - _predeploy("UMLPolicyFrameworkManager"); - UMLPolicyFrameworkManager umlPfm = new UMLPolicyFrameworkManager( + _predeploy("PILPolicyFrameworkManager"); + PILPolicyFrameworkManager pilPfm = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "uml", - "https://uml-license.com/{id}.json" + "pil", + "https://pil-license.com/{id}.json" ); - _postdeploy("UMLPolicyFrameworkManager", address(umlPfm)); - licensingModule.registerPolicyFrameworkManager(address(umlPfm)); - frameworkAddrs["uml"] = address(umlPfm); + _postdeploy("PILPolicyFrameworkManager", address(pilPfm)); + licensingModule.registerPolicyFrameworkManager(address(pilPfm)); + frameworkAddrs["pil"] = address(pilPfm); /*/////////////////////////////////////////////////////////////// CREATE POLICIES ///////////////////////////////////////////////////////////////*/ - policyIds["uml_com_deriv_expensive"] = umlPfm.registerPolicy( - RegisterUMLPolicyParams({ + policyIds["pil_com_deriv_expensive"] = pilPfm.registerPolicy( + RegisterPILPolicyParams({ transferable: true, royaltyPolicy: address(royaltyPolicyLAP), mintingFee: 0, mintingFeeToken: address(0), - policy: UMLPolicy({ + policy: PILPolicy({ attribution: true, commercialUse: true, commercialAttribution: true, @@ -421,13 +421,13 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { }) ); - policyIds["uml_noncom_deriv_reciprocal"] = umlPfm.registerPolicy( - RegisterUMLPolicyParams({ + policyIds["pil_noncom_deriv_reciprocal"] = pilPfm.registerPolicy( + RegisterPILPolicyParams({ transferable: false, royaltyPolicy: address(0), // no royalty, non-commercial mintingFee: 0, mintingFeeToken: address(0), - policy: UMLPolicy({ + policy: PILPolicy({ attribution: true, commercialUse: false, commercialAttribution: false, @@ -461,10 +461,10 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { ); disputeModule.setArbitrationPolicy(ipAcct[1], address(arbitrationPolicySP)); - // IPAccount2 (tokenId 2) with policy "uml_noncom_deriv_reciprocal" + // IPAccount2 (tokenId 2) with policy "pil_noncom_deriv_reciprocal" vm.label(getIpId(erc721, 2), "IPAccount2"); ipAcct[2] = registrationModule.registerRootIp( - policyIds["uml_noncom_deriv_reciprocal"], + policyIds["pil_noncom_deriv_reciprocal"], address(erc721), 2, "IPAccount2", @@ -504,8 +504,8 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { ADD POLICIES TO IPACCOUNTS ///////////////////////////////////////////////////////////////*/ - // Add "uml_com_deriv_expensive" policy to IPAccount1 - licensingModule.addPolicyToIp(ipAcct[1], policyIds["uml_com_deriv_expensive"]); + // Add "pil_com_deriv_expensive" policy to IPAccount1 + licensingModule.addPolicyToIp(ipAcct[1], policyIds["pil_com_deriv_expensive"]); // ROYALTY_MODULE.setRoyaltyPolicy(ipId, newRoyaltyPolicy, new address[](0), abi.encode(minRoyalty)); @@ -513,12 +513,12 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { MINT LICENSES ON POLICIES ///////////////////////////////////////////////////////////////*/ - // Mint 2 license of policy "uml_com_deriv_expensive" on IPAccount1 + // Mint 2 license of policy "pil_com_deriv_expensive" on IPAccount1 // Register derivative IP for NFT tokenId 3 { uint256[] memory licenseIds = new uint256[](1); licenseIds[0] = licensingModule.mintLicense( - policyIds["uml_com_deriv_expensive"], + policyIds["pil_com_deriv_expensive"], ipAcct[1], 2, deployer, @@ -543,12 +543,12 @@ contract Main is Script, BroadcastManager, JsonDeploymentHandler { LINK IPACCOUNTS TO PARENTS USING LICENSES ///////////////////////////////////////////////////////////////*/ - // Mint 1 license of policy "uml_noncom_deriv_reciprocal" on IPAccount2 + // Mint 1 license of policy "pil_noncom_deriv_reciprocal" on IPAccount2 // Register derivative IP for NFT tokenId 4 { uint256[] memory licenseIds = new uint256[](1); licenseIds[0] = licensingModule.mintLicense( - policyIds["uml_noncom_deriv_reciprocal"], + policyIds["pil_noncom_deriv_reciprocal"], ipAcct[2], 1, deployer, diff --git a/test/foundry/integration/big-bang/SingleNftCollection.t.sol b/test/foundry/integration/big-bang/SingleNftCollection.t.sol index a7c54a65..f5a4ee9e 100644 --- a/test/foundry/integration/big-bang/SingleNftCollection.t.sol +++ b/test/foundry/integration/big-bang/SingleNftCollection.t.sol @@ -8,7 +8,7 @@ import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableS import { IIPAccount } from "../../../../contracts/interfaces/IIPAccount.sol"; import { IP } from "../../../../contracts/lib/IP.sol"; import { Errors } from "../../../../contracts/lib/Errors.sol"; -import { UMLPolicy } from "../../../../contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicy } from "../../../../contracts/modules/licensing/PILPolicyFrameworkManager.sol"; import { IRoyaltyPolicyLAP } from "../../../../contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLAP.sol"; // test @@ -28,15 +28,15 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { function setUp() public override { super.setUp(); - // Add UML PFM policies + // Add PIL PFM policies - _setUMLPolicyFrameworkManager(); + _setPILPolicyFrameworkManager(); - _addUMLPolicy( - "com_deriv_cheap_flexible", // ==> policyIds["uml_com_deriv_cheap_flexible"] + _addPILPolicy( + "com_deriv_cheap_flexible", // ==> policyIds["pil_com_deriv_cheap_flexible"] true, address(royaltyPolicyLAP), - UMLPolicy({ + PILPolicy({ attribution: false, commercialUse: true, commercialAttribution: true, @@ -53,11 +53,11 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { }) ); - _addUMLPolicy( - "noncom_deriv_reciprocal_derivative", // ==> policyIds["uml_noncom_deriv_reciprocal_derivative"] + _addPILPolicy( + "noncom_deriv_reciprocal_derivative", // ==> policyIds["pil_noncom_deriv_reciprocal_derivative"] false, address(0), - UMLPolicy({ + PILPolicy({ attribution: false, commercialUse: false, commercialAttribution: false, @@ -115,23 +115,23 @@ 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["uml_com_deriv_cheap_flexible"]); - licensingModule.addPolicyToIp(ipAcct[300], policyIds["uml_com_deriv_cheap_flexible"]); + licensingModule.addPolicyToIp(ipAcct[3], policyIds["pil_com_deriv_cheap_flexible"]); + licensingModule.addPolicyToIp(ipAcct[300], policyIds["pil_com_deriv_cheap_flexible"]); vm.startPrank(u.bob); // NOTE: the two calls below achieve the same functionality - // licensingModule.addPolicyToIp(ipAcct[3], policyIds["uml_noncom_deriv_reciprocal_derivative"]); + // licensingModule.addPolicyToIp(ipAcct[3], policyIds["pil_noncom_deriv_reciprocal_derivative"]); IIPAccount(payable(ipAcct[3])).execute( address(licensingModule), 0, abi.encodeWithSignature( "addPolicyToIp(address,uint256)", ipAcct[3], - policyIds["uml_noncom_deriv_reciprocal_derivative"] + policyIds["pil_noncom_deriv_reciprocal_derivative"] ) ); */ @@ -147,7 +147,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { mockNFT.mintId(u.carl, 6); uint256[] memory carl_license_from_root_alice = new uint256[](1); carl_license_from_root_alice[0] = licensingModule.mintLicense( - policyIds["uml_com_deriv_cheap_flexible"], + policyIds["pil_com_deriv_cheap_flexible"], ipAcct[1], 1, u.carl, @@ -170,7 +170,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { linkIpToParents(carl_license_from_root_alice, ipAcct[6], u.carl, abi.encode(params)); } - // Carl mints 2 license for policy "uml_noncom_deriv_reciprocal_derivative" on Bob's NFT 3 IPAccount + // Carl mints 2 license for policy "pil_noncom_deriv_reciprocal_derivative" on Bob's NFT 3 IPAccount // Carl creates NFT 7 IPAccount // Carl activates one of the two licenses on his NFT 7 IPAccount, linking as child to Bob's NFT 3 IPAccount { @@ -178,7 +178,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { mockNFT.mintId(u.carl, 7); uint256[] memory carl_license_from_root_bob = new uint256[](1); carl_license_from_root_bob[0] = licensingModule.mintLicense( - policyIds["uml_noncom_deriv_reciprocal_derivative"], + policyIds["pil_noncom_deriv_reciprocal_derivative"], ipAcct[3], 1, u.carl, @@ -200,7 +200,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { linkIpToParents(carl_license_from_root_bob, ipAcct[7], u.carl, abi.encode(params)); } - // Alice mints 2 license for policy "uml_com_deriv_cheap_flexible" on Bob's NFT 3 IPAccount + // Alice mints 2 license for policy "pil_com_deriv_cheap_flexible" on Bob's NFT 3 IPAccount // Alice creates NFT 2 IPAccount // Alice activates one of the two licenses on her NFT 2 IPAccount, linking as child to Bob's NFT 3 IPAccount // Alice creates derivative NFT 3 directly using the other license @@ -211,7 +211,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { uint256[] memory alice_license_from_root_bob = new uint256[](1); alice_license_from_root_bob[0] = licensingModule.mintLicense( - policyIds["uml_com_deriv_cheap_flexible"], + policyIds["pil_com_deriv_cheap_flexible"], ipAcct[3], mintAmount, u.alice, @@ -278,7 +278,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { uint256[] memory carl_licenses = new uint256[](2); // Commercial license carl_licenses[0] = licensingModule.mintLicense( - policyIds["uml_com_deriv_cheap_flexible"], // ipAcct[1] has this policy attached + policyIds["pil_com_deriv_cheap_flexible"], // ipAcct[1] has this policy attached ipAcct[1], 100, // mint 100 licenses u.carl, @@ -287,7 +287,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { // Non-commercial license carl_licenses[1] = licensingModule.mintLicense( - policyIds["uml_noncom_deriv_reciprocal_derivative"], // ipAcct[3] has this policy attached + policyIds["pil_noncom_deriv_reciprocal_derivative"], // ipAcct[3] has this policy attached ipAcct[3], 1, u.carl, @@ -310,7 +310,7 @@ contract BigBang_Integration_SingleNftCollection is BaseIntegration { // Modify license[1] to a Commercial license carl_licenses[1] = licensingModule.mintLicense( - policyIds["uml_com_deriv_cheap_flexible"], // ipAcct[300] has this policy attached + policyIds["pil_com_deriv_cheap_flexible"], // ipAcct[300] has this policy attached ipAcct[300], 1, u.carl, diff --git a/test/foundry/integration/flows/disputes/Disputes.t.sol b/test/foundry/integration/flows/disputes/Disputes.t.sol index f63899b9..a9bbdd98 100644 --- a/test/foundry/integration/flows/disputes/Disputes.t.sol +++ b/test/foundry/integration/flows/disputes/Disputes.t.sol @@ -23,18 +23,18 @@ contract Flows_Integration_Disputes is BaseIntegration { function setUp() public override { super.setUp(); - // Register UML Framework - _deployLFM_UML(); + // Register PIL Framework + _deployLFM_PIL(); // Register a License - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "non-commercial-remix", commercial: false, derivatives: true, reciprocal: true, commercialRevShare: 0 }); - policyId = _registerUMLPolicyFromMapping("non-commercial-remix"); + policyId = _registerPILPolicyFromMapping("non-commercial-remix"); // Register an original work with both policies set mockNFT.mintId(u.alice, 1); @@ -46,7 +46,7 @@ contract Flows_Integration_Disputes is BaseIntegration { ipAcct[3] = registerIpAccount(mockNFT, 3, u.carl); vm.startPrank(u.alice); - licensingModule.addPolicyToIp(ipAcct[1], _getUmlPolicyId("non-commercial-remix")); + licensingModule.addPolicyToIp(ipAcct[1], _getPilPolicyId("non-commercial-remix")); vm.stopPrank(); } diff --git a/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol b/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol index 8d868cb5..dbf4474c 100644 --- a/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol +++ b/test/foundry/modules/dispute/ArbitrationPolicySP.t.sol @@ -8,7 +8,7 @@ import { ERC6551AccountLib } from "erc6551/lib/ERC6551AccountLib.sol"; // contracts import { Errors } from "contracts/lib/Errors.sol"; import { ArbitrationPolicySP } from "contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol"; -import { UMLPolicy } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; @@ -42,12 +42,12 @@ contract TestArbitrationPolicySP is BaseTest { USDC.mint(ipAccount1, 10000 * 10 ** 6); - _setUMLPolicyFrameworkManager(); - _addUMLPolicy( + _setPILPolicyFrameworkManager(); + _addPILPolicy( "cheap_flexible", true, address(royaltyPolicyLAP), - UMLPolicy({ + PILPolicy({ attribution: false, commercialUse: true, commercialAttribution: true, @@ -79,7 +79,7 @@ contract TestArbitrationPolicySP is BaseTest { vm.startPrank(u.admin); ipAssetRegistry.setApprovalForAll(address(registrationModule), true); ipAddr = registrationModule.registerRootIp( - policyIds["uml_cheap_flexible"], + policyIds["pil_cheap_flexible"], address(mockNFT), 0, "IPAccount1", diff --git a/test/foundry/modules/dispute/DisputeModule.t.sol b/test/foundry/modules/dispute/DisputeModule.t.sol index 4c81c2e1..f3db5a0e 100644 --- a/test/foundry/modules/dispute/DisputeModule.t.sol +++ b/test/foundry/modules/dispute/DisputeModule.t.sol @@ -10,7 +10,7 @@ import { Errors } from "contracts/lib/Errors.sol"; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; import { ArbitrationPolicySP } from "contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol"; import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; -import { UMLPolicy } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; @@ -75,12 +75,12 @@ contract DisputeModuleTest is BaseTest { disputeModule.setBaseArbitrationPolicy(address(arbitrationPolicySP2)); vm.stopPrank(); - _setUMLPolicyFrameworkManager(); - _addUMLPolicy( + _setPILPolicyFrameworkManager(); + _addPILPolicy( "cheap_flexible", true, address(royaltyPolicyLAP), - UMLPolicy({ + PILPolicy({ attribution: false, commercialUse: true, commercialAttribution: true, @@ -112,7 +112,7 @@ contract DisputeModuleTest is BaseTest { vm.startPrank(u.alice); ipAssetRegistry.setApprovalForAll(address(registrationModule), true); ipAddr = registrationModule.registerRootIp( - policyIds["uml_cheap_flexible"], + policyIds["pil_cheap_flexible"], address(mockNFT), 0, "IPAccount1", diff --git a/test/foundry/modules/licensing/LicensingModule.t.sol b/test/foundry/modules/licensing/LicensingModule.t.sol index 4d713b38..a2939204 100644 --- a/test/foundry/modules/licensing/LicensingModule.t.sol +++ b/test/foundry/modules/licensing/LicensingModule.t.sol @@ -9,8 +9,8 @@ import { IIPAccount } from "contracts/interfaces/IIPAccount.sol"; import { AccessPermission } from "contracts/lib/AccessPermission.sol"; import { Errors } from "contracts/lib/Errors.sol"; import { Licensing } from "contracts/lib/Licensing.sol"; -import { RegisterUMLPolicyParams } from "contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol"; -import { UMLPolicyFrameworkManager, UMLPolicy } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { RegisterPILPolicyParams } from "contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager, PILPolicy } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test // solhint-disable-next-line max-line-length @@ -26,7 +26,7 @@ contract LicensingModuleTest is BaseTest { MockAccessController internal mockAccessController = new MockAccessController(); MockPolicyFrameworkManager internal mockPFM; - UMLPolicyFrameworkManager internal umlManager; + PILPolicyFrameworkManager internal pilManager; MockERC721 internal nft = new MockERC721("MockERC721"); MockERC721 internal gatedNftFoo = new MockERC721{ salt: bytes32(uint256(1)) }("GatedNftFoo"); @@ -72,11 +72,11 @@ contract LicensingModuleTest is BaseTest { }) ); - umlManager = new UMLPolicyFrameworkManager( + pilManager = new PILPolicyFrameworkManager( address(mockAccessController), address(ipAccountRegistry), address(licensingModule), - "UMLPolicyFrameworkManager", + "PILPolicyFrameworkManager", licenseUrl ); @@ -405,9 +405,9 @@ contract LicensingModuleTest is BaseTest { } function test_LicensingModule_revert_HookVerifyFail() public { - licensingModule.registerPolicyFrameworkManager(address(umlManager)); + licensingModule.registerPolicyFrameworkManager(address(pilManager)); - UMLPolicy memory policyData = UMLPolicy({ + PILPolicy memory policyData = PILPolicy({ attribution: true, commercialUse: true, commercialAttribution: false, @@ -432,8 +432,8 @@ contract LicensingModuleTest is BaseTest { policyData.territories[0] = "territory1"; policyData.distributionChannels[0] = "distributionChannel1"; - uint256 policyId = umlManager.registerPolicy( - RegisterUMLPolicyParams({ + uint256 policyId = pilManager.registerPolicy( + RegisterPILPolicyParams({ transferable: true, royaltyPolicy: address(mockRoyaltyPolicyLAP), mintingFee: 0, diff --git a/test/foundry/modules/licensing/UMLPolicyFramework.derivation.t.sol b/test/foundry/modules/licensing/UMLPolicyFramework.derivation.t.sol index d1a32850..1f9a93da 100644 --- a/test/foundry/modules/licensing/UMLPolicyFramework.derivation.t.sol +++ b/test/foundry/modules/licensing/UMLPolicyFramework.derivation.t.sol @@ -5,25 +5,25 @@ import { IAccessController } from "contracts/interfaces/IAccessController.sol"; import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol"; import { IRoyaltyModule } from "contracts/interfaces/modules/royalty/IRoyaltyModule.sol"; import { Errors } from "contracts/lib/Errors.sol"; -import { UMLPolicyFrameworkManager } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; -contract UMLPolicyFrameworkCompatibilityTest is BaseTest { - UMLPolicyFrameworkManager internal umlFramework; +contract PILPolicyFrameworkCompatibilityTest is BaseTest { + PILPolicyFrameworkManager internal pilFramework; string internal licenseUrl = "https://example.com/license"; address internal ipId1; address internal ipId2; - modifier withUMLPolicySimple( + modifier withPILPolicySimple( string memory name, bool commercial, bool derivatives, bool reciprocal ) { - _mapUMLPolicySimple(name, commercial, derivatives, reciprocal, 100); - _addUMLPolicyFromMapping(name, address(umlFramework)); + _mapPILPolicySimple(name, commercial, derivatives, reciprocal, 100); + _addPILPolicyFromMapping(name, address(pilFramework)); _; } @@ -32,7 +32,7 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest { // Otherwise, minting license will fail because there's no royalty policy set for license policy, // AND bob (the caller) is not the owner of IPAccount 1. vm.startPrank(bob); - uint256 licenseId = licensingModule.mintLicense(_getUmlPolicyId(policyName), ipId1, 1, alice, ""); + uint256 licenseId = licensingModule.mintLicense(_getPilPolicyId(policyName), ipId1, 1, alice, ""); vm.startPrank(alice); uint256[] memory licenseIds = new uint256[](1); @@ -65,15 +65,15 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest { licensingModule = ILicensingModule(getLicensingModule()); royaltyModule = IRoyaltyModule(getRoyaltyModule()); - umlFramework = new UMLPolicyFrameworkManager( + pilFramework = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "UMLPolicyFrameworkManager", + "PILPolicyFrameworkManager", licenseUrl ); - licensingModule.registerPolicyFrameworkManager(address(umlFramework)); + licensingModule.registerPolicyFrameworkManager(address(pilFramework)); mockNFT.mintId(bob, 1); mockNFT.mintId(alice, 2); @@ -90,48 +90,48 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest { ////// SETTING POLICIES IN ORIGINAL WORK (NO PARENTS) ////// ///////////////////////////////////////////////////////////// - function test_UMLPolicyFramework_originalWork_bobAddsDifferentPoliciesAndAliceMints() + function test_PILPolicyFramework_originalWork_bobAddsDifferentPoliciesAndAliceMints() public - withUMLPolicySimple("comm_deriv", true, true, false) - withUMLPolicySimple("comm_non_deriv", true, false, false) + withPILPolicySimple("comm_deriv", true, true, false) + withPILPolicySimple("comm_non_deriv", true, false, false) { // Bob can add different policies on IP1 without compatibility checks. vm.startPrank(bob); - licensingModule.addPolicyToIp(ipId1, _getUmlPolicyId("comm_deriv")); - licensingModule.addPolicyToIp(ipId1, _getUmlPolicyId("comm_non_deriv")); + licensingModule.addPolicyToIp(ipId1, _getPilPolicyId("comm_deriv")); + licensingModule.addPolicyToIp(ipId1, _getPilPolicyId("comm_non_deriv")); vm.stopPrank(); bool isInherited = false; assertEq(licensingModule.totalPoliciesForIp(isInherited, ipId1), 2); assertTrue( - licensingModule.isPolicyIdSetForIp(isInherited, ipId1, _getUmlPolicyId("comm_deriv")), + licensingModule.isPolicyIdSetForIp(isInherited, ipId1, _getPilPolicyId("comm_deriv")), "comm_deriv not set" ); assertTrue( - licensingModule.isPolicyIdSetForIp(isInherited, ipId1, _getUmlPolicyId("comm_non_deriv")), + licensingModule.isPolicyIdSetForIp(isInherited, ipId1, _getPilPolicyId("comm_non_deriv")), "comm_non_deriv not set" ); // Others can mint licenses to make derivatives of IP1 from each different policy, // as long as they pass the verifications - uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 1, dan, ""); + uint256 licenseId1 = licensingModule.mintLicense(_getPilPolicyId("comm_deriv"), ipId1, 1, dan, ""); assertEq(licenseRegistry.balanceOf(dan, licenseId1), 1, "dan doesn't have license1"); - uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, dan, ""); + uint256 licenseId2 = licensingModule.mintLicense(_getPilPolicyId("comm_non_deriv"), ipId1, 1, dan, ""); assertEq(licenseRegistry.balanceOf(dan, licenseId2), 1, "dan doesn't have license2"); } - function test_UMLPolicyFramework_originalWork_bobMintsWithDifferentPolicies() + function test_PILPolicyFramework_originalWork_bobMintsWithDifferentPolicies() public - withUMLPolicySimple("comm_deriv", true, true, false) - withUMLPolicySimple("comm_non_deriv", true, false, false) + withPILPolicySimple("comm_deriv", true, true, false) + withPILPolicySimple("comm_non_deriv", true, false, false) { // Bob can add different policies on IP1 without compatibility checks. vm.startPrank(bob); - uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("comm_deriv"), ipId1, 2, dan, ""); + uint256 licenseId1 = licensingModule.mintLicense(_getPilPolicyId("comm_deriv"), ipId1, 2, dan, ""); assertEq(licenseRegistry.balanceOf(dan, licenseId1), 2, "dan doesn't have license1"); - uint256 licenseId2 = licensingModule.mintLicense(_getUmlPolicyId("comm_non_deriv"), ipId1, 1, dan, ""); + uint256 licenseId2 = licensingModule.mintLicense(_getPilPolicyId("comm_non_deriv"), ipId1, 1, dan, ""); assertEq(licenseRegistry.balanceOf(dan, licenseId2), 1, "dan doesn't have license2"); vm.stopPrank(); } @@ -140,13 +140,13 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest { ////// LICENSES THAT DONT ALLOW DERIVATIVES ////// ///////////////////////////////////////////////////////////////// - function test_UMLPolicyFramework_non_derivative_license() + function test_PILPolicyFramework_non_derivative_license() public - withUMLPolicySimple("non_comm_no_deriv", true, false, false) + withPILPolicySimple("non_comm_no_deriv", true, false, false) { // Bob can add different policies on IP1 without compatibility checks. vm.startPrank(bob); - uint256 licenseId1 = licensingModule.mintLicense(_getUmlPolicyId("non_comm_no_deriv"), ipId1, 2, alice, ""); + uint256 licenseId1 = licensingModule.mintLicense(_getPilPolicyId("non_comm_no_deriv"), ipId1, 2, alice, ""); assertEq(licenseRegistry.balanceOf(alice, licenseId1), 2, "dan doesn't have license1"); vm.stopPrank(); @@ -162,75 +162,75 @@ contract UMLPolicyFrameworkCompatibilityTest is BaseTest { ////// SETTING POLICIES IN DERIVATIVE WORK (WITH PARENTS) ////// ///////////////////////////////////////////////////////////////// - function test_UMLPolicyFramework_derivative_revert_cantMintDerivativeOfDerivative() + function test_PILPolicyFramework_derivative_revert_cantMintDerivativeOfDerivative() public - withUMLPolicySimple("comm_non_recip", true, true, false) + withPILPolicySimple("comm_non_recip", true, true, false) withAliceOwningDerivativeIp2("comm_non_recip") { vm.expectRevert(Errors.LicensingModule__MintLicenseParamFailed.selector); vm.startPrank(dan); - licensingModule.mintLicense(_getUmlPolicyId("comm_non_recip"), ipId2, 1, dan, ""); + licensingModule.mintLicense(_getPilPolicyId("comm_non_recip"), ipId2, 1, dan, ""); vm.expectRevert(Errors.LicensingModule__MintLicenseParamFailed.selector); vm.startPrank(alice); - licensingModule.mintLicense(_getUmlPolicyId("comm_non_recip"), ipId2, 1, alice, ""); + licensingModule.mintLicense(_getPilPolicyId("comm_non_recip"), ipId2, 1, alice, ""); } - function test_UMLPolicyFramework_derivative_revert_AliceCantSetPolicyOnDerivativeOfDerivative() + function test_PILPolicyFramework_derivative_revert_AliceCantSetPolicyOnDerivativeOfDerivative() public - withUMLPolicySimple("comm_non_recip", true, true, false) - withUMLPolicySimple("comm_deriv", true, true, false) + withPILPolicySimple("comm_non_recip", true, true, false) + withPILPolicySimple("comm_deriv", true, true, false) withAliceOwningDerivativeIp2("comm_non_recip") { vm.expectRevert(Errors.LicensingModule__DerivativesCannotAddPolicy.selector); vm.prank(alice); - licensingModule.addPolicyToIp(ipId2, _getUmlPolicyId("comm_deriv")); + licensingModule.addPolicyToIp(ipId2, _getPilPolicyId("comm_deriv")); - _mapUMLPolicySimple("other_policy", true, true, false, 100); - _getMappedUmlPolicy("other_policy").attribution = false; - _addUMLPolicyFromMapping("other_policy", address(umlFramework)); + _mapPILPolicySimple("other_policy", true, true, false, 100); + _getMappedPilPolicy("other_policy").attribution = false; + _addPILPolicyFromMapping("other_policy", address(pilFramework)); vm.expectRevert(Errors.LicensingModule__DerivativesCannotAddPolicy.selector); vm.prank(alice); - licensingModule.addPolicyToIp(ipId2, _getUmlPolicyId("other_policy")); + licensingModule.addPolicyToIp(ipId2, _getPilPolicyId("other_policy")); } ///////////////////////////////////////////////////////////////// ////// RECIPROCAL DERIVATIVES ////// ///////////////////////////////////////////////////////////////// - function test_UMLPolicyFramework_reciprocal_danMintsLicenseFromIp2() + function test_PILPolicyFramework_reciprocal_danMintsLicenseFromIp2() public - withUMLPolicySimple("comm_reciprocal", true, true, true) + withPILPolicySimple("comm_reciprocal", true, true, true) withAliceOwningDerivativeIp2("comm_reciprocal") { vm.prank(dan); - uint256 licenseId = licensingModule.mintLicense(_getUmlPolicyId("comm_reciprocal"), ipId2, 1, dan, ""); + uint256 licenseId = licensingModule.mintLicense(_getPilPolicyId("comm_reciprocal"), ipId2, 1, dan, ""); assertEq(licenseRegistry.balanceOf(dan, licenseId), 1, "dan doesn't have license"); } - function test_UMLPolicyFramework_reciprocal_AliceMintsLicenseForP1inIP2() + function test_PILPolicyFramework_reciprocal_AliceMintsLicenseForP1inIP2() public - withUMLPolicySimple("comm_reciprocal", true, true, true) + withPILPolicySimple("comm_reciprocal", true, true, true) withAliceOwningDerivativeIp2("comm_reciprocal") { vm.prank(alice); - uint256 licenseId = licensingModule.mintLicense(_getUmlPolicyId("comm_reciprocal"), ipId2, 1, alice, ""); + uint256 licenseId = licensingModule.mintLicense(_getPilPolicyId("comm_reciprocal"), ipId2, 1, alice, ""); assertEq(licenseRegistry.balanceOf(alice, licenseId), 1, "Alice doesn't have license"); } - function test_UMLPolicyFramework_reciprocal_revert_AliceTriesToSetPolicyInReciprocalDeriv() + function test_PILPolicyFramework_reciprocal_revert_AliceTriesToSetPolicyInReciprocalDeriv() public - withUMLPolicySimple("comm_reciprocal", true, true, true) - withUMLPolicySimple("other_policy", true, true, false) + withPILPolicySimple("comm_reciprocal", true, true, true) + withPILPolicySimple("other_policy", true, true, false) withAliceOwningDerivativeIp2("comm_reciprocal") { vm.expectRevert(Errors.LicensingModule__DerivativesCannotAddPolicy.selector); vm.prank(alice); - licensingModule.addPolicyToIp(ipId2, _getUmlPolicyId("other_policy")); + licensingModule.addPolicyToIp(ipId2, _getPilPolicyId("other_policy")); vm.expectRevert(Errors.LicensingModule__DerivativesCannotAddPolicy.selector); vm.prank(alice); - licensingModule.addPolicyToIp(ipId2, _getUmlPolicyId("comm_reciprocal")); + licensingModule.addPolicyToIp(ipId2, _getPilPolicyId("comm_reciprocal")); } } diff --git a/test/foundry/modules/licensing/UMLPolicyFramework.multi-parent.sol b/test/foundry/modules/licensing/UMLPolicyFramework.multi-parent.sol index 0f46b988..181e8b4e 100644 --- a/test/foundry/modules/licensing/UMLPolicyFramework.multi-parent.sol +++ b/test/foundry/modules/licensing/UMLPolicyFramework.multi-parent.sol @@ -6,15 +6,15 @@ import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicens import { IRoyaltyModule } from "contracts/interfaces/modules/royalty/IRoyaltyModule.sol"; import { Errors } from "contracts/lib/Errors.sol"; import { Licensing } from "contracts/lib/Licensing.sol"; -import { UMLFrameworkErrors } from "contracts/lib/UMLFrameworkErrors.sol"; +import { PILFrameworkErrors } from "contracts/lib/PILFrameworkErrors.sol"; // solhint-disable-next-line max-line-length -import { RegisterUMLPolicyParams } from "contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol"; -import { UMLPolicyFrameworkManager } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { RegisterPILPolicyParams } from "contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; -contract UMLPolicyFrameworkMultiParentTest is BaseTest { - UMLPolicyFrameworkManager internal umlFramework; +contract PILPolicyFrameworkMultiParentTest is BaseTest { + PILPolicyFrameworkManager internal pilFramework; string internal licenseUrl = "https://example.com/license"; address internal ipId1; address internal ipId2; @@ -25,14 +25,14 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { mapping(address => address) internal ipIdToOwner; - modifier withUMLPolicySimple( + modifier withPILPolicySimple( string memory name, bool commercial, bool derivatives, bool reciprocal ) { - _mapUMLPolicySimple(name, commercial, derivatives, reciprocal, 100); - _addUMLPolicyFromMapping(name, address(umlFramework)); + _mapPILPolicySimple(name, commercial, derivatives, reciprocal, 100); + _addPILPolicyFromMapping(name, address(pilFramework)); _; } @@ -41,7 +41,7 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { address ipId, address owner ) { - uint256 policyId = _getUmlPolicyId(policyName); + uint256 policyId = _getPilPolicyId(policyName); Licensing.Policy memory policy = licensingModule.policy(policyId); @@ -74,15 +74,15 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { licensingModule = ILicensingModule(getLicensingModule()); royaltyModule = IRoyaltyModule(getRoyaltyModule()); - umlFramework = new UMLPolicyFrameworkManager( + pilFramework = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "UMLPolicyFrameworkManager", + "PILPolicyFrameworkManager", licenseUrl ); - licensingModule.registerPolicyFrameworkManager(address(umlFramework)); + licensingModule.registerPolicyFrameworkManager(address(pilFramework)); mockNFT.mintId(bob, 1); mockNFT.mintId(bob, 2); @@ -103,9 +103,9 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { vm.label(ipId4, "IP4"); } - function test_UMLPolicyFramework_multiParent_AliceSets3Parents_SamePolicyReciprocal() + function test_PILPolicyFramework_multiParent_AliceSets3Parents_SamePolicyReciprocal() public - withUMLPolicySimple("reciprocal", true, true, true) + withPILPolicySimple("reciprocal", true, true, true) withLicense("reciprocal", ipId1, alice) withLicense("reciprocal", ipId2, alice) withLicense("reciprocal", ipId3, alice) @@ -120,58 +120,58 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { } assertEq(licensingModule.totalPoliciesForIp(false, ipId4), 0); assertEq(licensingModule.totalPoliciesForIp(true, ipId4), 1); - assertTrue(licensingModule.isPolicyIdSetForIp(true, ipId4, _getUmlPolicyId("reciprocal"))); + assertTrue(licensingModule.isPolicyIdSetForIp(true, ipId4, _getPilPolicyId("reciprocal"))); } - function test_UMLPolicyFramework_multiParent_revert_AliceSets3Parents_OneNonReciprocal() + function test_PILPolicyFramework_multiParent_revert_AliceSets3Parents_OneNonReciprocal() public - withUMLPolicySimple("reciprocal", true, true, true) - withUMLPolicySimple("non_reciprocal", true, true, false) + withPILPolicySimple("reciprocal", true, true, true) + withPILPolicySimple("non_reciprocal", true, true, false) withLicense("reciprocal", ipId1, alice) withLicense("non_reciprocal", ipId2, alice) withLicense("reciprocal", ipId3, alice) { - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__ReciprocalValueMismatch.selector); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__ReciprocalValueMismatch.selector); vm.prank(alice); licensingModule.linkIpToParents(licenses, ipId4, ""); } - function test_UMLPolicyFramework_multiParent_revert_AliceSets3Parents_3ReciprocalButDifferent() + function test_PILPolicyFramework_multiParent_revert_AliceSets3Parents_3ReciprocalButDifferent() public - withUMLPolicySimple("reciprocal", true, true, true) + withPILPolicySimple("reciprocal", true, true, true) withLicense("reciprocal", ipId1, alice) withLicense("reciprocal", ipId2, alice) { // Save a new policy (change some value to change the policyId) - _mapUMLPolicySimple("other", true, true, true, 100); - _getMappedUmlPolicy("other").attribution = !_getMappedUmlPolicy("other").attribution; - _addUMLPolicyFromMapping("other", address(umlFramework)); + _mapPILPolicySimple("other", true, true, true, 100); + _getMappedPilPolicy("other").attribution = !_getMappedPilPolicy("other").attribution; + _addPILPolicyFromMapping("other", address(pilFramework)); vm.prank(ipId3); - licenses.push(licensingModule.mintLicense(_getUmlPolicyId("other"), ipId3, 1, alice, "")); - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__ReciprocalButDifferentPolicyIds.selector); + licenses.push(licensingModule.mintLicense(_getPilPolicyId("other"), ipId3, 1, alice, "")); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__ReciprocalButDifferentPolicyIds.selector); vm.prank(alice); licensingModule.linkIpToParents(licenses, ipId4, ""); } - function test_UMLPolicyFramework_multiParent_NonReciprocalCommercial() public { + function test_PILPolicyFramework_multiParent_NonReciprocalCommercial() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputB.policy.attribution; @@ -181,24 +181,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testSuccessCompat(inputA, inputB, 2); } - function test_UMLPolicyFramework_multiParent_revert_NonReciprocalCommercial() public { + function test_PILPolicyFramework_multiParent_revert_NonReciprocalCommercial() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputB.policy.attribution; @@ -214,24 +214,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testRevertCompat(inputA, inputB, Errors.LicensingModule__IncompatibleLicensorCommercialPolicy.selector); } - function test_UMLPolicyFramework_multiParent_NonReciprocalDerivatives() public { + function test_PILPolicyFramework_multiParent_NonReciprocalDerivatives() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputB.policy.attribution; @@ -242,24 +242,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testSuccessCompat(inputA, inputB, 2); } - function test_UMLPolicyFramework_multiParent_NonReciprocalTerritories() public { + function test_PILPolicyFramework_multiParent_NonReciprocalTerritories() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // Territories (success same) inputA.policy.territories = new string[](1); @@ -270,24 +270,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testSuccessCompat(inputA, inputB, 2); } - function test_UMLPolicyFramework_multiParent_revert_NonReciprocalTerritories() public { + function test_PILPolicyFramework_multiParent_revert_NonReciprocalTerritories() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputB.policy.attribution; @@ -299,27 +299,27 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { inputA.policy.territories[0] = "US"; inputB.policy.territories = new string[](1); inputB.policy.territories[0] = "UK"; - _testRevertCompat(inputA, inputB, UMLFrameworkErrors.UMLPolicyFrameworkManager__StringArrayMismatch.selector); + _testRevertCompat(inputA, inputB, PILFrameworkErrors.PILPolicyFrameworkManager__StringArrayMismatch.selector); } - function test_UMLPolicyFramework_multiParent_NonReciprocalDistributionChannels() public { + function test_PILPolicyFramework_multiParent_NonReciprocalDistributionChannels() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // Territories (success same) inputA.policy.distributionChannels = new string[](1); @@ -330,24 +330,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testSuccessCompat(inputA, inputB, 2); } - function test_UMLPolicyFramework_multiParent_revert_NonReciprocalDistributionChannels() public { + function test_PILPolicyFramework_multiParent_revert_NonReciprocalDistributionChannels() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputB.policy.attribution; @@ -359,27 +359,27 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { inputA.policy.distributionChannels[0] = "web"; inputB.policy.distributionChannels = new string[](1); inputB.policy.distributionChannels[0] = "mobile"; - _testRevertCompat(inputA, inputB, UMLFrameworkErrors.UMLPolicyFrameworkManager__StringArrayMismatch.selector); + _testRevertCompat(inputA, inputB, PILFrameworkErrors.PILPolicyFrameworkManager__StringArrayMismatch.selector); } - function test_UMLPolicyFramework_multiParent_NonReciprocalContentRestrictions() public { + function test_PILPolicyFramework_multiParent_NonReciprocalContentRestrictions() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // Territories (success same) inputA.policy.contentRestrictions = new string[](1); @@ -390,24 +390,24 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { _testSuccessCompat(inputA, inputB, 2); } - function test_UMLPolicyFramework_multiParent_revert_NonReciprocalContentRestrictions() public { + function test_PILPolicyFramework_multiParent_revert_NonReciprocalContentRestrictions() public { // First we create 2 policies. - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); - _mapUMLPolicySimple({ + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); + _mapPILPolicySimple({ name: "pol_b", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputB = _getMappedUmlParams("pol_b"); + RegisterPILPolicyParams memory inputB = _getMappedPilParams("pol_b"); // We set some indifferents inputA.policy.attribution = true; inputB.policy.attribution = !inputA.policy.attribution; @@ -419,25 +419,25 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { inputA.policy.contentRestrictions[0] = "adult"; inputB.policy.contentRestrictions = new string[](1); inputB.policy.contentRestrictions[0] = "child"; - _testRevertCompat(inputA, inputB, UMLFrameworkErrors.UMLPolicyFrameworkManager__StringArrayMismatch.selector); + _testRevertCompat(inputA, inputB, PILFrameworkErrors.PILPolicyFrameworkManager__StringArrayMismatch.selector); } function _test_register_mint_AB( - RegisterUMLPolicyParams memory inputA, - RegisterUMLPolicyParams memory inputB + RegisterPILPolicyParams memory inputA, + RegisterPILPolicyParams memory inputB ) internal returns (uint256 polAId, uint256 polBId) { - polAId = umlFramework.registerPolicy(inputA); + polAId = pilFramework.registerPolicy(inputA); vm.prank(ipId1); licenses.push(licensingModule.mintLicense(polAId, ipId1, 1, alice, "")); - polBId = umlFramework.registerPolicy(inputB); + polBId = pilFramework.registerPolicy(inputB); vm.prank(ipId2); licenses.push(licensingModule.mintLicense(polBId, ipId2, 2, alice, "")); } function _testRevertCompat( - RegisterUMLPolicyParams memory inputA, - RegisterUMLPolicyParams memory inputB, + RegisterPILPolicyParams memory inputA, + RegisterPILPolicyParams memory inputB, bytes4 errorSelector ) internal { _test_register_mint_AB(inputA, inputB); @@ -449,8 +449,8 @@ contract UMLPolicyFrameworkMultiParentTest is BaseTest { } function _testSuccessCompat( - RegisterUMLPolicyParams memory inputA, - RegisterUMLPolicyParams memory inputB, + RegisterPILPolicyParams memory inputA, + RegisterPILPolicyParams memory inputB, uint256 expectedPolicies ) internal { (uint256 polAId, uint256 polBId) = _test_register_mint_AB(inputA, inputB); diff --git a/test/foundry/modules/licensing/UMLPolicyFramework.t.sol b/test/foundry/modules/licensing/UMLPolicyFramework.t.sol index 8f04a9ff..fa370ebb 100644 --- a/test/foundry/modules/licensing/UMLPolicyFramework.t.sol +++ b/test/foundry/modules/licensing/UMLPolicyFramework.t.sol @@ -4,17 +4,17 @@ pragma solidity ^0.8.23; import { IAccessController } from "contracts/interfaces/IAccessController.sol"; import { ILicensingModule } from "contracts/interfaces/modules/licensing/ILicensingModule.sol"; import { Errors } from "contracts/lib/Errors.sol"; -import { UMLFrameworkErrors } from "contracts/lib/UMLFrameworkErrors.sol"; +import { PILFrameworkErrors } from "contracts/lib/PILFrameworkErrors.sol"; // solhint-disable-next-line max-line-length -import { UMLPolicy, RegisterUMLPolicyParams } from "contracts/interfaces/modules/licensing/IUMLPolicyFrameworkManager.sol"; -import { UMLPolicyFrameworkManager } from "contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicy, RegisterPILPolicyParams } from "contracts/interfaces/modules/licensing/IPILPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager } from "contracts/modules/licensing/PILPolicyFrameworkManager.sol"; import { MockERC721 } from "test/foundry/mocks/token/MockERC721.sol"; import { MockTokenGatedHook } from "test/foundry/mocks/MockTokenGatedHook.sol"; import { BaseTest } from "test/foundry/utils/BaseTest.t.sol"; -contract UMLPolicyFrameworkTest is BaseTest { - UMLPolicyFrameworkManager internal umlFramework; +contract PILPolicyFrameworkTest is BaseTest { + PILPolicyFrameworkManager internal pilFramework; string public licenseUrl = "https://example.com/license"; address public ipId1; @@ -50,15 +50,15 @@ contract UMLPolicyFrameworkTest is BaseTest { accessController = IAccessController(getAccessController()); licensingModule = ILicensingModule(getLicensingModule()); - umlFramework = new UMLPolicyFrameworkManager( + pilFramework = new PILPolicyFrameworkManager( address(accessController), address(ipAccountRegistry), address(licensingModule), - "UMLPolicyFrameworkManager", + "PILPolicyFrameworkManager", licenseUrl ); - licensingModule.registerPolicyFrameworkManager(address(umlFramework)); + licensingModule.registerPolicyFrameworkManager(address(pilFramework)); mockNFT.mintId(alice, 1); mockNFT.mintId(alice, 2); @@ -66,24 +66,24 @@ contract UMLPolicyFrameworkTest is BaseTest { ipId2 = ipAccountRegistry.registerIpAccount(block.chainid, address(mockNFT), 2); } - function test_UMLPolicyFrameworkManager__valuesSetCorrectly() public { + function test_PILPolicyFrameworkManager__valuesSetCorrectly() public { string[] memory territories = new string[](2); territories[0] = "test1"; territories[1] = "test2"; string[] memory distributionChannels = new string[](1); distributionChannels[0] = "test3"; - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: false, commercialRevShare: 100 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.territories = territories; inputA.policy.distributionChannels = distributionChannels; - uint256 policyId = umlFramework.registerPolicy(inputA); - UMLPolicy memory policy = umlFramework.getUMLPolicy(policyId); + uint256 policyId = pilFramework.registerPolicy(inputA); + PILPolicy memory policy = pilFramework.getPILPolicy(policyId); assertEq(keccak256(abi.encode(policy)), keccak256(abi.encode(inputA.policy))); } @@ -91,57 +91,57 @@ contract UMLPolicyFrameworkTest is BaseTest { ////// COMMERCIAL USE TERMS ////// ///////////////////////////////////////////////////////////// - function test_UMLPolicyFrameworkManager__commercialUse_disallowed_revert_settingIncompatibleTerms() public { + function test_PILPolicyFrameworkManager__commercialUse_disallowed_revert_settingIncompatibleTerms() public { // If no commercial values 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"); inputA.policy.commercialAttribution = true; // commercialAttribution = true should revert - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddAttribution.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddAttribution.selector); + pilFramework.registerPolicy(inputA); // Non empty commercializers should revert inputA.policy.commercialAttribution = false; inputA.policy.commercializerChecker = address(tokenGatedHook); inputA.policy.commercializerCheckerData = abi.encode(address(gatedNftFoo)); vm.expectRevert( - UMLFrameworkErrors.UMLPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers.selector + PILFrameworkErrors.PILPolicyFrameworkManager__CommercialDisabled_CantAddCommercializers.selector ); - umlFramework.registerPolicy(inputA); + pilFramework.registerPolicy(inputA); // No rev share should be set; revert inputA.policy.commercializerChecker = address(0); inputA.policy.commercializerCheckerData = ""; inputA.policy.commercialRevShare = 1; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__CommecialDisabled_CantAddRevShare.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__CommecialDisabled_CantAddRevShare.selector); + pilFramework.registerPolicy(inputA); } - function test_UMLPolicyFrameworkManager__commercialUse_valuesSetCorrectly() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__commercialUse_valuesSetCorrectly() public { + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: true, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.commercialAttribution = true; inputA.policy.commercializerChecker = address(0); inputA.policy.commercializerCheckerData = ""; - uint256 policyId = umlFramework.registerPolicy(inputA); - UMLPolicy memory policy = umlFramework.getUMLPolicy(policyId); + uint256 policyId = pilFramework.registerPolicy(inputA); + PILPolicy memory policy = pilFramework.getPILPolicy(policyId); assertEq(keccak256(abi.encode(policy)), keccak256(abi.encode(inputA.policy))); } - function test_UMLPolicyFrameworkManager__commercialUse_InvalidCommericalizer() public { + function test_PILPolicyFrameworkManager__commercialUse_InvalidCommericalizer() public { address invalidCommercializerChecker = address(0x123); bytes memory invalideCommercializerCheckerData = abi.encode(address(0x456)); - UMLPolicy memory policyData = UMLPolicy({ + PILPolicy memory policyData = PILPolicy({ attribution: false, commercialUse: true, commercialAttribution: true, @@ -157,7 +157,7 @@ contract UMLPolicyFrameworkTest is BaseTest { contentRestrictions: emptyStringArray }); - RegisterUMLPolicyParams memory input = RegisterUMLPolicyParams({ + RegisterPILPolicyParams memory input = RegisterPILPolicyParams({ transferable: true, royaltyPolicy: address(0xbeef), mintingFee: 0, @@ -171,52 +171,52 @@ contract UMLPolicyFrameworkTest is BaseTest { invalidCommercializerChecker ) ); - umlFramework.registerPolicy(input); + pilFramework.registerPolicy(input); input.policy.commercializerChecker = address(tokenGatedHook); input.policy.commercializerCheckerData = invalideCommercializerCheckerData; vm.expectRevert("MockTokenGatedHook: Invalid token address"); - umlFramework.registerPolicy(input); + pilFramework.registerPolicy(input); } - function test_UMLPolicyFrameworkManager__derivatives_notAllowed_revert_settingIncompatibleTerms() public { + function test_PILPolicyFrameworkManager__derivatives_notAllowed_revert_settingIncompatibleTerms() public { // If no derivative values allowed - _mapUMLPolicySimple({ + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: false, reciprocal: false, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.derivativesAttribution = true; // derivativesAttribution = true should revert - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddAttribution.selector); + pilFramework.registerPolicy(inputA); // Requesting approval for derivatives should revert inputA.policy.derivativesAttribution = false; inputA.policy.derivativesApproval = true; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddApproval.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddApproval.selector); + pilFramework.registerPolicy(inputA); // Setting reciprocal license should revert inputA.policy.derivativesApproval = false; inputA.policy.derivativesReciprocal = true; - vm.expectRevert(UMLFrameworkErrors.UMLPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal.selector); - umlFramework.registerPolicy(inputA); + vm.expectRevert(PILFrameworkErrors.PILPolicyFrameworkManager__DerivativesDisabled_CantAddReciprocal.selector); + pilFramework.registerPolicy(inputA); } - function test_UMLPolicyFrameworkManager__derivatives_valuesSetCorrectly() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__derivatives_valuesSetCorrectly() public { + _mapPILPolicySimple({ name: "pol_a", commercial: true, derivatives: true, reciprocal: true, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.derivativesAttribution = true; - uint256 policyId = umlFramework.registerPolicy(inputA); - UMLPolicy memory policy = umlFramework.getUMLPolicy(policyId); + uint256 policyId = pilFramework.registerPolicy(inputA); + PILPolicy memory policy = pilFramework.getPILPolicy(policyId); assertEq(keccak256(abi.encode(policy)), keccak256(abi.encode(inputA.policy))); } @@ -224,26 +224,26 @@ contract UMLPolicyFrameworkTest is BaseTest { ////// APPROVAL TERMS ////// ///////////////////////////////////////////////////////////// - function test_UMLPolicyFrameworkManager_derivatives_withApproval_revert_linkNotApproved() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager_derivatives_withApproval_revert_linkNotApproved() public { + _mapPILPolicySimple({ name: "pol_a", commercial: false, derivatives: true, reciprocal: true, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.derivativesApproval = true; - uint256 policyId = umlFramework.registerPolicy(inputA); + uint256 policyId = pilFramework.registerPolicy(inputA); vm.prank(alice); licensingModule.addPolicyToIp(ipId1, policyId); uint256 licenseId = licensingModule.mintLicense(policyId, ipId1, 1, alice, ""); - assertFalse(umlFramework.isDerivativeApproved(licenseId, ipId2)); + assertFalse(pilFramework.isDerivativeApproved(licenseId, ipId2)); vm.prank(licenseRegistry.licensorIpId(licenseId)); - umlFramework.setApproval(licenseId, ipId2, false); - assertFalse(umlFramework.isDerivativeApproved(licenseId, ipId2)); + pilFramework.setApproval(licenseId, ipId2, false); + assertFalse(pilFramework.isDerivativeApproved(licenseId, ipId2)); uint256[] memory licenseIds = new uint256[](1); licenseIds[0] = licenseId; @@ -253,27 +253,27 @@ contract UMLPolicyFrameworkTest is BaseTest { licensingModule.linkIpToParents(licenseIds, ipId2, ""); } - function test_UMLPolicyFrameworkManager__derivatives_withApproval_linkApprovedIpId() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__derivatives_withApproval_linkApprovedIpId() public { + _mapPILPolicySimple({ name: "pol_a", commercial: false, derivatives: true, reciprocal: true, commercialRevShare: 0 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.policy.derivativesApproval = true; - uint256 policyId = umlFramework.registerPolicy(inputA); + uint256 policyId = pilFramework.registerPolicy(inputA); vm.prank(alice); licensingModule.addPolicyToIp(ipId1, policyId); uint256 licenseId = licensingModule.mintLicense(policyId, ipId1, 1, alice, ""); - assertFalse(umlFramework.isDerivativeApproved(licenseId, ipId2)); + assertFalse(pilFramework.isDerivativeApproved(licenseId, ipId2)); vm.prank(licenseRegistry.licensorIpId(licenseId)); - umlFramework.setApproval(licenseId, ipId2, true); - assertTrue(umlFramework.isDerivativeApproved(licenseId, ipId2)); + pilFramework.setApproval(licenseId, ipId2, true); + assertTrue(pilFramework.isDerivativeApproved(licenseId, ipId2)); uint256[] memory licenseIds = new uint256[](1); licenseIds[0] = licenseId; @@ -287,17 +287,17 @@ contract UMLPolicyFrameworkTest is BaseTest { ////// TRANSFER TERMS ////// ///////////////////////////////////////////////////////////// - function test_UMLPolicyFrameworkManager__transferrable() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__transferrable() public { + _mapPILPolicySimple({ name: "pol_a", commercial: false, derivatives: true, reciprocal: true, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.transferable = true; - uint256 policyId = umlFramework.registerPolicy(inputA); + uint256 policyId = pilFramework.registerPolicy(inputA); vm.prank(alice); licensingModule.addPolicyToIp(ipId1, policyId); uint256 licenseId = licensingModule.mintLicense(policyId, ipId1, 1, licenseHolder, ""); @@ -309,17 +309,17 @@ contract UMLPolicyFrameworkTest is BaseTest { assertEq(licenseRegistry.balanceOf(licenseHolder2, licenseId), 1); } - function test_UMLPolicyFrameworkManager__nonTransferrable_revertIfTransferExceptFromLicensor() public { - _mapUMLPolicySimple({ + function test_PILPolicyFrameworkManager__nonTransferrable_revertIfTransferExceptFromLicensor() public { + _mapPILPolicySimple({ name: "pol_a", commercial: false, derivatives: true, reciprocal: true, commercialRevShare: 123123 }); - RegisterUMLPolicyParams memory inputA = _getMappedUmlParams("pol_a"); + RegisterPILPolicyParams memory inputA = _getMappedPilParams("pol_a"); inputA.transferable = false; - uint256 policyId = umlFramework.registerPolicy(inputA); + uint256 policyId = pilFramework.registerPolicy(inputA); vm.prank(alice); licensingModule.addPolicyToIp(ipId1, policyId); uint256 licenseId = licensingModule.mintLicense(policyId, ipId1, 1, licenseHolder, ""); diff --git a/test/foundry/utils/LicensingHelper.t.sol b/test/foundry/utils/LicensingHelper.t.sol index 4307c7ec..288da03e 100644 --- a/test/foundry/utils/LicensingHelper.t.sol +++ b/test/foundry/utils/LicensingHelper.t.sol @@ -9,7 +9,7 @@ import { IRoyaltyModule } from "../../../contracts/interfaces/modules/royalty/IR import { IRoyaltyPolicyLAP } from "../../../contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLAP.sol"; import { BasePolicyFrameworkManager } from "../../../contracts/modules/licensing/BasePolicyFrameworkManager.sol"; // solhint-disable-next-line max-line-length -import { UMLPolicyFrameworkManager, UMLPolicy, RegisterUMLPolicyParams } from "../../../contracts/modules/licensing/UMLPolicyFrameworkManager.sol"; +import { PILPolicyFrameworkManager, PILPolicy, RegisterPILPolicyParams } from "../../../contracts/modules/licensing/PILPolicyFrameworkManager.sol"; // test // solhint-disable-next-line max-line-length @@ -30,7 +30,7 @@ contract LicensingHelper { mapping(string policyName => uint256 globalPolicyId) internal policyIds; - mapping(string policyName => RegisterUMLPolicyParams policy) internal policies; + mapping(string policyName => RegisterPILPolicyParams policy) internal policies; mapping(string policyFrameworkManagerName => address policyFrameworkManagerAddr) internal pfm; @@ -54,8 +54,8 @@ contract LicensingHelper { MODIFIERS: LICENSE FRAMEWORK (MANAGERS) //////////////////////////////////////////////////////////////////////////*/ - modifier withLFM_UML() { - _deployLFM_UML(); + modifier withLFM_PIL() { + _deployLFM_PIL(); _; } @@ -63,16 +63,16 @@ contract LicensingHelper { MODIFIERS: POLICY //////////////////////////////////////////////////////////////////////////*/ - // modifier withUMLPolicy_Commercial_Derivative( - // UMLPolicyGenericParams memory gparams, - // UMLPolicyCommercialParams memory cparams, - // UMLPolicyDerivativeParams memory dparams + // modifier withPILPolicy_Commercial_Derivative( + // PILPolicyGenericParams memory gparams, + // PILPolicyCommercialParams memory cparams, + // PILPolicyDerivativeParams memory dparams // ) { - // UMLPolicyFrameworkManager _pfm = UMLPolicyFrameworkManager(pfm["uml"]); + // PILPolicyFrameworkManager _pfm = PILPolicyFrameworkManager(pfm["pil"]); - // string memory pName = string(abi.encodePacked("uml_com_deriv_", gparams.policyName)); + // string memory pName = string(abi.encodePacked("pil_com_deriv_", gparams.policyName)); // policyIds[pName] = _pfm.registerPolicy( - // UMLPolicy({ + // PILPolicy({ // transferable: gparams.transferable, // attribution: gparams.attribution, // commercialUse: true, @@ -94,15 +94,15 @@ contract LicensingHelper { // _; // } - // modifier withUMLPolicy_Commerical_NonDerivative( - // UMLPolicyGenericParams memory gparams, - // UMLPolicyCommercialParams memory cparams + // modifier withPILPolicy_Commerical_NonDerivative( + // PILPolicyGenericParams memory gparams, + // PILPolicyCommercialParams memory cparams // ) { - // UMLPolicyFrameworkManager _pfm = UMLPolicyFrameworkManager(pfm["uml"]); + // PILPolicyFrameworkManager _pfm = PILPolicyFrameworkManager(pfm["pil"]); - // string memory pName = string(abi.encodePacked("uml_com_nonderiv_", gparams.policyName)); + // string memory pName = string(abi.encodePacked("pil_com_nonderiv_", gparams.policyName)); // policyIds[pName] = _pfm.registerPolicy( - // UMLPolicy({ + // PILPolicy({ // transferable: gparams.transferable, // attribution: gparams.attribution, // commercialUse: true, @@ -124,15 +124,15 @@ contract LicensingHelper { // _; // } - // modifier withUMLPolicy_NonCommercial_Derivative( - // UMLPolicyGenericParams memory gparams, - // UMLPolicyDerivativeParams memory dparams + // modifier withPILPolicy_NonCommercial_Derivative( + // PILPolicyGenericParams memory gparams, + // PILPolicyDerivativeParams memory dparams // ) { - // UMLPolicyFrameworkManager _pfm = UMLPolicyFrameworkManager(pfm["uml"]); + // PILPolicyFrameworkManager _pfm = PILPolicyFrameworkManager(pfm["pil"]); - // string memory pName = string(abi.encodePacked("uml_noncom_deriv_", gparams.policyName)); + // string memory pName = string(abi.encodePacked("pil_noncom_deriv_", gparams.policyName)); // policyIds[pName] = _pfm.registerPolicy( - // UMLPolicy({ + // PILPolicy({ // transferable: gparams.transferable, // attribution: gparams.attribution, // commercialUse: false, @@ -154,12 +154,12 @@ contract LicensingHelper { // _; // } - // modifier withUMLPolicy_NonCommercial_NonDerivative(UMLPolicyGenericParams memory gparams) { - // UMLPolicyFrameworkManager _pfm = UMLPolicyFrameworkManager(pfm["uml"]); + // modifier withPILPolicy_NonCommercial_NonDerivative(PILPolicyGenericParams memory gparams) { + // PILPolicyFrameworkManager _pfm = PILPolicyFrameworkManager(pfm["pil"]); - // string memory pName = string(abi.encodePacked("uml_noncom_nonderiv_", gparams.policyName)); + // string memory pName = string(abi.encodePacked("pil_noncom_nonderiv_", gparams.policyName)); // policyIds[pName] = _pfm.registerPolicy( - // UMLPolicy({ + // PILPolicy({ // transferable: gparams.transferable, // attribution: gparams.attribution, // commercialUse: false, @@ -185,50 +185,50 @@ contract LicensingHelper { HELPER FUNCTIONS //////////////////////////////////////////////////////////////////////////*/ - function _setUMLPolicyFrameworkManager() internal { - UMLPolicyFrameworkManager umlPfm = new UMLPolicyFrameworkManager( + function _setPILPolicyFrameworkManager() internal { + PILPolicyFrameworkManager pilPfm = new PILPolicyFrameworkManager( address(ACCESS_CONTROLLER), address(IP_ACCOUNT_REGISTRY), address(LICENSING_MODULE), - "UML_MINT_PAYMENT", + "PIL_MINT_PAYMENT", "license Url" ); - pfm["uml"] = address(umlPfm); - LICENSING_MODULE.registerPolicyFrameworkManager(address(umlPfm)); + pfm["pil"] = address(pilPfm); + LICENSING_MODULE.registerPolicyFrameworkManager(address(pilPfm)); } - function _addUMLPolicy( + function _addPILPolicy( string memory policyName, bool transferable, address royaltyPolicy, - 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: 0, mintingFeeToken: address(0), 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, bool reciprocal, uint32 commercialRevShare ) internal { - string memory pName = string(abi.encodePacked("uml_", name)); - policies[pName] = RegisterUMLPolicyParams({ + string memory pName = string(abi.encodePacked("pil_", name)); + policies[pName] = RegisterPILPolicyParams({ transferable: true, // TODO: use mock or real based on condition royaltyPolicy: commercial ? address(ROYALTY_POLICY_LAP) : address(0), mintingFee: 0, mintingFeeToken: address(0), - policy: UMLPolicy({ + policy: PILPolicy({ attribution: true, commercialUse: commercial, commercialAttribution: false, @@ -246,30 +246,30 @@ contract LicensingHelper { }); } - function _addUMLPolicyFromMapping(string memory name, address umlFramework) internal returns (uint256) { - string memory pName = string(abi.encodePacked("uml_", name)); - policyIds[pName] = UMLPolicyFrameworkManager(umlFramework).registerPolicy(policies[pName]); + function _addPILPolicyFromMapping(string memory name, address pilFramework) internal returns (uint256) { + string memory pName = string(abi.encodePacked("pil_", name)); + policyIds[pName] = PILPolicyFrameworkManager(pilFramework).registerPolicy(policies[pName]); return policyIds[pName]; } - function _registerUMLPolicyFromMapping(string memory name) internal returns (uint256) { - string memory pName = string(abi.encodePacked("uml_", name)); - policyIds[pName] = UMLPolicyFrameworkManager(pfm["uml"]).registerPolicy(policies[pName]); + function _registerPILPolicyFromMapping(string memory name) internal returns (uint256) { + string memory pName = string(abi.encodePacked("pil_", name)); + policyIds[pName] = PILPolicyFrameworkManager(pfm["pil"]).registerPolicy(policies[pName]); return policyIds[pName]; } - function _getMappedUmlPolicy(string memory name) internal view returns (UMLPolicy storage) { - string memory pName = string(abi.encodePacked("uml_", name)); + function _getMappedPilPolicy(string memory name) internal view returns (PILPolicy storage) { + string memory pName = string(abi.encodePacked("pil_", name)); return policies[pName].policy; } - function _getMappedUmlParams(string memory name) internal view returns (RegisterUMLPolicyParams storage) { - string memory pName = string(abi.encodePacked("uml_", name)); + function _getMappedPilParams(string memory name) internal view returns (RegisterPILPolicyParams storage) { + string memory pName = string(abi.encodePacked("pil_", name)); return policies[pName]; } - function _getUmlPolicyId(string memory name) internal view returns (uint256) { - string memory pName = string(abi.encodePacked("uml_", name)); + function _getPilPolicyId(string memory name) internal view returns (uint256) { + string memory pName = string(abi.encodePacked("pil_", name)); return policyIds[pName]; } @@ -290,17 +290,17 @@ contract LicensingHelper { ); } - function _deployLFM_UML() internal { + function _deployLFM_PIL() internal { BasePolicyFrameworkManager _pfm = BasePolicyFrameworkManager( - new UMLPolicyFrameworkManager( + new PILPolicyFrameworkManager( address(ACCESS_CONTROLLER), address(IP_ACCOUNT_REGISTRY), address(LICENSING_MODULE), - "uml", + "pil", "license Url" ) ); LICENSING_MODULE.registerPolicyFrameworkManager(address(_pfm)); - pfm["uml"] = address(_pfm); + pfm["pil"] = address(_pfm); } } \ No newline at end of file