diff --git a/contracts/AccessController.sol b/contracts/AccessController.sol index 351159bb9..dd6c51708 100644 --- a/contracts/AccessController.sol +++ b/contracts/AccessController.sol @@ -131,7 +131,7 @@ contract AccessController is IAccessController, Governable { if (IIPAccount(payable(ipAccount_)).owner() == signer_) { return true; } - uint functionPermission = getPermission(ipAccount_, signer_, to_, func_); + uint8 functionPermission = getPermission(ipAccount_, signer_, to_, func_); // Specific function permission overrides wildcard/general permission if (functionPermission == AccessPermission.ALLOW) { return true; diff --git a/contracts/IPAccountImpl.sol b/contracts/IPAccountImpl.sol index 5446fb777..817cc8f99 100644 --- a/contracts/IPAccountImpl.sol +++ b/contracts/IPAccountImpl.sol @@ -9,7 +9,6 @@ import { IAccessController } from "contracts/interfaces/IAccessController.sol"; import { IERC6551Account } from "lib/reference/src/interfaces/IERC6551Account.sol"; import { IIPAccount } from "contracts/interfaces/IIPAccount.sol"; import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; -import { AccessPermission } from "contracts/lib/AccessPermission.sol"; import { MessageHashUtils } from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; import { MetaTx } from "contracts/lib/MetaTx.sol"; import { Errors } from "contracts/lib/Errors.sol"; diff --git a/contracts/interfaces/governance/IGovernable.sol b/contracts/interfaces/governance/IGovernable.sol index 73046baef..c0e95382c 100644 --- a/contracts/interfaces/governance/IGovernable.sol +++ b/contracts/interfaces/governance/IGovernable.sol @@ -2,17 +2,18 @@ // See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf pragma solidity ^0.8.23; - /// @title IGovernable /// @notice This is the interface for the Lens Protocol main governance functions. interface IGovernable { /// @notice Emitted when the governance is updated /// @param newGovernance The address of the new governance event GovernanceUpdated(address indexed newGovernance); + /// @notice Sets the governance address /// @param newGovernance The address of the new governance function setGovernance(address newGovernance) external; + /// @notice Returns the current governance address - /// @return The address of the current governance + /// @return The address of the current governance function getGovernance() external view returns (address); } diff --git a/contracts/interfaces/licensing/ILinkParamVerifier.sol b/contracts/interfaces/licensing/ILinkParamVerifier.sol index ce3b5a033..0ddcf8cd2 100644 --- a/contracts/interfaces/licensing/ILinkParamVerifier.sol +++ b/contracts/interfaces/licensing/ILinkParamVerifier.sol @@ -15,4 +15,4 @@ interface ILinkParamVerifier is IPolicyVerifier { address parentIpId, bytes calldata policyData ) external returns (bool); -} \ No newline at end of file +} diff --git a/contracts/interfaces/licensing/IMintParamVerifier.sol b/contracts/interfaces/licensing/IMintParamVerifier.sol index 177250242..50562e805 100644 --- a/contracts/interfaces/licensing/IMintParamVerifier.sol +++ b/contracts/interfaces/licensing/IMintParamVerifier.sol @@ -15,4 +15,4 @@ interface IMintParamVerifier is IPolicyVerifier { uint256 mintAmount, bytes memory policyData ) external returns (bool); -} \ No newline at end of file +} diff --git a/contracts/interfaces/licensing/IPolicyFrameworkManager.sol b/contracts/interfaces/licensing/IPolicyFrameworkManager.sol index 10d5ddbbd..ce7e5502c 100644 --- a/contracts/interfaces/licensing/IPolicyFrameworkManager.sol +++ b/contracts/interfaces/licensing/IPolicyFrameworkManager.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.23; -import { Licensing } from "contracts/lib/Licensing.sol"; import { IPolicyVerifier } from "contracts/interfaces/licensing/IPolicyVerifier.sol"; /// @title IPolicyFrameworkManager @@ -10,5 +9,6 @@ import { IPolicyVerifier } from "contracts/interfaces/licensing/IPolicyVerifier. /// register itself into the LicenseRegistry to format policy into the LicenseRegistry interface IPolicyFrameworkManager is IPolicyVerifier { function licenseRegistry() external view returns (address); + function policyToJson(bytes memory policyData) external view returns (string memory); -} \ No newline at end of file +} diff --git a/contracts/interfaces/licensing/IPolicyVerifier.sol b/contracts/interfaces/licensing/IPolicyVerifier.sol index 7f5c34adf..e2626bfee 100644 --- a/contracts/interfaces/licensing/IPolicyVerifier.sol +++ b/contracts/interfaces/licensing/IPolicyVerifier.sol @@ -6,6 +6,4 @@ import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol"; /// @title IPolicyVerifier /// @notice Placeholder interface for verifying policy parameters. -interface IPolicyVerifier is IERC165 { - -} \ No newline at end of file +interface IPolicyVerifier is IERC165 {} diff --git a/contracts/interfaces/licensing/ITransferParamVerifier.sol b/contracts/interfaces/licensing/ITransferParamVerifier.sol index 17be9da02..4e0b6371c 100644 --- a/contracts/interfaces/licensing/ITransferParamVerifier.sol +++ b/contracts/interfaces/licensing/ITransferParamVerifier.sol @@ -15,4 +15,4 @@ interface ITransferParamVerifier is IPolicyVerifier { uint256 amount, bytes memory policyData ) external returns (bool); -} \ No newline at end of file +} diff --git a/contracts/interfaces/licensing/IUMLPolicyFrameworkManager.sol b/contracts/interfaces/licensing/IUMLPolicyFrameworkManager.sol index 2e01b5821..b879986f9 100644 --- a/contracts/interfaces/licensing/IUMLPolicyFrameworkManager.sol +++ b/contracts/interfaces/licensing/IUMLPolicyFrameworkManager.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.23; -import { Licensing } from "contracts/lib/Licensing.sol"; import { IPolicyFrameworkManager } from "contracts/interfaces/licensing/IPolicyFrameworkManager.sol"; /// @notice Licensing parameters for the UML standard @@ -37,11 +36,9 @@ struct UMLPolicy { string[] distributionChannels; } - /// @title IUMLPolicyFrameworkManager /// @notice Defines the interface for a Policy Framework Manager compliant with the UML standard interface IUMLPolicyFrameworkManager is IPolicyFrameworkManager { - /// @notice Emitted when a new policy is added to the registry event UMLPolicyAdded(uint256 indexed policyId, UMLPolicy policy); @@ -49,8 +46,9 @@ interface IUMLPolicyFrameworkManager is IPolicyFrameworkManager { /// @dev Must encode the policy into bytes to be stored in the LicenseRegistry /// @param umlPolicy UMLPolicy compliant licensing term values function addPolicy(UMLPolicy calldata umlPolicy) external returns (uint256 policyId); + /// @notice Fetchs a policy from the registry, decoding the raw bytes into a UMLPolicy struct /// @param policyId The ID of the policy to fetch /// @return policy The UMLPolicy struct function getPolicy(uint256 policyId) external view returns (UMLPolicy memory policy); -} \ No newline at end of file +} diff --git a/contracts/interfaces/modules/base/IModule.sol b/contracts/interfaces/modules/base/IModule.sol index b14c9dd29..2ea5b1dba 100644 --- a/contracts/interfaces/modules/base/IModule.sol +++ b/contracts/interfaces/modules/base/IModule.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.23; /// @notice Module Interface interface IModule { - /// @notice Returns the string identifier associated with the module. function name() external returns (string memory); } diff --git a/contracts/interfaces/modules/dispute/IDisputeModule.sol b/contracts/interfaces/modules/dispute/IDisputeModule.sol index c0439e9f3..b43d5508f 100644 --- a/contracts/interfaces/modules/dispute/IDisputeModule.sol +++ b/contracts/interfaces/modules/dispute/IDisputeModule.sol @@ -18,7 +18,7 @@ interface IDisputeModule { /// @param arbitrationRelayer The address of the arbitration relayer /// @param allowed Indicates if the arbitration relayer is whitelisted event ArbitrationRelayerWhitelistUpdated(address arbitrationPolicy, address arbitrationRelayer, bool allowed); - + /// @notice Event emitted when a dispute is raised /// @param disputeId The dispute id /// @param targetIpId The ipId that is the target of the dispute @@ -99,7 +99,9 @@ interface IDisputeModule { function resolveDispute(uint256 disputeId) external; /// @notice Gets the dispute struct characteristics - function disputes(uint256 disputeId) + function disputes( + uint256 disputeId + ) external view returns ( @@ -110,4 +112,4 @@ interface IDisputeModule { bytes32 targetTag, // The target tag of the dispute bytes32 currentTag // The current tag of the dispute ); -} \ No newline at end of file +} diff --git a/contracts/interfaces/modules/dispute/policies/IArbitrationPolicy.sol b/contracts/interfaces/modules/dispute/policies/IArbitrationPolicy.sol index b6c6ed05f..37d4a536c 100644 --- a/contracts/interfaces/modules/dispute/policies/IArbitrationPolicy.sol +++ b/contracts/interfaces/modules/dispute/policies/IArbitrationPolicy.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.23; /// @title ArbitrationPolicy interface interface IArbitrationPolicy { /// @notice Executes custom logic on raise dispute - /// @param caller Address of the caller + /// @param caller Address of the caller function onRaiseDispute(address caller, bytes calldata data) external; /// @notice Executes custom logic on dispute judgement diff --git a/contracts/interfaces/modules/royalty/IRoyaltyModule.sol b/contracts/interfaces/modules/royalty/IRoyaltyModule.sol index a75f8bb23..1d18e620e 100644 --- a/contracts/interfaces/modules/royalty/IRoyaltyModule.sol +++ b/contracts/interfaces/modules/royalty/IRoyaltyModule.sol @@ -22,4 +22,4 @@ interface IRoyaltyModule { /// @notice Gets the royalty policy for a given ipId function royaltyPolicies(address ipId) external view returns (address royaltyPolicy); -} \ No newline at end of file +} diff --git a/contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol b/contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol index f8ece07cb..bd74ede20 100644 --- a/contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol +++ b/contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol @@ -6,6 +6,6 @@ interface ILiquidSplitClone { /// @notice Distributes funds to the accounts in the LiquidSplitClone contract /// @param token The token to distribute /// @param accounts The accounts to distribute to - /// @param distributorAddress The distributor address + /// @param distributorAddress The distributor address function distributeFunds(address token, address[] calldata accounts, address distributorAddress) external; -} \ No newline at end of file +} diff --git a/contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol b/contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol index da9a630b5..d9647e647 100644 --- a/contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol +++ b/contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol @@ -5,13 +5,13 @@ pragma solidity ^0.8.23; interface ILiquidSplitFactory { /// @notice Creates a new LiquidSplitClone contract /// @param accounts The accounts to initialize the LiquidSplitClone contract with - /// @param initAllocations The initial allocations + /// @param initAllocations The initial allocations /// @param _distributorFee The distributor fee - /// @param owner The owner of the LiquidSplitClone contract + /// @param owner The owner of the LiquidSplitClone contract function createLiquidSplitClone( address[] calldata accounts, uint32[] calldata initAllocations, uint32 _distributorFee, address owner ) external returns (address); -} \ No newline at end of file +} diff --git a/contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol b/contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol index ba1380935..5e9f4d827 100644 --- a/contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol +++ b/contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; -import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /// @title LiquidSplitMain interface interface ILiquidSplitMain { @@ -9,9 +9,5 @@ interface ILiquidSplitMain { /// @param account The account to withdraw from /// @param withdrawETH The amount of ETH to withdraw /// @param tokens The tokens to withdraw - function withdraw( - address account, - uint256 withdrawETH, - ERC20[] calldata tokens - ) external; -} \ No newline at end of file + function withdraw(address account, uint256 withdrawETH, ERC20[] calldata tokens) external; +} diff --git a/contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol b/contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol index ad97f6b61..5bcf693f1 100644 --- a/contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol +++ b/contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.23; /// @title RoyaltyPolicy interface -interface IRoyaltyPolicy { +interface IRoyaltyPolicy { /// @notice Initializes the royalty policy /// @param ipId The ipId - /// @param data The data to initialize the policy + /// @param data The data to initialize the policy function initPolicy(address ipId, bytes calldata data) external; /// @notice Allows to pay a royalty @@ -14,4 +14,4 @@ interface IRoyaltyPolicy { /// @param token The token to pay /// @param amount The amount to pay function onRoyaltyPayment(address caller, address ipId, address token, uint256 amount) external; -} \ No newline at end of file +} diff --git a/contracts/interfaces/registries/IIPAccountRegistry.sol b/contracts/interfaces/registries/IIPAccountRegistry.sol index bad40079f..d6bc8d0d1 100644 --- a/contracts/interfaces/registries/IIPAccountRegistry.sol +++ b/contracts/interfaces/registries/IIPAccountRegistry.sol @@ -24,24 +24,15 @@ interface IIPAccountRegistry { /// @param chainId_ The chain ID where the token contract deployed /// @param tokenContract_ The address of the token contract to be associated with the IP Account /// @param tokenId_ The ID of the token to be associated with the IP Account - /// @return The address of the newly created IP Account - function registerIpAccount( - uint256 chainId_, - address tokenContract_, - uint256 tokenId_ - ) external returns (address); + /// @return The address of the newly created IP Account + function registerIpAccount(uint256 chainId_, address tokenContract_, uint256 tokenId_) external returns (address); /// @notice Returns the IPAccount address for the given NFT token /// @param chainId_ The chain ID where the token contract deployed /// @param tokenContract_ The address of the token contract associated with the IP Account /// @param tokenId_ The ID of the token associated with the IP Account /// @return The address of the IP Account associated with the given NFT token - function ipAccount( - uint256 chainId_, - address tokenContract_, - uint256 tokenId_ - ) external view returns (address); - + function ipAccount(uint256 chainId_, address tokenContract_, uint256 tokenId_) external view returns (address); /// @notice Returns the IPAccount implementation address /// @return The address of the IPAccount implementation diff --git a/contracts/interfaces/registries/IIPAssetRegistry.sol b/contracts/interfaces/registries/IIPAssetRegistry.sol index 8ceb0bbfb..f33fb112e 100644 --- a/contracts/interfaces/registries/IIPAssetRegistry.sol +++ b/contracts/interfaces/registries/IIPAssetRegistry.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.23; import { IIPAccountRegistry } from "contracts/interfaces/registries/IIPAccountRegistry.sol"; -import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMetadataProvider.sol"; /// @title Interface for IP Account Registry /// @notice This interface manages the registration and tracking of IP Accounts @@ -35,11 +34,7 @@ interface IIPAssetRegistry is IIPAccountRegistry { /// @param ipId The canonical identifier of the specified IP. /// @param metadataProvider Address of the metadata provider associated with the IP. /// @param metadata The canonical metadata in bytes associated with the IP. - event MetadataSet( - address indexed ipId, - address indexed metadataProvider, - bytes metadata - ); + event MetadataSet(address indexed ipId, address indexed metadataProvider, bytes metadata); /// @notice Gets the canonical IP identifier associated with an IP (NFT). /// @dev This is the same as the address of the IP account bound to the IP. @@ -103,5 +98,4 @@ interface IIPAssetRegistry is IIPAccountRegistry { /// @param id The canonical ID of the IP. /// @param resolverAddr The address of the resolver being set. function setResolver(address id, address resolverAddr) external; - } diff --git a/contracts/interfaces/registries/ILicenseRegistry.sol b/contracts/interfaces/registries/ILicenseRegistry.sol index f10a05203..a5175e3a6 100644 --- a/contracts/interfaces/registries/ILicenseRegistry.sol +++ b/contracts/interfaces/registries/ILicenseRegistry.sol @@ -10,11 +10,10 @@ import { Licensing } from "contracts/lib/Licensing.sol"; /// - Registering policies /// - Minting licenses /// - Linking IP to its parent -/// - Verifying transfer parameters (through the ITransferParamVerifier interface implementation by the policy framework) -/// - Verifying linking parameters (through the ILinkParamVerifier interface implementation by the policy framework) -/// - Verifying policy parameters (through the IPolicyVerifier interface implementation by the policy framework) +/// - Verifying transfer parameters (through the ITransferParamVerifier interface implementation by policy framework) +/// - Verifying linking parameters (through the ILinkParamVerifier interface implementation by policy framework) +/// - Verifying policy parameters (through the IPolicyVerifier interface implementation by policy framework) interface ILicenseRegistry { - /// @notice Emitted when a policy framework is created by registering a policy framework manager /// @param creator The address that created the policy framework /// @param frameworkId The id of the policy framework @@ -66,7 +65,7 @@ interface ILicenseRegistry { /// @notice registers a policy framework into the contract /// @param fw The policy framework data - /// @return frameworkId The id of the policy framework + /// @return frameworkId The id of the policy framework function addPolicyFramework(Licensing.PolicyFramework calldata fw) external returns (uint256 frameworkId); /// @notice registers a policy into the contract @@ -104,41 +103,59 @@ interface ILicenseRegistry { /// @notice gets total number of policy frameworks in the contract function totalFrameworks() external view returns (uint256); + /// @notice gets policy framework data by id function framework(uint256 frameworkId) external view returns (Licensing.PolicyFramework memory); + /// @notice gets policy framework license template URL by id function frameworkUrl(uint256 frameworkId) external view returns (string memory); + /// @notice gets total number of policies (framework parameter configurations) in the contract function totalPolicies() external view returns (uint256); + /// @notice gets policy data by id function policy(uint256 policyId) external view returns (Licensing.Policy memory pol); + /// @notice true if policy is defined in the contract function isPolicyDefined(uint256 policyId) external view returns (bool); + /// @notice gets the policy ids for an IP function policyIdsForIp(address ipId) external view returns (uint256[] memory policyIds); + /// @notice gets total number of policies for an IP function totalPoliciesForIp(address ipId) external view returns (uint256); + /// @notice true if policy is part of an IP's policy list function isPolicyIdSetForIp(address ipId, uint256 policyId) external view returns (bool); + /// @notice gets the policy ID for an IP by index on the IP's policy list function policyIdForIpAtIndex(address ipId, uint256 index) external view returns (uint256 policyId); + /// @notice gets the policy for an IP by index on the IP's policy list function policyForIpAtIndex(address ipId, uint256 index) external view returns (Licensing.Policy memory); + /// @notice gets the index of a policy in an IP's policy list function indexOfPolicyForIp(address ipId, uint256 policyId) external view returns (uint256 index); + /// @notice true if the license was added to the IP by linking (burning a license) function isPolicyInherited(address ipId, uint256 policyId) external view returns (bool); + /// @notice true if holder is the licensee for the license (owner of the license NFT), or derivative IP owner if /// the license was added to the IP by linking (burning a license) function isLicensee(uint256 licenseId, address holder) external view returns (bool); + /// @notice IP ID of the licensor for the license (parent IP) function licensorIpId(uint256 licenseId) external view returns (address); + /// @notice license data (licensor, policy...) for the license id function license(uint256 licenseId) external view returns (Licensing.License memory); + /// @notice true if an IP is a derivative of another IP function isParent(address parentIpId, address childIpId) external view returns (bool); + /// @notice returns the parent IP IDs for an IP ID function parentIpIds(address ipId) external view returns (address[] memory); + /// @notice total number of parents for an IP ID function totalParentsForIpId(address ipId) external view returns (uint256); -} \ No newline at end of file +} diff --git a/contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol b/contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol index f1807e9f0..440d7a3bc 100644 --- a/contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol +++ b/contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol @@ -8,7 +8,7 @@ import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMet interface IMetadataProviderUpgradeable is IMetadataProvider { /// @notice Returns the new metadata provider IP assets may migrate to. /// @return Address of the new metadata provider if set, else the zero address. - function upgradeProvider() external returns(IMetadataProvider); + function upgradeProvider() external returns (IMetadataProvider); /// @notice Sets a new metadata provider that IP assets may migrate to. /// @param provider The address of the new metadata provider. diff --git a/contracts/interfaces/registries/metadata/IMetadataProviderV1.sol b/contracts/interfaces/registries/metadata/IMetadataProviderV1.sol index a490760a4..4a2653cb6 100644 --- a/contracts/interfaces/registries/metadata/IMetadataProviderV1.sol +++ b/contracts/interfaces/registries/metadata/IMetadataProviderV1.sol @@ -6,7 +6,6 @@ import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMet /// @title Metadata Provider v1 Interface interface IMetadataProviderV1 is IMetadataProvider { - /// @notice Gets the name associated with the IP asset. /// @param ipId The address identifier of the IP asset. function name(address ipId) external view returns (string memory); diff --git a/contracts/interfaces/resolvers/IKeyValueResolver.sol b/contracts/interfaces/resolvers/IKeyValueResolver.sol index eeb80c844..637dd3270 100644 --- a/contracts/interfaces/resolvers/IKeyValueResolver.sol +++ b/contracts/interfaces/resolvers/IKeyValueResolver.sol @@ -4,17 +4,9 @@ pragma solidity ^0.8.23; /// @title Key Value Resolver Interface interface IKeyValueResolver { - /// @notice Emits when a new key-value pair is set for the resolver. - event KeyValueSet( - address indexed ipId, - string indexed key, - string value - ); + event KeyValueSet(address indexed ipId, string indexed key, string value); /// @notice Retrieves the string value associated with a key for an IP asset. - function value( - address ipId, - string calldata key - ) external view returns (string memory); + function value(address ipId, string calldata key) external view returns (string memory); } diff --git a/contracts/interfaces/resolvers/IResolver.sol b/contracts/interfaces/resolvers/IResolver.sol index fcf880be1..dbb760da3 100644 --- a/contracts/interfaces/resolvers/IResolver.sol +++ b/contracts/interfaces/resolvers/IResolver.sol @@ -6,8 +6,6 @@ import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; /// @notice Resolver Interface interface IResolver is IModule { - /// @notice Checks whether the resolver IP interface is supported. - function supportsInterface(bytes4 id) view external returns (bool); - + function supportsInterface(bytes4 id) external view returns (bool); } diff --git a/contracts/lib/Licensing.sol b/contracts/lib/Licensing.sol index 8c6192dbd..7feb9762e 100644 --- a/contracts/lib/Licensing.sol +++ b/contracts/lib/Licensing.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; -import { IPolicyVerifier } from "../interfaces/licensing/IPolicyVerifier.sol"; -import { Errors } from "./Errors.sol"; /// @title Licensing /// @notice Types and constants used by the licensing related contracts diff --git a/contracts/lib/MetaTx.sol b/contracts/lib/MetaTx.sol index 8c8d95044..92a4a724e 100644 --- a/contracts/lib/MetaTx.sol +++ b/contracts/lib/MetaTx.sol @@ -6,14 +6,15 @@ pragma solidity ^0.8.23; /// @dev This library provides functions for handling meta transactions in the Story Protocol. library MetaTx { /// @dev Version of the EIP712 domain. - string constant EIP712_DOMAIN_VERSION = "1"; + string public constant EIP712_DOMAIN_VERSION = "1"; /// @dev Hash of the EIP712 domain version. - bytes32 constant EIP712_DOMAIN_VERSION_HASH = keccak256(bytes(EIP712_DOMAIN_VERSION)); + bytes32 public constant EIP712_DOMAIN_VERSION_HASH = keccak256(bytes(EIP712_DOMAIN_VERSION)); /// @dev EIP712 domain type hash. - bytes32 constant EIP712_DOMAIN = + bytes32 public constant EIP712_DOMAIN = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @dev Execute type hash. - bytes32 constant EXECUTE = keccak256("Execute(address to,uint256 value,bytes data,uint256 nonce,uint256 deadline)"); + bytes32 public constant EXECUTE = + keccak256("Execute(address to,uint256 value,bytes data,uint256 nonce,uint256 deadline)"); /// @dev Structure for the Execute type. struct Execute { diff --git a/contracts/lib/registries/IPAccountChecker.sol b/contracts/lib/registries/IPAccountChecker.sol index eb619dc80..1428c3c20 100644 --- a/contracts/lib/registries/IPAccountChecker.sol +++ b/contracts/lib/registries/IPAccountChecker.sol @@ -39,7 +39,7 @@ library IPAccountChecker { if (!ERC165Checker.supportsERC165(ipAccountAddress_)) return false; if (!ERC165Checker.supportsInterface(ipAccountAddress_, type(IERC6551Account).interfaceId)) return false; if (!ERC165Checker.supportsInterface(ipAccountAddress_, type(IIPAccount).interfaceId)) return false; - (uint chainId, address tokenContract, uint tokenId) = IIPAccount(payable(ipAccountAddress_)).token(); + (uint256 chainId, address tokenContract, uint256 tokenId) = IIPAccount(payable(ipAccountAddress_)).token(); return ipAccountAddress_ == ipAccountRegistry_.ipAccount(chainId, tokenContract, tokenId); } } diff --git a/contracts/modules/BaseModule.sol b/contracts/modules/BaseModule.sol index 66aca8f7e..dba41235f 100644 --- a/contracts/modules/BaseModule.sol +++ b/contracts/modules/BaseModule.sol @@ -5,9 +5,7 @@ pragma solidity ^0.8.23; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; import { IAccessController } from "contracts/interfaces/IAccessController.sol"; import { IPAssetRegistry } from "contracts/registries/IPAssetRegistry.sol"; -import { IPAccountRegistry } from "contracts/registries/IPAccountRegistry.sol"; import { LicenseRegistry } from "contracts/registries/LicenseRegistry.sol"; -import { IResolver } from "contracts/interfaces/resolvers/IResolver.sol"; import { Errors } from "contracts/lib/Errors.sol"; /// @title BaseModule diff --git a/contracts/modules/RegistrationModule.sol b/contracts/modules/RegistrationModule.sol index 20b2d81a7..6a371f4aa 100644 --- a/contracts/modules/RegistrationModule.sol +++ b/contracts/modules/RegistrationModule.sol @@ -103,7 +103,14 @@ contract RegistrationModule is BaseModule, IRegistrationModule { uri: externalURL }) ); - address ipId = IP_ASSET_REGISTRY.register(block.chainid, tokenContract, tokenId, address(resolver), true, metadata); + address ipId = IP_ASSET_REGISTRY.register( + block.chainid, + tokenContract, + tokenId, + address(resolver), + true, + metadata + ); // Perform core IP derivative licensing - the license must be owned by the caller. // TODO: return resulting policy index diff --git a/contracts/modules/dispute-module/DisputeModule.sol b/contracts/modules/dispute-module/DisputeModule.sol index 2513813ca..5f3cf81fa 100644 --- a/contracts/modules/dispute-module/DisputeModule.sol +++ b/contracts/modules/dispute-module/DisputeModule.sol @@ -39,8 +39,8 @@ contract DisputeModule is IDisputeModule, ReentrancyGuard { mapping(address arbitrationPolicy => bool allowed) public isWhitelistedArbitrationPolicy; /// @notice Indicates if an arbitration relayer is whitelisted for a given arbitration policy - mapping(address arbitrationPolicy => mapping(address arbitrationRelayer => bool allowed)) public - isWhitelistedArbitrationRelayer; + mapping(address arbitrationPolicy => mapping(address arbitrationRelayer => bool allowed)) + public isWhitelistedArbitrationRelayer; /// @notice Restricts the calls to the governance address modifier onlyGovernance() { @@ -74,10 +74,11 @@ contract DisputeModule is IDisputeModule, ReentrancyGuard { /// @param _arbitrationPolicy The address of the arbitration policy /// @param _arbPolicyRelayer The address of the arbitration relayer /// @param _allowed Indicates if the arbitration relayer is whitelisted or not - function whitelistArbitrationRelayer(address _arbitrationPolicy, address _arbPolicyRelayer, bool _allowed) - external - onlyGovernance - { + function whitelistArbitrationRelayer( + address _arbitrationPolicy, + address _arbPolicyRelayer, + bool _allowed + ) external onlyGovernance { if (_arbitrationPolicy == address(0)) revert Errors.DisputeModule__ZeroArbitrationPolicy(); if (_arbPolicyRelayer == address(0)) revert Errors.DisputeModule__ZeroArbitrationRelayer(); @@ -123,7 +124,13 @@ contract DisputeModule is IDisputeModule, ReentrancyGuard { IArbitrationPolicy(_arbitrationPolicy).onRaiseDispute(msg.sender, _data); emit DisputeRaised( - disputeId_, _targetIpId, msg.sender, _arbitrationPolicy, linkToDisputeEvidence, _targetTag, _data + disputeId_, + _targetIpId, + msg.sender, + _arbitrationPolicy, + linkToDisputeEvidence, + _targetTag, + _data ); return disputeId_; diff --git a/contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol b/contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol index 955724f5f..a22e15d84 100644 --- a/contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol +++ b/contracts/modules/dispute-module/policies/ArbitrationPolicySP.sol @@ -63,7 +63,7 @@ contract ArbitrationPolicySP is IArbitrationPolicy { /// @param _decision The decision of the dispute function onDisputeJudgement(uint256 _disputeId, bool _decision, bytes calldata) external onlyDisputeModule { if (_decision) { - (, address disputeInitiator,,,,) = IDisputeModule(DISPUTE_MODULE).disputes(_disputeId); + (, address disputeInitiator, , , , ) = IDisputeModule(DISPUTE_MODULE).disputes(_disputeId); IERC20(PAYMENT_TOKEN).safeTransfer(disputeInitiator, ARBITRATION_PRICE); } } diff --git a/contracts/modules/licensing/BasePolicyFrameworkManager.sol b/contracts/modules/licensing/BasePolicyFrameworkManager.sol index 4c13cdb6b..7ae1b75cd 100644 --- a/contracts/modules/licensing/BasePolicyFrameworkManager.sol +++ b/contracts/modules/licensing/BasePolicyFrameworkManager.sol @@ -5,9 +5,7 @@ pragma solidity ^0.8.23; // contracts import { IPolicyVerifier } from "contracts/interfaces/licensing/IPolicyVerifier.sol"; import { IPolicyFrameworkManager } from "contracts/interfaces/licensing/IPolicyFrameworkManager.sol"; -import { LicenseRegistry } from "contracts/registries/LicenseRegistry.sol"; import { Licensing } from "contracts/lib/Licensing.sol"; -import { Errors } from "contracts/lib/Errors.sol"; import { LicenseRegistryAware } from "contracts/modules/licensing/LicenseRegistryAware.sol"; // external @@ -30,7 +28,7 @@ abstract contract BasePolicyFrameworkManager is IPolicyVerifier, IPolicyFramewor /// @notice Registers this policy framework manager within the license registry, to be able /// to add policies into the license registry. - /// @dev save the policyFrameworkId in this PolicyFrameworkManager + /// @dev save the policyFrameworkId in this PolicyFrameworkManager /// @return The ID of the policy framework. function register() external returns (uint256) { Licensing.PolicyFramework memory framework = Licensing.PolicyFramework({ diff --git a/contracts/modules/licensing/LicenseRegistryAware.sol b/contracts/modules/licensing/LicenseRegistryAware.sol index 74d511916..124c3cfe6 100644 --- a/contracts/modules/licensing/LicenseRegistryAware.sol +++ b/contracts/modules/licensing/LicenseRegistryAware.sol @@ -9,7 +9,6 @@ import { Errors } from "contracts/lib/Errors.sol"; /// @title LicenseRegistryAware /// @notice Base contract to be inherited by modules that need to access the license registry. abstract contract LicenseRegistryAware { - /// @notice Gets the protocol-wide license registry. LicenseRegistry public immutable LICENSE_REGISTRY; @@ -26,5 +25,4 @@ abstract contract LicenseRegistryAware { } _; } - -} \ No newline at end of file +} diff --git a/contracts/modules/licensing/UMLPolicyFrameworkManager.sol b/contracts/modules/licensing/UMLPolicyFrameworkManager.sol index bc1feed27..bfcdff7b8 100644 --- a/contracts/modules/licensing/UMLPolicyFrameworkManager.sol +++ b/contracts/modules/licensing/UMLPolicyFrameworkManager.sol @@ -7,8 +7,6 @@ import { Base64 } from "@openzeppelin/contracts/utils/Base64.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; // contracts -import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; -import { LicenseRegistry } from "contracts/registries/LicenseRegistry.sol"; import { Licensing } from "contracts/lib/Licensing.sol"; import { Errors } from "contracts/lib/Errors.sol"; import { UMLFrameworkErrors } from "contracts/lib/UMLFrameworkErrors.sol"; diff --git a/contracts/modules/licensing/parameter-helpers/LicensorApprovalManager.sol b/contracts/modules/licensing/parameter-helpers/LicensorApprovalManager.sol index c27510faa..1be536b0e 100644 --- a/contracts/modules/licensing/parameter-helpers/LicensorApprovalManager.sol +++ b/contracts/modules/licensing/parameter-helpers/LicensorApprovalManager.sol @@ -10,7 +10,6 @@ import { IAccessController } from "contracts/interfaces/IAccessController.sol"; /// @notice Manages the approval of derivative IP accounts by the licensor. Used to verify /// licensing terms like "Derivatives With Approval" in UML. abstract contract LicensorApprovalManager is LicenseRegistryAware { - /// Emits when a derivative IP account is approved by the licensor. /// @param licenseId id of the license waiting for approval /// @param ipId id of the derivative IP to be approved @@ -51,5 +50,4 @@ abstract contract LicensorApprovalManager is LicenseRegistryAware { address licensorIpId = LICENSE_REGISTRY.licensorIpId(licenseId); return _approvals[licenseId][licensorIpId][childIpId]; } - } diff --git a/contracts/modules/royalty-module/policies/RoyaltyPolicyLS.sol b/contracts/modules/royalty-module/policies/RoyaltyPolicyLS.sol index 3a8145ca7..446ee4d17 100644 --- a/contracts/modules/royalty-module/policies/RoyaltyPolicyLS.sol +++ b/contracts/modules/royalty-module/policies/RoyaltyPolicyLS.sol @@ -57,7 +57,8 @@ contract RoyaltyPolicyLS is IRoyaltyPolicy { (address[] memory accounts, uint32[] memory initAllocations, uint32 distributorFee, address splitOwner) = abi .decode(_data, (address[], uint32[], uint32, address)); - // TODO: input validation: accounts & initAllocations - can we make up to 1000 parents with tx going through - if not alternative may be to create new contract to claim RNFTs + // TODO: input validation: accounts & initAllocations - can we make up to 1000 parents with tx + // going through - if not alternative may be to create new contract to claim RNFTs // TODO: input validation: distributorFee // TODO: input validation: splitOwner diff --git a/contracts/modules/tagging/TaggingModule.sol b/contracts/modules/tagging/TaggingModule.sol index 4022a5d26..a5565e9cb 100644 --- a/contracts/modules/tagging/TaggingModule.sol +++ b/contracts/modules/tagging/TaggingModule.sol @@ -6,7 +6,6 @@ pragma solidity ^0.8.23; import { ShortString, ShortStrings } from "@openzeppelin/contracts/utils/ShortStrings.sol"; import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import { Errors } from "contracts/lib/Errors.sol"; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; import { ITaggingModule } from "contracts/interfaces/modules/ITaggingModule.sol"; @@ -15,7 +14,7 @@ contract TaggingModule is IModule, ITaggingModule { using EnumerableSet for EnumerableSet.Bytes32Set; using EnumerableSet for EnumerableSet.AddressSet; - uint256 constant MAX_TAG_PERMISSIONS_AT_ONCE = 300; + uint256 public constant MAX_TAG_PERMISSIONS_AT_ONCE = 300; string public name = "TaggingModule"; @@ -33,6 +32,7 @@ contract TaggingModule is IModule, ITaggingModule { emit TagRemoved(tag, ipId); return _tagsForIpIds[ipId].remove(ShortStringOps.stringToBytes32(tag)); } + function isTagged(string calldata tag, address ipId) external view returns (bool) { return _tagsForIpIds[ipId].contains(ShortStringOps.stringToBytes32(tag)); } @@ -50,5 +50,4 @@ contract TaggingModule is IModule, ITaggingModule { // WARNING: tag ordering not guaranteed (since they can be removed) return ShortString.wrap(_tagsForIpIds[ipId].at(index)).toString(); } - } diff --git a/contracts/registries/IPAssetRegistry.sol b/contracts/registries/IPAssetRegistry.sol index bbf03505d..02ea0b7ce 100644 --- a/contracts/registries/IPAssetRegistry.sol +++ b/contracts/registries/IPAssetRegistry.sol @@ -2,12 +2,10 @@ // See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf pragma solidity ^0.8.23; -import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; -import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import { IIPAccount } from "contracts/interfaces/IIPAccount.sol"; -import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMetadataProvider.sol"; import { IIPAssetRegistry } from "contracts/interfaces/registries/IIPAssetRegistry.sol"; import { IPAccountRegistry } from "contracts/registries/IPAccountRegistry.sol"; +// solhint-disable-next-line max-line-length import { IMetadataProviderUpgradeable } from "contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol"; import { MetadataProviderV1 } from "contracts/registries/metadata/MetadataProviderV1.sol"; import { Errors } from "contracts/lib/Errors.sol"; @@ -33,7 +31,7 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry { uint256 public totalSupply = 0; /// @notice Protocol governance administrator of the IP record registry. - address owner; + address public owner; /// @dev Maps an IP, identified by its IP ID, to an IP record. mapping(address => Record) internal _records; @@ -42,7 +40,7 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry { IMetadataProviderUpgradeable internal _metadataProvider; /// @notice Ensures only protocol governance owner may call a function. - modifier onlyOwner { + modifier onlyOwner() { if (msg.sender != owner) { revert Errors.IPAssetRegistry__Unauthorized(); } @@ -81,11 +79,7 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry { revert Errors.IPAssetRegistry__AlreadyRegistered(); } - if ( - id.code.length == 0 && - createAccount && - id != registerIpAccount(chainId, tokenContract, tokenId) - ) { + if (id.code.length == 0 && createAccount && id != registerIpAccount(chainId, tokenContract, tokenId)) { revert Errors.IPAssetRegistry__InvalidAccount(); } _setResolver(id, resolverAddr); @@ -154,7 +148,7 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry { /// @param id The canonical ID of the IP. /// @param data Canonical metadata to associate with the IP. function setMetadata(address id, address provider, bytes calldata data) external { - // Metadata is set on registration and immutable thereafter, with new fields + // Metadata is set on registration and immutable thereafter, with new fields // only added during a migration to new protocol-approved metadata provider. if (address(_records[id].metadataProvider) != msg.sender) { revert Errors.IPAssetRegistry__Unauthorized(); @@ -192,5 +186,4 @@ contract IPAssetRegistry is IIPAssetRegistry, IPAccountRegistry { provider.setMetadata(id, data); emit MetadataSet(id, address(provider), data); } - } diff --git a/contracts/registries/LicenseRegistry.sol b/contracts/registries/LicenseRegistry.sol index 7ed9409df..135e713ff 100644 --- a/contracts/registries/LicenseRegistry.sol +++ b/contracts/registries/LicenseRegistry.sol @@ -5,12 +5,10 @@ pragma solidity ^0.8.23; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; -import { ShortString, ShortStrings } from "@openzeppelin/contracts/utils/ShortStrings.sol"; +import { ShortStrings } from "@openzeppelin/contracts/utils/ShortStrings.sol"; import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; // contracts -import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; -import { IPolicyVerifier } from "contracts/interfaces/licensing/IPolicyVerifier.sol"; import { IMintParamVerifier } from "contracts/interfaces/licensing/IMintParamVerifier.sol"; import { ILinkParamVerifier } from "contracts/interfaces/licensing/ILinkParamVerifier.sol"; import { ITransferParamVerifier } from "contracts/interfaces/licensing/ITransferParamVerifier.sol"; diff --git a/contracts/registries/metadata/IPAssetRenderer.sol b/contracts/registries/metadata/IPAssetRenderer.sol index 98c56e389..7c701e3c5 100644 --- a/contracts/registries/metadata/IPAssetRenderer.sol +++ b/contracts/registries/metadata/IPAssetRenderer.sol @@ -31,12 +31,7 @@ contract IPAssetRenderer { /// @notice Initializes the IP asset renderer. /// TODO: Add different customization options - e.g. font, colorways, etc. /// TODO: Add an external URL for generating SP-branded links for each IP. - constructor( - address assetRegistry, - address licenseRegistry, - address taggingModule, - address royaltyModule - ) { + constructor(address assetRegistry, address licenseRegistry, address taggingModule, address royaltyModule) { IP_ASSET_REGISTRY = IPAssetRegistry(assetRegistry); LICENSE_REGISTRY = LicenseRegistry(licenseRegistry); TAGGING_MODULE = TaggingModule(taggingModule); @@ -44,13 +39,13 @@ contract IPAssetRenderer { } // TODO: Add contract URI support for metadata about the entire IP registry. - + // TODO: Add rendering functions around licensing information. // TODO: Add rendering functions around royalties information. // TODO: Add rendering functions around tagging information. - + /// @notice Fetches the canonical name associated with the specified IP. /// @param ipId The canonical ID of the specified IP. function name(address ipId) external view returns (string memory) { @@ -65,15 +60,16 @@ contract IPAssetRenderer { /// TODO: Update the description to an SP base URL if external URL not set. function description(address ipId) public view returns (string memory) { IP.MetadataV1 memory metadata = _metadata(ipId); - return string.concat( - metadata.name, - ", IP #", - Strings.toHexString(ipId), - ", is currently owned by", - Strings.toHexString(owner(ipId)), - ". To learn more about this IP, visit ", - metadata.uri - ); + return + string.concat( + metadata.name, + ", IP #", + Strings.toHexString(ipId), + ", is currently owned by", + Strings.toHexString(owner(ipId)), + ". To learn more about this IP, visit ", + metadata.uri + ); } /// @notice Fetches the keccak-256 content hash associated with the specified IP. diff --git a/contracts/registries/metadata/IPMetadataProvider.sol b/contracts/registries/metadata/IPMetadataProvider.sol index 131b9848a..f890c2733 100644 --- a/contracts/registries/metadata/IPMetadataProvider.sol +++ b/contracts/registries/metadata/IPMetadataProvider.sol @@ -2,15 +2,12 @@ // See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf pragma solidity ^0.8.23; -import { REGISTRATION_MODULE_KEY } from "contracts/lib/modules/Module.sol"; import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMetadataProvider.sol"; import { IModuleRegistry } from "contracts/interfaces/registries/IModuleRegistry.sol"; -import { Errors } from "contracts/lib/Errors.sol"; /// @title IP Metadata Provider Contract /// @notice Base contract used for customization of canonical IP metadata. contract IPMetadataProvider is IMetadataProvider { - /// @notice Gets the protocol-wide module registry. IModuleRegistry public immutable MODULE_REGISTRY; diff --git a/contracts/registries/metadata/MetadataProviderBase.sol b/contracts/registries/metadata/MetadataProviderBase.sol index 2f2181afc..23f0212b0 100644 --- a/contracts/registries/metadata/MetadataProviderBase.sol +++ b/contracts/registries/metadata/MetadataProviderBase.sol @@ -2,9 +2,9 @@ // See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf pragma solidity ^0.8.23; -import { IP } from "contracts/lib/IP.sol"; import { IIPAccount } from "contracts/interfaces/IIPAccount.sol"; import { IMetadataProvider } from "contracts/interfaces/registries/metadata/IMetadataProvider.sol"; +// solhint-disable-next-line max-line-length import { IMetadataProviderUpgradeable } from "contracts/interfaces/registries/metadata/IMetadataProviderUpgradeable.sol"; import { Errors } from "contracts/lib/Errors.sol"; import { IPAssetRegistry } from "contracts/registries/IPAssetRegistry.sol"; @@ -12,7 +12,6 @@ import { IPAssetRegistry } from "contracts/registries/IPAssetRegistry.sol"; /// @title IP Metadata Provider Base Contract /// @notice Metadata provider base contract for storing canonical IP metadata. abstract contract MetadataProviderBase is IMetadataProviderUpgradeable { - /// @notice Gets the protocol-wide IP asset registry. IPAssetRegistry public immutable IP_ASSET_REGISTRY; @@ -23,7 +22,7 @@ abstract contract MetadataProviderBase is IMetadataProviderUpgradeable { mapping(address ip => bytes metadata) internal _ipMetadata; /// @notice Restricts calls to only originate from a protocol-authorized caller. - modifier onlyIPAssetRegistry { + modifier onlyIPAssetRegistry() { if (msg.sender != address(IP_ASSET_REGISTRY)) { revert Errors.MetadataProvider__Unauthorized(); } @@ -84,5 +83,5 @@ abstract contract MetadataProviderBase is IMetadataProviderUpgradeable { /// @dev Checks whether two sets of metadata are compatible with one another. /// @param m1 The first set of bytes metadata being compared. /// @param m2 The second set of bytes metadata being compared. - function _compatible(bytes memory m1, bytes memory m2) internal virtual pure returns (bool); + function _compatible(bytes memory m1, bytes memory m2) internal pure virtual returns (bool); } diff --git a/contracts/registries/metadata/MetadataProviderV1.sol b/contracts/registries/metadata/MetadataProviderV1.sol index b96453e4b..6db7499d4 100644 --- a/contracts/registries/metadata/MetadataProviderV1.sol +++ b/contracts/registries/metadata/MetadataProviderV1.sol @@ -9,7 +9,6 @@ import { Errors } from "contracts/lib/Errors.sol"; /// @title IP Metadata Provider v1 /// @notice Storage provider for Story Protocol canonical IP metadata (v1). contract MetadataProviderV1 is MetadataProviderBase { - /// @notice Initializes the metadata provider contract. /// @param ipAssetRegistry The protocol-wide IP asset registry. constructor(address ipAssetRegistry) MetadataProviderBase(ipAssetRegistry) {} @@ -64,26 +63,18 @@ contract MetadataProviderV1 is MetadataProviderBase { revert Errors.MetadataProvider__URIInvalid(); } } - + /// @dev Checks whether two sets of metadata are compatible with one another. /// TODO: Add try-catch for ABI-decoding error handling. - function _compatible(bytes memory m1, bytes memory m2) internal virtual override pure returns (bool) { + function _compatible(bytes memory m1, bytes memory m2) internal pure virtual override returns (bool) { IP.MetadataV1 memory m1Decoded = abi.decode(m1, (IP.MetadataV1)); IP.MetadataV1 memory m2Decoded = abi.decode(m2, (IP.MetadataV1)); return _hash(m1Decoded) == _hash(m2Decoded); } /// @dev Gets the bytes32 hash for a MetadataV1 data struct. - function _hash(IP.MetadataV1 memory data) internal pure returns(bytes32) { - return keccak256( - abi.encodePacked( - data.name, - data.hash, - data.registrationDate, - data.registrant, - data.uri - ) - ); + function _hash(IP.MetadataV1 memory data) internal pure returns (bytes32) { + return keccak256(abi.encodePacked(data.name, data.hash, data.registrationDate, data.registrant, data.uri)); } /// @dev Get the decoded canonical metadata belonging to an IP asset. diff --git a/contracts/resolvers/IPResolver.sol b/contracts/resolvers/IPResolver.sol index 7ea10bcdc..851ad7fda 100644 --- a/contracts/resolvers/IPResolver.sol +++ b/contracts/resolvers/IPResolver.sol @@ -2,15 +2,10 @@ // See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf pragma solidity ^0.8.23; -import { IResolver } from "contracts/interfaces/resolvers/IResolver.sol"; import { ResolverBase } from "./ResolverBase.sol"; import { BaseModule } from "contracts/modules/BaseModule.sol"; import { IModule } from "contracts/interfaces/modules/base/IModule.sol"; -import { IKeyValueResolver } from "contracts/interfaces/resolvers/IKeyValueResolver.sol"; -import { IIPAccount } from "contracts/interfaces/IIPAccount.sol"; import { KeyValueResolver } from "contracts/resolvers/KeyValueResolver.sol"; -import { Errors } from "contracts/lib/Errors.sol"; -import { IP } from "contracts/lib/IP.sol"; import { IP_RESOLVER_MODULE_KEY } from "contracts/lib/modules/Module.sol"; /// @title IP Resolver