diff --git a/contracts/SPGNFT.sol b/contracts/SPGNFT.sol index 97643de..1afe55f 100644 --- a/contracts/SPGNFT.sol +++ b/contracts/SPGNFT.sol @@ -112,26 +112,26 @@ contract SPGNFT is ISPGNFT, ERC721URIStorageUpgradeable, AccessControlUpgradeabl /// @notice Mints an NFT from the collection. Only callable by the minter role. /// @param to The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. + /// @param nftMetadataURI OPTIONAL. The URI of the desired metadata for the newly minted NFT. /// @return tokenId The ID of the minted NFT. function mint( address to, - string calldata nftMetadata + string calldata nftMetadataURI ) public virtual onlyRole(SPGNFTLib.MINTER_ROLE) returns (uint256 tokenId) { - tokenId = _mintToken({ to: to, payer: msg.sender, nftMetadata: nftMetadata }); + tokenId = _mintToken({ to: to, payer: msg.sender, nftMetadataURI: nftMetadataURI }); } /// @notice Mints an NFT from the collection. Only callable by the SPG. /// @param to The address of the recipient of the minted NFT. /// @param payer The address of the payer for the mint fee. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. + /// @param nftMetadataURI OPTIONAL. The URI of the desired metadata for the newly minted NFT. /// @return tokenId The ID of the minted NFT. function mintBySPG( address to, address payer, - string calldata nftMetadata + string calldata nftMetadataURI ) public virtual onlySPG returns (uint256 tokenId) { - tokenId = _mintToken({ to: to, payer: payer, nftMetadata: nftMetadata }); + tokenId = _mintToken({ to: to, payer: payer, nftMetadataURI: nftMetadataURI }); } /// @dev Withdraws the contract's token balance to the recipient. @@ -152,9 +152,9 @@ contract SPGNFT is ISPGNFT, ERC721URIStorageUpgradeable, AccessControlUpgradeabl /// @dev Mints an NFT from the collection. /// @param to The address of the recipient of the minted NFT. /// @param payer The address of the payer for the mint fee. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. + /// @param nftMetadataURI OPTIONAL. The URI of the desired metadata for the newly minted NFT. /// @return tokenId The ID of the minted NFT. - function _mintToken(address to, address payer, string calldata nftMetadata) internal returns (uint256 tokenId) { + function _mintToken(address to, address payer, string calldata nftMetadataURI) internal returns (uint256 tokenId) { SPGNFTStorage storage $ = _getSPGNFTStorage(); if ($.totalSupply + 1 > $.maxSupply) revert Errors.SPGNFT__MaxSupplyReached(); @@ -165,7 +165,7 @@ contract SPGNFT is ISPGNFT, ERC721URIStorageUpgradeable, AccessControlUpgradeabl tokenId = ++$.totalSupply; _mint(to, tokenId); - if (bytes(nftMetadata).length > 0) _setTokenURI(tokenId, nftMetadata); + if (bytes(nftMetadataURI).length > 0) _setTokenURI(tokenId, nftMetadataURI); } // diff --git a/contracts/StoryProtocolGateway.sol b/contracts/StoryProtocolGateway.sol index b6fa757..60a6cf0 100644 --- a/contracts/StoryProtocolGateway.sol +++ b/contracts/StoryProtocolGateway.sol @@ -157,17 +157,19 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param recipient The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. function mintAndRegisterIp( address nftContract, address recipient, - string calldata nftMetadata, IPMetadata calldata ipMetadata ) external onlyCallerWithMinterRole(nftContract) returns (address ipId, uint256 tokenId) { - tokenId = ISPGNFT(nftContract).mintBySPG({ to: address(this), payer: msg.sender, nftMetadata: nftMetadata }); + tokenId = ISPGNFT(nftContract).mintBySPG({ + to: address(this), + payer: msg.sender, + nftMetadataURI: ipMetadata.nftMetadataURI + }); ipId = IP_ASSET_REGISTRY.register(block.chainid, nftContract, tokenId); _setMetadata(ipMetadata, ipId); ISPGNFT(nftContract).safeTransferFrom(address(this), recipient, tokenId, ""); @@ -205,8 +207,7 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param recipient The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @param terms The PIL terms to be registered. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. @@ -214,11 +215,14 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana function mintAndRegisterIpAndAttachPILTerms( address nftContract, address recipient, - string calldata nftMetadata, IPMetadata calldata ipMetadata, PILTerms calldata terms ) external onlyCallerWithMinterRole(nftContract) returns (address ipId, uint256 tokenId, uint256 licenseTermsId) { - tokenId = ISPGNFT(nftContract).mintBySPG({ to: address(this), payer: msg.sender, nftMetadata: nftMetadata }); + tokenId = ISPGNFT(nftContract).mintBySPG({ + to: address(this), + payer: msg.sender, + nftMetadataURI: ipMetadata.nftMetadataURI + }); ipId = IP_ASSET_REGISTRY.register(block.chainid, nftContract, tokenId); _setMetadata(ipMetadata, ipId); @@ -261,19 +265,21 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param derivData The derivative data to be used for registerDerivative. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @param recipient The address to receive the minted NFT. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. function mintAndRegisterIpAndMakeDerivative( address nftContract, MakeDerivative calldata derivData, - string calldata nftMetadata, IPMetadata calldata ipMetadata, address recipient ) external onlyCallerWithMinterRole(nftContract) returns (address ipId, uint256 tokenId) { - tokenId = ISPGNFT(nftContract).mintBySPG({ to: address(this), payer: msg.sender, nftMetadata: nftMetadata }); + tokenId = ISPGNFT(nftContract).mintBySPG({ + to: address(this), + payer: msg.sender, + nftMetadataURI: ipMetadata.nftMetadataURI + }); ipId = IP_ASSET_REGISTRY.register(block.chainid, nftContract, tokenId); _setMetadata(ipMetadata, ipId); @@ -344,8 +350,7 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana /// @param nftContract The address of the NFT collection. /// @param licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs. /// @param royaltyContext The context for royalty module, should be empty for Royalty Policy LAP. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and newly registered IP. /// @param recipient The address to receive the minted NFT. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. @@ -353,13 +358,16 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana address nftContract, uint256[] calldata licenseTokenIds, bytes calldata royaltyContext, - string calldata nftMetadata, IPMetadata calldata ipMetadata, address recipient ) external onlyCallerWithMinterRole(nftContract) returns (address ipId, uint256 tokenId) { _collectLicenseTokens(licenseTokenIds); - tokenId = ISPGNFT(nftContract).mintBySPG({ to: address(this), payer: msg.sender, nftMetadata: nftMetadata }); + tokenId = ISPGNFT(nftContract).mintBySPG({ + to: address(this), + payer: msg.sender, + nftMetadataURI: ipMetadata.nftMetadataURI + }); ipId = IP_ASSET_REGISTRY.register(block.chainid, nftContract, tokenId); _setMetadata(ipMetadata, ipId); @@ -446,19 +454,20 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana ); } + /// @dev Sets the metadata for the given IP if metadata is non-empty. /// @dev Sets the metadata for the given IP if metadata is non-empty. /// @param ipMetadata The metadata to set. /// @param ipId The ID of the IP. function _setMetadata(IPMetadata calldata ipMetadata, address ipId) internal { if ( - keccak256(abi.encodePacked(ipMetadata.metadataURI)) != keccak256("") || - ipMetadata.metadataHash != bytes32(0) || + keccak256(abi.encodePacked(ipMetadata.ipMetadataURI)) != keccak256("") || + ipMetadata.ipMetadataHash != bytes32(0) || ipMetadata.nftMetadataHash != bytes32(0) ) { CORE_METADATA_MODULE.setAll( ipId, - ipMetadata.metadataURI, - ipMetadata.metadataHash, + ipMetadata.ipMetadataURI, + ipMetadata.ipMetadataHash, ipMetadata.nftMetadataHash ); } diff --git a/contracts/interfaces/ISPGNFT.sol b/contracts/interfaces/ISPGNFT.sol index 3dcb5e9..274667e 100644 --- a/contracts/interfaces/ISPGNFT.sol +++ b/contracts/interfaces/ISPGNFT.sol @@ -44,16 +44,16 @@ interface ISPGNFT is IAccessControl, IERC721, IERC721Metadata { /// @notice Mints an NFT from the collection. Only callable by the minter role. /// @param to The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. + /// @param nftMetadataURI OPTIONAL. The desired metadata for the newly minted NFT. /// @return tokenId The ID of the minted NFT. - function mint(address to, string calldata nftMetadata) external returns (uint256 tokenId); + function mint(address to, string calldata nftMetadataURI) external returns (uint256 tokenId); /// @notice Mints an NFT from the collection. Only callable by the SPG. /// @param to The address of the recipient of the minted NFT. /// @param payer The address of the payer for the mint fee. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. + /// @param nftMetadataURI OPTIONAL. The desired metadata for the newly minted NFT. /// @return tokenId The ID of the minted NFT. - function mintBySPG(address to, address payer, string calldata nftMetadata) external returns (uint256 tokenId); + function mintBySPG(address to, address payer, string calldata nftMetadataURI) external returns (uint256 tokenId); /// @dev Withdraws the contract's token balance to the recipient. /// @param recipient The token to withdraw. diff --git a/contracts/interfaces/IStoryProtocolGateway.sol b/contracts/interfaces/IStoryProtocolGateway.sol index 96439a1..002ec3e 100644 --- a/contracts/interfaces/IStoryProtocolGateway.sol +++ b/contracts/interfaces/IStoryProtocolGateway.sol @@ -8,13 +8,16 @@ interface IStoryProtocolGateway { /// @param nftContract The address of the newly created NFT collection. event CollectionCreated(address indexed nftContract); - /// @notice Struct for metadata for an IP. - /// @param metadataURI The URI of the metadata for the IP. - /// @param metadataHash The hash of the metadata for the IP. + /// @notice Struct for metadata for NFT minting and IP registration. + /// @dev Leave the nftMetadataURI empty if not minting an NFT. + /// @param ipMetadataURI The URI of the metadata for the IP. + /// @param ipMetadataHash The hash of the metadata for the IP. + /// @param nftMetadataURI The URI of the metadata for the NFT. /// @param nftMetadataHash The hash of the metadata for the IP NFT. struct IPMetadata { - string metadataURI; - bytes32 metadataHash; + string ipMetadataURI; + bytes32 ipMetadataHash; + string nftMetadataURI; bytes32 nftMetadataHash; } @@ -61,14 +64,12 @@ interface IStoryProtocolGateway { /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param recipient The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. function mintAndRegisterIp( address nftContract, address recipient, - string calldata nftMetadata, IPMetadata calldata ipMetadata ) external returns (address ipId, uint256 tokenId); @@ -96,8 +97,7 @@ interface IStoryProtocolGateway { /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param recipient The address of the recipient of the minted NFT. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @param terms The PIL terms to be registered. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. @@ -105,7 +105,6 @@ interface IStoryProtocolGateway { function mintAndRegisterIpAndAttachPILTerms( address nftContract, address recipient, - string calldata nftMetadata, IPMetadata calldata ipMetadata, PILTerms calldata terms ) external returns (address ipId, uint256 tokenId, uint256 licenseTermsId); @@ -134,15 +133,13 @@ interface IStoryProtocolGateway { /// @dev Caller must have the minter role for the provided SPG NFT. /// @param nftContract The address of the NFT collection. /// @param derivData The derivative data to be used for registerDerivative. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @param recipient The address to receive the minted NFT. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. function mintAndRegisterIpAndMakeDerivative( address nftContract, MakeDerivative calldata derivData, - string calldata nftMetadata, IPMetadata calldata ipMetadata, address recipient ) external returns (address ipId, uint256 tokenId); @@ -169,8 +166,7 @@ interface IStoryProtocolGateway { /// @param nftContract The address of the NFT collection. /// @param licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs. /// @param royaltyContext The context for royalty module, should be empty for Royalty Policy LAP. - /// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT. - /// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP. + /// @param ipMetadata OPTIONAL. The desired metadata for the newly minted NFT and registered IP. /// @param recipient The address to receive the minted NFT. /// @return ipId The ID of the registered IP. /// @return tokenId The ID of the minted NFT. @@ -178,7 +174,6 @@ interface IStoryProtocolGateway { address nftContract, uint256[] calldata licenseTokenIds, bytes calldata royaltyContext, - string calldata nftMetadata, IPMetadata calldata ipMetadata, address recipient ) external returns (address ipId, uint256 tokenId); diff --git a/test/StoryProtocolGateway.t.sol b/test/StoryProtocolGateway.t.sol index 52392fc..5bddf71 100644 --- a/test/StoryProtocolGateway.t.sol +++ b/test/StoryProtocolGateway.t.sol @@ -30,8 +30,6 @@ contract StoryProtocolGatewayTest is BaseTest { mapping(uint256 index => IPAsset) internal ipAsset; address internal ipIdParent; - string internal nftMetadataEmpty; - string internal nftMetadataDefault; ISPG.IPMetadata internal ipMetadataEmpty; ISPG.IPMetadata internal ipMetadataDefault; @@ -39,13 +37,16 @@ contract StoryProtocolGatewayTest is BaseTest { super.setUp(); minter = alice; - nftMetadataEmpty = ""; - nftMetadataDefault = "test-metadata"; - - ipMetadataEmpty = ISPG.IPMetadata({ metadataURI: "", metadataHash: "", nftMetadataHash: "" }); + ipMetadataEmpty = ISPG.IPMetadata({ + ipMetadataURI: "", + ipMetadataHash: "", + nftMetadataURI: "", + nftMetadataHash: "" + }); ipMetadataDefault = ISPG.IPMetadata({ - metadataURI: "test-uri", - metadataHash: "test-hash", + ipMetadataURI: "test-ip-uri", + ipMetadataHash: "test-ip-hash", + nftMetadataURI: "test-nft-uri", nftMetadataHash: "test-nft-hash" }); } @@ -86,12 +87,7 @@ contract StoryProtocolGatewayTest is BaseTest { { vm.expectRevert(Errors.SPG__CallerNotMinterRole.selector); vm.prank(caller); - spg.mintAndRegisterIp({ - nftContract: address(nftContract), - recipient: bob, - nftMetadata: nftMetadataEmpty, - ipMetadata: ipMetadataEmpty - }); + spg.mintAndRegisterIp({ nftContract: address(nftContract), recipient: bob, ipMetadata: ipMetadataEmpty }); } modifier whenCallerHasMinterRole() { @@ -107,23 +103,21 @@ contract StoryProtocolGatewayTest is BaseTest { (address ipId1, uint256 tokenId1) = spg.mintAndRegisterIp({ nftContract: address(nftContract), recipient: bob, - nftMetadata: nftMetadataEmpty, ipMetadata: ipMetadataEmpty }); assertEq(tokenId1, 1); assertTrue(ipAssetRegistry.isRegistered(ipId1)); - assertSPGNFTMetadata(tokenId1, nftMetadataEmpty); + assertSPGNFTMetadata(tokenId1, ipMetadataEmpty.nftMetadataURI); assertMetadata(ipId1, ipMetadataEmpty); (address ipId2, uint256 tokenId2) = spg.mintAndRegisterIp({ nftContract: address(nftContract), recipient: bob, - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault }); assertEq(tokenId2, 2); assertTrue(ipAssetRegistry.isRegistered(ipId2)); - assertSPGNFTMetadata(tokenId2, nftMetadataDefault); + assertSPGNFTMetadata(tokenId2, ipMetadataDefault.nftMetadataURI); assertMetadata(ipId2, ipMetadataDefault); } @@ -163,7 +157,6 @@ contract StoryProtocolGatewayTest is BaseTest { (address ipId, uint256 tokenId) = spg.mintAndRegisterIp({ nftContract: address(nftContract), recipient: owner, - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault }); ipAsset[1] = IPAsset({ ipId: payable(ipId), tokenId: tokenId, owner: owner }); @@ -221,14 +214,13 @@ contract StoryProtocolGatewayTest is BaseTest { (address ipId1, uint256 tokenId1, uint256 licenseTermsId1) = spg.mintAndRegisterIpAndAttachPILTerms({ nftContract: address(nftContract), recipient: caller, - nftMetadata: nftMetadataEmpty, ipMetadata: ipMetadataEmpty, terms: PILFlavors.nonCommercialSocialRemixing() }); assertTrue(ipAssetRegistry.isRegistered(ipId1)); assertEq(tokenId1, 1); assertEq(licenseTermsId1, 1); - assertSPGNFTMetadata(tokenId1, nftMetadataEmpty); + assertSPGNFTMetadata(tokenId1, ipMetadataEmpty.nftMetadataURI); assertMetadata(ipId1, ipMetadataEmpty); (address licenseTemplate, uint256 licenseTermsId) = licenseRegistry.getAttachedLicenseTerms(ipId1, 0); assertEq(licenseTemplate, address(pilTemplate)); @@ -237,19 +229,18 @@ contract StoryProtocolGatewayTest is BaseTest { (address ipId2, uint256 tokenId2, uint256 licenseTermsId2) = spg.mintAndRegisterIpAndAttachPILTerms({ nftContract: address(nftContract), recipient: caller, - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault, terms: PILFlavors.nonCommercialSocialRemixing() }); assertTrue(ipAssetRegistry.isRegistered(ipId2)); assertEq(tokenId2, 2); assertEq(licenseTermsId1, licenseTermsId2); - assertSPGNFTMetadata(tokenId2, nftMetadataDefault); + assertSPGNFTMetadata(tokenId2, ipMetadataDefault.nftMetadataURI); assertMetadata(ipId2, ipMetadataDefault); } function test_SPG_registerIpAndAttachPILTerms() public withCollection whenCallerHasMinterRole withEnoughTokens { - uint256 tokenId = nftContract.mint(address(caller), nftMetadataEmpty); + uint256 tokenId = nftContract.mint(address(caller), ipMetadataEmpty.nftMetadataURI); address payable ipId = payable(ipAssetRegistry.ipId(block.chainid, address(nftContract), tokenId)); uint256 deadline = block.timestamp + 1000; @@ -286,7 +277,6 @@ contract StoryProtocolGatewayTest is BaseTest { (ipIdParent, , ) = spg.mintAndRegisterIpAndAttachPILTerms({ nftContract: address(nftContract), recipient: caller, - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault, terms: PILFlavors.nonCommercialSocialRemixing() }); @@ -317,7 +307,6 @@ contract StoryProtocolGatewayTest is BaseTest { (ipIdParent, , ) = spg.mintAndRegisterIpAndAttachPILTerms({ nftContract: address(nftContract), recipient: caller, - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault, terms: PILFlavors.commercialUse({ mintingFee: 100 * 10 ** mockToken.decimals(), @@ -379,13 +368,12 @@ contract StoryProtocolGatewayTest is BaseTest { nftContract: address(nftContract), licenseTokenIds: licenseTokenIds, royaltyContext: "", - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault, recipient: caller }); assertTrue(ipAssetRegistry.isRegistered(ipIdChild)); assertEq(tokenIdChild, 2); - assertSPGNFTMetadata(tokenIdChild, nftMetadataDefault); + assertSPGNFTMetadata(tokenIdChild, ipMetadataDefault.nftMetadataURI); assertMetadata(ipIdChild, ipMetadataDefault); (address licenseTemplateChild, uint256 licenseTermsIdChild) = licenseRegistry.getAttachedLicenseTerms( ipIdChild, @@ -418,7 +406,7 @@ contract StoryProtocolGatewayTest is BaseTest { 0 ); - uint256 tokenIdChild = nftContract.mint(address(caller), nftMetadataEmpty); + uint256 tokenIdChild = nftContract.mint(address(caller), ipMetadataEmpty.nftMetadataURI); address ipIdChild = ipAssetRegistry.ipId(block.chainid, address(nftContract), tokenIdChild); uint256 deadline = block.timestamp + 1000; @@ -487,8 +475,8 @@ contract StoryProtocolGatewayTest is BaseTest { /// @dev Assert metadata for the IP. function assertMetadata(address ipId, ISPG.IPMetadata memory expectedMetadata) internal { - assertEq(coreMetadataViewModule.getMetadataURI(ipId), expectedMetadata.metadataURI); - assertEq(coreMetadataViewModule.getMetadataHash(ipId), expectedMetadata.metadataHash); + assertEq(coreMetadataViewModule.getMetadataURI(ipId), expectedMetadata.ipMetadataURI); + assertEq(coreMetadataViewModule.getMetadataHash(ipId), expectedMetadata.ipMetadataHash); assertEq(coreMetadataViewModule.getNftMetadataHash(ipId), expectedMetadata.nftMetadataHash); } @@ -521,7 +509,7 @@ contract StoryProtocolGatewayTest is BaseTest { uint256 deadline, bytes32 state, uint256 signerPk - ) internal returns (bytes memory signature, bytes32 expectedState, bytes memory data) { + ) internal view returns (bytes memory signature, bytes32 expectedState, bytes memory data) { expectedState = keccak256( abi.encode( state, // ipAccount.state() @@ -587,7 +575,6 @@ contract StoryProtocolGatewayTest is BaseTest { licenseTermsIds: licenseTermsIds, royaltyContext: "" }), - nftMetadata: nftMetadataDefault, ipMetadata: ipMetadataDefault, recipient: caller }); @@ -616,7 +603,7 @@ contract StoryProtocolGatewayTest is BaseTest { 0 ); - uint256 tokenIdChild = nftContract.mint(address(caller), nftMetadataEmpty); + uint256 tokenIdChild = nftContract.mint(address(caller), ipMetadataEmpty.nftMetadataURI); address ipIdChild = ipAssetRegistry.ipId(block.chainid, address(nftContract), tokenIdChild); uint256 deadline = block.timestamp + 1000;