diff --git a/contracts/interfaces/resolvers/IIPMetadataResolver.sol b/contracts/interfaces/resolvers/IIPMetadataResolver.sol index 6f0b3afe6..81a74317e 100644 --- a/contracts/interfaces/resolvers/IIPMetadataResolver.sol +++ b/contracts/interfaces/resolvers/IIPMetadataResolver.sol @@ -37,9 +37,9 @@ interface IIPMetadataResolver is IResolver { /// @param ipId The canonical ID of the specified IP. function owner(address ipId) external view returns (address); - /// @notice Fetches the token URI associated with the IP. + /// @notice Fetches an IP owner defined URI associated with the IP. /// @param ipId The canonical ID of the specified IP. - function tokenURI(address ipId) external view returns (string memory); + function uri(address ipId) external view returns (string memory); /// @notice Sets the core metadata associated with an IP. /// @param ipId The canonical ID of the specified IP. @@ -61,8 +61,8 @@ interface IIPMetadataResolver is IResolver { /// @param hash The keccak-256 hash to associate with the IP. function setHash(address ipId, bytes32 hash) external; - /// @notice Sets a token URI to associated with the IP. + /// @notice Sets an IP owner defined URI to associate with the IP. /// @param ipId The canonical ID of the specified IP. - function setTokenURI(address ipId, string calldata tokenURI) external; + function setURI(address ipId, string calldata uri) external; } diff --git a/contracts/resolvers/IPMetadataResolver.sol b/contracts/resolvers/IPMetadataResolver.sol index 2d110cf84..c3090c036 100644 --- a/contracts/resolvers/IPMetadataResolver.sol +++ b/contracts/resolvers/IPMetadataResolver.sol @@ -41,7 +41,7 @@ contract IPMetadataResolver is IIPMetadataResolver, ResolverBase { hash: record.hash, registrationDate: record.registrationDate, registrant: record.registrant, - uri: tokenURI(ipId) + uri: uri(ipId) }); } @@ -86,18 +86,18 @@ contract IPMetadataResolver is IIPMetadataResolver, ResolverBase { return IIPAccount(payable(ipId)).owner(); } - /// @notice Fetches the token URI associated with the IP. + /// @notice Fetches an IP owner defined URI associated with the IP. /// @param ipId The canonical ID of the specified IP. - function tokenURI(address ipId) public view returns (string memory) { + function uri(address ipId) public view returns (string memory) { if (!IP_RECORD_REGISTRY.isRegistered(ipId)) { return ""; } IP.MetadataRecord memory record = _records[ipId]; - string memory uri = record.uri; + string memory ipUri = record.uri; - if (bytes(uri).length > 0) { - return uri; + if (bytes(ipUri).length > 0) { + return ipUri; } return _defaultTokenURI(ipId, record); @@ -131,11 +131,11 @@ contract IPMetadataResolver is IIPMetadataResolver, ResolverBase { _records[ipId].hash = newHash; } - /// @notice Sets a token URI to associated with the IP. + /// @notice Sets an IP owner defined URI to associate with the IP. /// @param ipId The canonical ID of the specified IP. - /// @param newTokenURI The new token URI to set for the IP. - function setTokenURI(address ipId, string calldata newTokenURI) external onlyAuthorized(ipId) { - _records[ipId].uri = newTokenURI; + /// @param newURI The new token URI to set for the IP. + function setURI(address ipId, string calldata newURI) external onlyAuthorized(ipId) { + _records[ipId].uri = newURI; } /// @notice Checks whether the resolver interface is supported. diff --git a/test/foundry/resolvers/IPMetadataResolver.t.sol b/test/foundry/resolvers/IPMetadataResolver.t.sol index db1b6fa90..8595c880b 100644 --- a/test/foundry/resolvers/IPMetadataResolver.t.sol +++ b/test/foundry/resolvers/IPMetadataResolver.t.sol @@ -98,7 +98,7 @@ contract IPMetadataResolverTest is ResolverBaseTest { assertEq(ipResolver.registrationDate(ipId), RECORD_REGISTRATION_DATE); assertEq(ipResolver.registrant(ipId), alice); assertEq(ipResolver.owner(ipId), alice); - assertEq(ipResolver.tokenURI(ipId), RECORD_URI); + assertEq(ipResolver.uri(ipId), RECORD_URI); // Also check the metadata getter returns as expected. IP.Metadata memory metadata = ipResolver.metadata(ipId); @@ -178,16 +178,16 @@ contract IPMetadataResolverTest is ResolverBaseTest { /// @notice Checks setting token URI works as expected. function test_IPMetadataResolver_SetTokenURI() public { - accessController.setPermission(ipId, alice, address(ipResolver), IIPMetadataResolver.setTokenURI.selector, 1); + accessController.setPermission(ipId, alice, address(ipResolver), IIPMetadataResolver.setURI.selector, 1); vm.prank(alice); - ipResolver.setTokenURI(ipId, RECORD_URI); - assertEq(ipResolver.tokenURI(ipId), RECORD_URI); + ipResolver.setURI(ipId, RECORD_URI); + assertEq(ipResolver.uri(ipId), RECORD_URI); } /// @notice Checks the default token URI renders as expected. function test_IPMetadataResolver_TokenURI_DefaultRender() public { // Check default empty string value for unregistered IP. - assertEq(ipResolver.tokenURI(address(0)), ""); + assertEq(ipResolver.uri(address(0)), ""); // Check default string value for registered IP. assertTrue(accessController.checkPermission(ipId, alice, address(ipResolver), IIPMetadataResolver.setMetadata.selector)); @@ -218,7 +218,7 @@ contract IPMetadataResolverTest is ResolverBaseTest { "data:application/json;base64,", Base64.encode(bytes(string(abi.encodePacked(uriEncoding)))) )); - assertEq(expectedURI, ipResolver.tokenURI(ipId)); + assertEq(expectedURI, ipResolver.uri(ipId)); } /// @dev Deploys a new IP Metadata Resolver.