diff --git a/contracts/interfaces/registries/ILicenseRegistryV2.sol b/contracts/interfaces/registries/ILicenseRegistryV2.sol index 395b88ef5..5a06f28f4 100644 --- a/contracts/interfaces/registries/ILicenseRegistryV2.sol +++ b/contracts/interfaces/registries/ILicenseRegistryV2.sol @@ -18,16 +18,16 @@ interface ILicenseRegistryV2 { /// @notice Emitted when a new currency token is registered. event CurrencyTokenRegistered(address indexed token); - /// @notice Emitted when a minting license specification is set. - event MintingLicenseSpecSet( + /// @notice Emitted when a minting license configuration is set. + event MintingLicenseConfigSet( address indexed ipId, address indexed licenseTemplate, uint256 indexed licenseTermsId, - Licensing.MintingLicenseSpec mintingLicenseSpec + Licensing.MintingLicenseConfig mintingLicenseConfig ); - /// @notice Emitted when a minting license specification is set for all licenses of an IP. - event MintingLicenseSpecSetForAll(address indexed ipId, Licensing.MintingLicenseSpec mintingLicenseSpec); + /// @notice Emitted when a minting license configuration is set for all licenses of an IP. + event MintingLicenseConfigSetForAll(address indexed ipId, Licensing.MintingLicenseConfig mintingLicenseConfig); /// @notice Emitted when an expiration time is set for an IP. event ExpireTimeSet(address indexed ipId, uint256 expireTime); @@ -85,7 +85,7 @@ interface ILicenseRegistryV2 { address licenseTemplate, uint256 licenseTermsId, bool isMintedByIpOwner - ) external view returns (Licensing.MintingLicenseSpec memory); + ) external view returns (Licensing.MintingLicenseConfig memory); /// @notice Attaches license terms to an IP. /// @param ipId The address of the IP to which the license terms are attached. @@ -112,25 +112,25 @@ interface ILicenseRegistryV2 { /// @notice Gets the count of attached license terms of an IP. function getAttachedLicenseTermsCount(address ipId) external view returns (uint256); - /// @notice Retrieves the minting license specification for a given IP, license template, and license terms ID. - function getMintingLicenseSpec( + /// @notice Retrieves the minting license configuration for a given IP, license template, and license terms ID. + function getMintingLicenseConfig( address ipId, address licenseTemplate, uint256 licenseTermsId - ) external view returns (Licensing.MintingLicenseSpec memory); + ) external view returns (Licensing.MintingLicenseConfig memory); - /// @notice Sets the minting license specification for a given IP, license template, and license terms ID. - function setMintingLicenseSpec( + /// @notice Sets the minting license configuration for a given IP, license template, and license terms ID. + function setMintingLicenseConfig( address ipId, address licenseTemplate, uint256 licenseTermsId, - Licensing.MintingLicenseSpec calldata mintingLicenseSpec + Licensing.MintingLicenseConfig calldata mintingLicenseConfig ) external; - /// @notice Sets the minting license specification for all licenser terms of given IP. - function setMintingLicenseSpecForAll( + /// @notice Sets the minting license configuration for all licenser terms of given IP. + function setMintingLicenseConfigForAll( address ipId, - Licensing.MintingLicenseSpec calldata mintingLicenseSpec + Licensing.MintingLicenseConfig calldata mintingLicenseConfig ) external; /// @notice Sets the expiration time for an IP. diff --git a/contracts/lib/Licensing.sol b/contracts/lib/Licensing.sol index c86cbba06..ca4c8a05a 100644 --- a/contracts/lib/Licensing.sol +++ b/contracts/lib/Licensing.sol @@ -13,6 +13,7 @@ library Licensing { /// @param royaltyData Data to be used by the royalty policy (for example, encoding of the royalty percentage) /// @param mintingFee Fee to be paid when minting a license /// @param mintingFeeToken Token to be used to pay the minting fee + // TODO: the struct will not be used in mainnet. will remove. struct Policy { bool isLicenseTransferable; address policyFramework; @@ -28,6 +29,7 @@ library Licensing { /// license is burnt for linking /// @param licensorIpId Id of the IP this license is for /// @param transferable Whether or not the license is transferable + // TODO: the struct will not be used in mainnet. will remove. struct License { uint256 policyId; address licensorIpId; @@ -35,7 +37,7 @@ library Licensing { // TODO: support for transfer hooks } - struct MintingLicenseSpec { + struct MintingLicenseConfig { bool isSet; uint256 mintingFee; address mintingFeeModule; diff --git a/contracts/modules/licensing/LicensingModuleV2.sol b/contracts/modules/licensing/LicensingModuleV2.sol index 30aa8fef6..76de8bd58 100644 --- a/contracts/modules/licensing/LicensingModuleV2.sol +++ b/contracts/modules/licensing/LicensingModuleV2.sol @@ -127,7 +127,7 @@ contract LicensingModuleV2 is _verifyIpNotDisputed(originalIpId); - Licensing.MintingLicenseSpec memory mlc = LICENSE_REGISTRY.verifyMintLicenseToken( + Licensing.MintingLicenseConfig memory mlc = LICENSE_REGISTRY.verifyMintLicenseToken( originalIpId, licenseTemplate, licenseTermsId, @@ -276,7 +276,7 @@ contract LicensingModuleV2 is for (uint256 i = 0; i < originalIpIds.length; i++) { uint256 lcId = licenseTermsIds[i]; - Licensing.MintingLicenseSpec memory mlc = LICENSE_REGISTRY.getMintingLicenseSpec( + Licensing.MintingLicenseConfig memory mlc = LICENSE_REGISTRY.getMintingLicenseConfig( originalIpIds[i], licenseTemplate, lcId @@ -310,7 +310,7 @@ contract LicensingModuleV2 is uint256 licenseTermsId, uint256 amount, bytes calldata royaltyContext, - Licensing.MintingLicenseSpec memory mlc + Licensing.MintingLicenseConfig memory mlc ) private returns (address royaltyPolicy, bytes memory royaltyData) { ILicenseTemplate lct = ILicenseTemplate(licenseTemplate); uint256 mintingFee = 0; @@ -328,17 +328,17 @@ contract LicensingModuleV2 is } function _getTotalMintingFee( - Licensing.MintingLicenseSpec memory mintingLicenseSpec, + Licensing.MintingLicenseConfig memory mintingLicenseConfig, address licensorIpId, address licenseTemplate, uint256 licenseTermsId, uint256 mintingFeeSetByLicenseTerms, uint256 amount ) private view returns (uint256) { - if (!mintingLicenseSpec.isSet) return mintingFeeSetByLicenseTerms * amount; - if (mintingLicenseSpec.mintingFeeModule == address(0)) return mintingLicenseSpec.mintingFee * amount; + if (!mintingLicenseConfig.isSet) return mintingFeeSetByLicenseTerms * amount; + if (mintingLicenseConfig.mintingFeeModule == address(0)) return mintingLicenseConfig.mintingFee * amount; return - IMintingFeeModule(mintingLicenseSpec.mintingFeeModule).getTotalMintingFee( + IMintingFeeModule(mintingLicenseConfig.mintingFeeModule).getTotalMintingFee( licensorIpId, licenseTemplate, licenseTermsId, diff --git a/contracts/registries/LicenseRegistryV2.sol b/contracts/registries/LicenseRegistryV2.sol index 55016be04..4d9ff9001 100644 --- a/contracts/registries/LicenseRegistryV2.sol +++ b/contracts/registries/LicenseRegistryV2.sol @@ -40,8 +40,8 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg mapping(address ipId => EnumerableSet.UintSet licenseTermsIds) attachedLicenseTerms; mapping(address ipId => address licenseTemplate) licenseTemplates; mapping(address ipId => uint256) expireTimes; - mapping(bytes32 ipLicenseHash => Licensing.MintingLicenseSpec mintingLicenseSpec) mintingLicenseSpecs; - mapping(address ipId => Licensing.MintingLicenseSpec mintingLicenseSpec) mintingLicenseSpecsForAll; + mapping(bytes32 ipLicenseHash => Licensing.MintingLicenseConfig mintingLicenseConfig) mintingLicenseConfigs; + mapping(address ipId => Licensing.MintingLicenseConfig mintingLicenseConfig) mintingLicenseConfigsForAll; } // TODO: update the storage location @@ -118,40 +118,40 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg _setExpireTime(ipId, expireTime); } - function setMintingLicenseSpec( + function setMintingLicenseConfig( address ipId, address licenseTemplate, uint256 licenseTermsId, - Licensing.MintingLicenseSpec calldata mintingLicenseSpec + Licensing.MintingLicenseConfig calldata mintingLicenseConfig ) external onlyLicensingModule { LicenseRegistryStorage storage $ = _getLicenseRegistryStorage(); if (!$.registeredLicenseTemplates[licenseTemplate]) { revert Errors.LicenseRegistry__UnregisteredLicenseTemplate(licenseTemplate); } - $.mintingLicenseSpecs[_getHash(ipId, licenseTemplate, licenseTermsId)] = Licensing.MintingLicenseSpec({ + $.mintingLicenseConfigs[_getHash(ipId, licenseTemplate, licenseTermsId)] = Licensing.MintingLicenseConfig({ isSet: true, - mintingFee: mintingLicenseSpec.mintingFee, - mintingFeeModule: mintingLicenseSpec.mintingFeeModule, - receiverCheckModule: mintingLicenseSpec.receiverCheckModule, - receiverCheckData: mintingLicenseSpec.receiverCheckData + mintingFee: mintingLicenseConfig.mintingFee, + mintingFeeModule: mintingLicenseConfig.mintingFeeModule, + receiverCheckModule: mintingLicenseConfig.receiverCheckModule, + receiverCheckData: mintingLicenseConfig.receiverCheckData }); - emit MintingLicenseSpecSet(ipId, licenseTemplate, licenseTermsId, mintingLicenseSpec); + emit MintingLicenseConfigSet(ipId, licenseTemplate, licenseTermsId, mintingLicenseConfig); } - function setMintingLicenseSpecForAll( + function setMintingLicenseConfigForAll( address ipId, - Licensing.MintingLicenseSpec calldata mintingLicenseSpec + Licensing.MintingLicenseConfig calldata mintingLicenseConfig ) external onlyLicensingModule { LicenseRegistryStorage storage $ = _getLicenseRegistryStorage(); - $.mintingLicenseSpecsForAll[ipId] = Licensing.MintingLicenseSpec({ + $.mintingLicenseConfigsForAll[ipId] = Licensing.MintingLicenseConfig({ isSet: true, - mintingFee: mintingLicenseSpec.mintingFee, - mintingFeeModule: mintingLicenseSpec.mintingFeeModule, - receiverCheckModule: mintingLicenseSpec.receiverCheckModule, - receiverCheckData: mintingLicenseSpec.receiverCheckData + mintingFee: mintingLicenseConfig.mintingFee, + mintingFeeModule: mintingLicenseConfig.mintingFeeModule, + receiverCheckModule: mintingLicenseConfig.receiverCheckModule, + receiverCheckData: mintingLicenseConfig.receiverCheckData }); - emit MintingLicenseSpecSetForAll(ipId, mintingLicenseSpec); + emit MintingLicenseConfigSetForAll(ipId, mintingLicenseConfig); } function attachLicenseTermsToIp( @@ -228,7 +228,7 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg address licenseTemplate, uint256 licenseTermsId, bool isMintedByIpOwner - ) external view returns (Licensing.MintingLicenseSpec memory) { + ) external view returns (Licensing.MintingLicenseConfig memory) { LicenseRegistryStorage storage $ = _getLicenseRegistryStorage(); if ($.expireTimes[originalIpId] < block.timestamp) { revert Errors.LicenseRegistry__OriginalIpExpired(originalIpId); @@ -240,7 +240,7 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg } else if (!_hasIpAttachedLicenseTerms(originalIpId, licenseTemplate, licenseTermsId)) { revert Errors.LicenseRegistry__OriginalIpHasNoLicenseTerms(originalIpId, licenseTermsId); } - return _getMintingLicenseSpec(originalIpId, licenseTemplate, licenseTermsId); + return _getMintingLicenseConfig(originalIpId, licenseTemplate, licenseTermsId); } function isRegisteredLicenseTemplate(address licenseTemplate) external view returns (bool) { @@ -291,12 +291,12 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg return _getLicenseRegistryStorage().attachedLicenseTerms[ipId].length(); } - function getMintingLicenseSpec( + function getMintingLicenseConfig( address ipId, address licenseTemplate, uint256 licenseTermsId - ) external view returns (Licensing.MintingLicenseSpec memory) { - return _getMintingLicenseSpec(ipId, licenseTemplate, licenseTermsId); + ) external view returns (Licensing.MintingLicenseConfig memory) { + return _getMintingLicenseConfig(ipId, licenseTemplate, licenseTermsId); } /// @notice Returns the canonical protocol-wide LicensingModule @@ -327,19 +327,19 @@ contract LicenseRegistryV2 is ILicenseRegistryV2, GovernableUpgradeable, UUPSUpg return _getLicenseRegistryStorage().originalIps[derivativeIpId].length() > 0; } - function _getMintingLicenseSpec( + function _getMintingLicenseConfig( address ipId, address licenseTemplate, uint256 licenseTermsId - ) internal view returns (Licensing.MintingLicenseSpec memory) { + ) internal view returns (Licensing.MintingLicenseConfig memory) { LicenseRegistryStorage storage $ = _getLicenseRegistryStorage(); if (!$.registeredLicenseTemplates[licenseTemplate]) { revert Errors.LicenseRegistry__UnregisteredLicenseTemplate(licenseTemplate); } - if ($.mintingLicenseSpecs[_getHash(ipId, licenseTemplate, licenseTermsId)].isSet) { - return $.mintingLicenseSpecs[_getHash(ipId, licenseTemplate, licenseTermsId)]; + if ($.mintingLicenseConfigs[_getHash(ipId, licenseTemplate, licenseTermsId)].isSet) { + return $.mintingLicenseConfigs[_getHash(ipId, licenseTemplate, licenseTermsId)]; } - return $.mintingLicenseSpecsForAll[ipId]; + return $.mintingLicenseConfigsForAll[ipId]; } function _getHash(address ipId, address licenseTemplate, uint256 licenseTermsId) internal pure returns (bytes32) {