From ce9db7ef71da8458c217af00a49e6512019a2207 Mon Sep 17 00:00:00 2001 From: steven2308 Date: Mon, 4 Mar 2024 21:00:31 -0500 Subject: [PATCH] Changes on RMRKTokenAttributes. No long uses structs as return values for batch getters. If a single attribute is sent on batch getter/setters it will use it for all collections and tokens. --- .../extension/tokenAttributes/IERC7508.sol | 40 +- .../RMRKTokenAttributesRepository.sol | 341 ++++++++++-------- .../extension/tokenAttributes/IERC7508.md | 92 ++--- .../RMRKTokenAttributesRepository.md | 114 +++--- test/extensions/tokenAttributesRepository.ts | 80 +--- test/interfaces.ts | 2 +- 6 files changed, 332 insertions(+), 337 deletions(-) diff --git a/contracts/RMRK/extension/tokenAttributes/IERC7508.sol b/contracts/RMRK/extension/tokenAttributes/IERC7508.sol index c0aa8735..d709991b 100644 --- a/contracts/RMRK/extension/tokenAttributes/IERC7508.sol +++ b/contracts/RMRK/extension/tokenAttributes/IERC7508.sol @@ -748,11 +748,11 @@ interface IERC7508 is IERC165 { * @param boolKeys An array of bool type attribute keys to retrieve * @param addressKeys An array of address type attribute keys to retrieve * @param bytesKeys An array of bytes type attribute keys to retrieve - * @return stringAttributes An array of `StringAttribute` structs containing the string type attributes - * @return uintAttributes An array of `UintAttribute` structs containing the uint type attributes - * @return boolAttributes An array of `BoolAttribute` structs containing the bool type attributes - * @return addressAttributes An array of `AddressAttribute` structs containing the address type attributes - * @return bytesAttributes An array of `BytesAttribute` structs containing the bytes type attributes + * @return stringAttributes An array of strings, in the same order as the stringKeys + * @return uintAttributes An array of uints, in the same order as the uintKeys + * @return boolAttributes An array of bools, in the same order as the boolKeys + * @return addressAttributes An array of addresses, in the same order as the addressKeys + * @return bytesAttributes An array of bytes, in the same order as the bytesKeys */ function getAttributes( address collection, @@ -766,11 +766,11 @@ interface IERC7508 is IERC165 { external view returns ( - StringAttribute[] memory stringAttributes, - UintAttribute[] memory uintAttributes, - BoolAttribute[] memory boolAttributes, - AddressAttribute[] memory addressAttributes, - BytesAttribute[] memory bytesAttributes + string[] memory stringAttributes, + uint256[] memory uintAttributes, + bool[] memory boolAttributes, + address[] memory addressAttributes, + bytes[] memory bytesAttributes ); /** @@ -783,13 +783,13 @@ interface IERC7508 is IERC165 { * @param collections Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. * @param tokenIds IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. * @param attributeKeys An array of string keys to retrieve - * @return attributes An array of `StringAttribute` structs + * @return attributes An array of strings, in the same order as the attribute keys */ function getStringAttributes( address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) external view returns (StringAttribute[] memory attributes); + ) external view returns (string[] memory attributes); /** * @notice Used to get multiple uint parameter values for a token. @@ -801,13 +801,13 @@ interface IERC7508 is IERC165 { * @param collections Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. * @param tokenIds IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. * @param attributeKeys An array of uint keys to retrieve - * @return attributes An array of `UintAttribute` structs + * @return attributes An array of uints, in the same order as the attribute keys */ function getUintAttributes( address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) external view returns (UintAttribute[] memory attributes); + ) external view returns (uint256[] memory attributes); /** * @notice Used to get multiple bool parameter values for a token. @@ -819,13 +819,13 @@ interface IERC7508 is IERC165 { * @param collections Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. * @param tokenIds IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. * @param attributeKeys An array of bool keys to retrieve - * @return attributes An array of `BoolAttribute` structs + * @return attributes An array of bools, in the same order as the attribute keys */ function getBoolAttributes( address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) external view returns (BoolAttribute[] memory attributes); + ) external view returns (bool[] memory attributes); /** * @notice Used to get multiple address parameter values for a token. @@ -837,13 +837,13 @@ interface IERC7508 is IERC165 { * @param collections Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. * @param tokenIds IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. * @param attributeKeys An array of address keys to retrieve - * @return attributes An array of `AddressAttribute` structs + * @return attributes An array of addresses, in the same order as the attribute keys */ function getAddressAttributes( address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) external view returns (AddressAttribute[] memory attributes); + ) external view returns (address[] memory attributes); /** * @notice Used to get multiple bytes parameter values for a token. @@ -855,11 +855,11 @@ interface IERC7508 is IERC165 { * @param collections Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. * @param tokenIds IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. * @param attributeKeys An array of bytes keys to retrieve - * @return attributes An array of `BytesAttribute` structs + * @return attributes An array of bytes, in the same order as the attribute keys */ function getBytesAttributes( address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) external view returns (BytesAttribute[] memory attributes); + ) external view returns (bytes[] memory attributes); } diff --git a/contracts/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.sol b/contracts/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.sol index bf647086..fe3d4ab5 100644 --- a/contracts/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.sol +++ b/contracts/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.sol @@ -366,11 +366,11 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { external view returns ( - StringAttribute[] memory stringAttributes, - UintAttribute[] memory uintAttributes, - BoolAttribute[] memory boolAttributes, - AddressAttribute[] memory addressAttributes, - BytesAttribute[] memory bytesAttributes + string[] memory stringAttributes, + uint256[] memory uintAttributes, + bool[] memory boolAttributes, + address[] memory addressAttributes, + bytes[] memory bytesAttributes ) { address[] memory collections = new address[](1); @@ -400,24 +400,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) public view returns (StringAttribute[] memory attributes) { - uint256 length = attributeKeys.length; + ) public view returns (string[] memory attributes) { ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributeKeys.length + ); - attributes = new StringAttribute[](length); + attributes = new string[](loopLength); - for (uint256 i; i < length; ) { - attributes[i] = StringAttribute({ - key: attributeKeys[i], - value: getStringAttribute( - multipleCollections ? collections[i] : collections[0], - multipleTokens ? tokenIds[i] : tokenIds[0], - attributeKeys[i] - ) - }); + for (uint256 i; i < loopLength; ) { + attributes[i] = getStringAttribute( + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + multipleAttributes ? attributeKeys[i] : attributeKeys[0] + ); unchecked { ++i; } @@ -431,24 +433,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) public view returns (UintAttribute[] memory attributes) { - uint256 length = attributeKeys.length; + ) public view returns (uint256[] memory attributes) { ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributeKeys.length + ); - attributes = new UintAttribute[](length); + attributes = new uint256[](loopLength); - for (uint256 i; i < length; ) { - attributes[i] = UintAttribute({ - key: attributeKeys[i], - value: getUintAttribute( - multipleCollections ? collections[i] : collections[0], - multipleTokens ? tokenIds[i] : tokenIds[0], - attributeKeys[i] - ) - }); + for (uint256 i; i < loopLength; ) { + attributes[i] = getUintAttribute( + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + multipleAttributes ? attributeKeys[i] : attributeKeys[0] + ); unchecked { ++i; } @@ -462,24 +466,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) public view returns (BoolAttribute[] memory attributes) { - uint256 length = attributeKeys.length; + ) public view returns (bool[] memory attributes) { ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributeKeys.length + ); - attributes = new BoolAttribute[](length); + attributes = new bool[](loopLength); - for (uint256 i; i < length; ) { - attributes[i] = BoolAttribute({ - key: attributeKeys[i], - value: getBoolAttribute( - multipleCollections ? collections[i] : collections[0], - multipleTokens ? tokenIds[i] : tokenIds[0], - attributeKeys[i] - ) - }); + for (uint256 i; i < loopLength; ) { + attributes[i] = getBoolAttribute( + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + multipleAttributes ? attributeKeys[i] : attributeKeys[0] + ); unchecked { ++i; } @@ -493,24 +499,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) public view returns (AddressAttribute[] memory attributes) { - uint256 length = attributeKeys.length; + ) public view returns (address[] memory attributes) { ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributeKeys.length + ); - attributes = new AddressAttribute[](length); + attributes = new address[](loopLength); - for (uint256 i; i < length; ) { - attributes[i] = AddressAttribute({ - key: attributeKeys[i], - value: getAddressAttribute( - multipleCollections ? collections[i] : collections[0], - multipleTokens ? tokenIds[i] : tokenIds[0], - attributeKeys[i] - ) - }); + for (uint256 i; i < loopLength; ) { + attributes[i] = getAddressAttribute( + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + multipleAttributes ? attributeKeys[i] : attributeKeys[0] + ); unchecked { ++i; } @@ -524,24 +532,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, string[] memory attributeKeys - ) public view returns (BytesAttribute[] memory attributes) { - uint256 length = attributeKeys.length; + ) public view returns (bytes[] memory attributes) { ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributeKeys.length + ); - attributes = new BytesAttribute[](length); + attributes = new bytes[](loopLength); - for (uint256 i; i < length; ) { - attributes[i] = BytesAttribute({ - key: attributeKeys[i], - value: getBytesAttribute( - multipleCollections ? collections[i] : collections[0], - multipleTokens ? tokenIds[i] : tokenIds[0], - attributeKeys[i] - ) - }); + for (uint256 i; i < loopLength; ) { + attributes[i] = getBytesAttribute( + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + multipleAttributes ? attributeKeys[i] : attributeKeys[0] + ); unchecked { ++i; } @@ -731,22 +741,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { uint256[] memory tokenIds, BoolAttribute[] memory attributes ) external { - uint256 length = attributes.length; ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); - for (uint256 i = 0; i < length; ) { - address collection = multipleCollections - ? collections[i] - : collections[0]; - uint256 tokenId = multipleTokens ? tokenIds[i] : tokenIds[0]; + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributes.length + ); + for (uint256 i; i < loopLength; ) { + BoolAttribute memory attribute = multipleAttributes + ? attributes[i] + : attributes[0]; _setBoolAttribute( _msgSender(), - collection, - tokenId, - attributes[i].key, - attributes[i].value + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + attribute.key, + attribute.value ); unchecked { ++i; @@ -762,22 +776,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { uint256[] memory tokenIds, BytesAttribute[] memory attributes ) external { - uint256 length = attributes.length; ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); - for (uint256 i = 0; i < length; ) { - address collection = multipleCollections - ? collections[i] - : collections[0]; - uint256 tokenId = multipleTokens ? tokenIds[i] : tokenIds[0]; + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributes.length + ); + for (uint256 i; i < loopLength; ) { + BytesAttribute memory attribute = multipleAttributes + ? attributes[i] + : attributes[0]; _setBytesAttribute( _msgSender(), - collection, - tokenId, - attributes[i].key, - attributes[i].value + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + attribute.key, + attribute.value ); unchecked { ++i; @@ -793,22 +811,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { uint256[] memory tokenIds, StringAttribute[] memory attributes ) external { - uint256 length = attributes.length; ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); - for (uint256 i = 0; i < length; ) { - address collection = multipleCollections - ? collections[i] - : collections[0]; - uint256 tokenId = multipleTokens ? tokenIds[i] : tokenIds[0]; + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributes.length + ); + for (uint256 i; i < loopLength; ) { + StringAttribute memory attribute = multipleAttributes + ? attributes[i] + : attributes[0]; _setStringAttribute( _msgSender(), - collection, - tokenId, - attributes[i].key, - attributes[i].value + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + attribute.key, + attribute.value ); unchecked { ++i; @@ -824,22 +846,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { uint256[] memory tokenIds, UintAttribute[] memory attributes ) external { - uint256 length = attributes.length; ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); - for (uint256 i = 0; i < length; ) { - address collection = multipleCollections - ? collections[i] - : collections[0]; - uint256 tokenId = multipleTokens ? tokenIds[i] : tokenIds[0]; + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributes.length + ); + for (uint256 i; i < loopLength; ) { + UintAttribute memory attribute = multipleAttributes + ? attributes[i] + : attributes[0]; _setUintAttribute( _msgSender(), - collection, - tokenId, - attributes[i].key, - attributes[i].value + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + attribute.key, + attribute.value ); unchecked { ++i; @@ -855,22 +881,26 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { uint256[] memory tokenIds, AddressAttribute[] memory attributes ) external { - uint256 length = attributes.length; ( bool multipleCollections, - bool multipleTokens - ) = _checkIfMultipleCollectionsAndTokens(collections, tokenIds, length); - for (uint256 i = 0; i < length; ) { - address collection = multipleCollections - ? collections[i] - : collections[0]; - uint256 tokenId = multipleTokens ? tokenIds[i] : tokenIds[0]; + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) = _checkIfMultipleCollectionsAndTokens( + collections, + tokenIds, + attributes.length + ); + for (uint256 i; i < loopLength; ) { + AddressAttribute memory attribute = multipleAttributes + ? attributes[i] + : attributes[0]; _setAddressAttribute( _msgSender(), - collection, - tokenId, - attributes[i].key, - attributes[i].value + multipleCollections ? collections[i] : collections[0], + multipleTokens ? tokenIds[i] : tokenIds[0], + attribute.key, + attribute.value ); unchecked { ++i; @@ -891,7 +921,7 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { BytesAttribute[] memory bytesAttributes ) external { uint256 length = stringAttributes.length; - for (uint256 i = 0; i < length; ) { + for (uint256 i; i < length; ) { _setStringAttribute( _msgSender(), collection, @@ -905,7 +935,7 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { } length = uintAttributes.length; - for (uint256 i = 0; i < length; ) { + for (uint256 i; i < length; ) { _setUintAttribute( _msgSender(), collection, @@ -919,7 +949,7 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { } length = boolAttributes.length; - for (uint256 i = 0; i < length; ) { + for (uint256 i; i < length; ) { _setBoolAttribute( _msgSender(), collection, @@ -933,7 +963,7 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { } length = addressAttributes.length; - for (uint256 i = 0; i < length; ) { + for (uint256 i; i < length; ) { _setAddressAttribute( _msgSender(), collection, @@ -947,7 +977,7 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { } length = bytesAttributes.length; - for (uint256 i = 0; i < length; ) { + for (uint256 i; i < length; ) { _setBytesAttribute( _msgSender(), collection, @@ -965,15 +995,40 @@ contract RMRKTokenAttributesRepository is IERC7508, Context { address[] memory collections, uint256[] memory tokenIds, uint256 attributesLength - ) internal pure returns (bool multipleCollections, bool multipleTokens) { + ) + internal + pure + returns ( + bool multipleCollections, + bool multipleTokens, + bool multipleAttributes, + uint256 loopLength + ) + { multipleCollections = collections.length != 1; multipleTokens = tokenIds.length != 1; + multipleAttributes = attributesLength != 1; if ( - (multipleCollections && collections.length != attributesLength) || - (multipleTokens && tokenIds.length != attributesLength) + (multipleCollections && + multipleAttributes && + collections.length != attributesLength) || + (multipleTokens && + multipleAttributes && + tokenIds.length != attributesLength) || + (multipleCollections && + multipleTokens && + collections.length != tokenIds.length) ) { revert LengthsMismatch(); } + + if (multipleCollections) { + loopLength = collections.length; + } else if (multipleTokens) { + loopLength = tokenIds.length; + } else { + loopLength = attributesLength; + } } function _setBoolAttribute( diff --git a/docs/RMRK/extension/tokenAttributes/IERC7508.md b/docs/RMRK/extension/tokenAttributes/IERC7508.md index 32f8100e..df3e0435 100644 --- a/docs/RMRK/extension/tokenAttributes/IERC7508.md +++ b/docs/RMRK/extension/tokenAttributes/IERC7508.md @@ -37,7 +37,7 @@ Used to retrieve the address type token attributes. ### getAddressAttributes ```solidity -function getAddressAttributes(address collection, uint256 tokenId, string[] addressKeys) external view returns (struct IERC7508.AddressAttribute[] attributes) +function getAddressAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (address[] attributes) ``` Used to get multiple address parameter values for a token. @@ -48,20 +48,20 @@ Used to get multiple address parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| addressKeys | string[] | An array of address keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of address keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.AddressAttribute[] | An array of `AddressAttribute` structs | +| attributes | address[] | An array of addresses, in the same order as the attribute keys | ### getAttributes ```solidity -function getAttributes(address collection, uint256 tokenId, string[] stringKeys, string[] uintKeys, string[] boolKeys, string[] addressKeys, string[] bytesKeys) external view returns (struct IERC7508.StringAttribute[] stringAttributes, struct IERC7508.UintAttribute[] uintAttributes, struct IERC7508.BoolAttribute[] boolAttributes, struct IERC7508.AddressAttribute[] addressAttributes, struct IERC7508.BytesAttribute[] bytesAttributes) +function getAttributes(address collection, uint256 tokenId, string[] stringKeys, string[] uintKeys, string[] boolKeys, string[] addressKeys, string[] bytesKeys) external view returns (string[] stringAttributes, uint256[] uintAttributes, bool[] boolAttributes, address[] addressAttributes, bytes[] bytesAttributes) ``` Used to retrieve multiple token attributes of any type at once. @@ -84,11 +84,11 @@ Used to retrieve multiple token attributes of any type at once. | Name | Type | Description | |---|---|---| -| stringAttributes | IERC7508.StringAttribute[] | An array of `StringAttribute` structs containing the string type attributes | -| uintAttributes | IERC7508.UintAttribute[] | An array of `UintAttribute` structs containing the uint type attributes | -| boolAttributes | IERC7508.BoolAttribute[] | An array of `BoolAttribute` structs containing the bool type attributes | -| addressAttributes | IERC7508.AddressAttribute[] | An array of `AddressAttribute` structs containing the address type attributes | -| bytesAttributes | IERC7508.BytesAttribute[] | An array of `BytesAttribute` structs containing the bytes type attributes | +| stringAttributes | string[] | An array of strings, in the same order as the stringKeys | +| uintAttributes | uint256[] | An array of uints, in the same order as the uintKeys | +| boolAttributes | bool[] | An array of bools, in the same order as the boolKeys | +| addressAttributes | address[] | An array of addresses, in the same order as the addressKeys | +| bytesAttributes | bytes[] | An array of bytes, in the same order as the bytesKeys | ### getBoolAttribute @@ -117,7 +117,7 @@ Used to retrieve the bool type token attributes. ### getBoolAttributes ```solidity -function getBoolAttributes(address collection, uint256 tokenId, string[] boolKeys) external view returns (struct IERC7508.BoolAttribute[] attributes) +function getBoolAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (bool[] attributes) ``` Used to get multiple bool parameter values for a token. @@ -128,15 +128,15 @@ Used to get multiple bool parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| boolKeys | string[] | An array of bool keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of bool keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.BoolAttribute[] | An array of `BoolAttribute` structs | +| attributes | bool[] | An array of bools, in the same order as the attribute keys | ### getBytesAttribute @@ -165,7 +165,7 @@ Used to retrieve the bytes type token attributes. ### getBytesAttributes ```solidity -function getBytesAttributes(address collection, uint256 tokenId, string[] bytesKeys) external view returns (struct IERC7508.BytesAttribute[] attributes) +function getBytesAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (bytes[] attributes) ``` Used to get multiple bytes parameter values for a token. @@ -176,15 +176,15 @@ Used to get multiple bytes parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| bytesKeys | string[] | An array of bytes keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of bytes keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.BytesAttribute[] | An array of `BytesAttribute` structs | +| attributes | bytes[] | An array of bytes, in the same order as the attribute keys | ### getStringAttribute @@ -213,7 +213,7 @@ Used to retrieve the string type token attributes. ### getStringAttributes ```solidity -function getStringAttributes(address collection, uint256 tokenId, string[] stringKeys) external view returns (struct IERC7508.StringAttribute[] attributes) +function getStringAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (string[] attributes) ``` Used to get multiple sting parameter values for a token. @@ -224,15 +224,15 @@ Used to get multiple sting parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| stringKeys | string[] | An array of string keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of string keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.StringAttribute[] | An array of `StringAttribute` structs | +| attributes | string[] | An array of strings, in the same order as the attribute keys | ### getUintAttribute @@ -261,7 +261,7 @@ Used to retrieve the uint type token attributes. ### getUintAttributes ```solidity -function getUintAttributes(address collection, uint256 tokenId, string[] uintKeys) external view returns (struct IERC7508.UintAttribute[] attributes) +function getUintAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (uint256[] attributes) ``` Used to get multiple uint parameter values for a token. @@ -272,15 +272,15 @@ Used to get multiple uint parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| uintKeys | string[] | An array of uint keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of uint keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.UintAttribute[] | An array of `UintAttribute` structs | +| attributes | uint256[] | An array of uints, in the same order as the attribute keys | ### isCollaborator @@ -656,7 +656,7 @@ Used to set an address attribute. ### setAddressAttributes ```solidity -function setAddressAttributes(address collection, uint256 tokenId, IERC7508.AddressAttribute[] attributes) external nonpayable +function setAddressAttributes(address[] collections, uint256[] tokenIds, IERC7508.AddressAttribute[] attributes) external nonpayable ``` @@ -667,8 +667,8 @@ function setAddressAttributes(address collection, uint256 tokenId, IERC7508.Addr | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.AddressAttribute[] | undefined | ### setAttributes @@ -715,7 +715,7 @@ Used to set a boolean attribute. ### setBoolAttributes ```solidity -function setBoolAttributes(address collection, uint256 tokenId, IERC7508.BoolAttribute[] attributes) external nonpayable +function setBoolAttributes(address[] collections, uint256[] tokenIds, IERC7508.BoolAttribute[] attributes) external nonpayable ``` @@ -726,8 +726,8 @@ function setBoolAttributes(address collection, uint256 tokenId, IERC7508.BoolAtt | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.BoolAttribute[] | undefined | ### setBytesAttribute @@ -752,7 +752,7 @@ Used to set an bytes attribute. ### setBytesAttributes ```solidity -function setBytesAttributes(address collection, uint256 tokenId, IERC7508.BytesAttribute[] attributes) external nonpayable +function setBytesAttributes(address[] collections, uint256[] tokenIds, IERC7508.BytesAttribute[] attributes) external nonpayable ``` @@ -763,8 +763,8 @@ function setBytesAttributes(address collection, uint256 tokenId, IERC7508.BytesA | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.BytesAttribute[] | undefined | ### setStringAttribute @@ -789,7 +789,7 @@ Used to set a string attribute. ### setStringAttributes ```solidity -function setStringAttributes(address collection, uint256 tokenId, IERC7508.StringAttribute[] attributes) external nonpayable +function setStringAttributes(address[] collections, uint256[] tokenIds, IERC7508.StringAttribute[] attributes) external nonpayable ``` @@ -800,8 +800,8 @@ function setStringAttributes(address collection, uint256 tokenId, IERC7508.Strin | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.StringAttribute[] | undefined | ### setUintAttribute @@ -826,7 +826,7 @@ Used to set a number attribute. ### setUintAttributes ```solidity -function setUintAttributes(address collection, uint256 tokenId, IERC7508.UintAttribute[] attributes) external nonpayable +function setUintAttributes(address[] collections, uint256[] tokenIds, IERC7508.UintAttribute[] attributes) external nonpayable ``` @@ -837,8 +837,8 @@ function setUintAttributes(address collection, uint256 tokenId, IERC7508.UintAtt | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.UintAttribute[] | undefined | ### supportsInterface diff --git a/docs/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.md b/docs/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.md index 2b05a4d1..884f3cac 100644 --- a/docs/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.md +++ b/docs/RMRK/extension/tokenAttributes/RMRKTokenAttributesRepository.md @@ -139,7 +139,7 @@ Used to retrieve the address type token attributes. ### getAddressAttributes ```solidity -function getAddressAttributes(address collection, uint256 tokenId, string[] addressKeys) external view returns (struct IERC7508.AddressAttribute[] attributes) +function getAddressAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (address[] attributes) ``` Used to get multiple address parameter values for a token. @@ -150,20 +150,20 @@ Used to get multiple address parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| addressKeys | string[] | An array of address keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of address keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.AddressAttribute[] | An array of `AddressAttribute` structs | +| attributes | address[] | An array of addresses, in the same order as the attribute keys | ### getAttributes ```solidity -function getAttributes(address collection, uint256 tokenId, string[] stringKeys, string[] uintKeys, string[] boolKeys, string[] addressKeys, string[] bytesKeys) external view returns (struct IERC7508.StringAttribute[] stringAttributes, struct IERC7508.UintAttribute[] uintAttributes, struct IERC7508.BoolAttribute[] boolAttributes, struct IERC7508.AddressAttribute[] addressAttributes, struct IERC7508.BytesAttribute[] bytesAttributes) +function getAttributes(address collection, uint256 tokenId, string[] stringKeys, string[] uintKeys, string[] boolKeys, string[] addressKeys, string[] bytesKeys) external view returns (string[] stringAttributes, uint256[] uintAttributes, bool[] boolAttributes, address[] addressAttributes, bytes[] bytesAttributes) ``` Used to retrieve multiple token attributes of any type at once. @@ -186,11 +186,11 @@ Used to retrieve multiple token attributes of any type at once. | Name | Type | Description | |---|---|---| -| stringAttributes | IERC7508.StringAttribute[] | An array of `StringAttribute` structs containing the string type attributes | -| uintAttributes | IERC7508.UintAttribute[] | An array of `UintAttribute` structs containing the uint type attributes | -| boolAttributes | IERC7508.BoolAttribute[] | An array of `BoolAttribute` structs containing the bool type attributes | -| addressAttributes | IERC7508.AddressAttribute[] | An array of `AddressAttribute` structs containing the address type attributes | -| bytesAttributes | IERC7508.BytesAttribute[] | An array of `BytesAttribute` structs containing the bytes type attributes | +| stringAttributes | string[] | An array of strings, in the same order as the stringKeys | +| uintAttributes | uint256[] | An array of uints, in the same order as the uintKeys | +| boolAttributes | bool[] | An array of bools, in the same order as the boolKeys | +| addressAttributes | address[] | An array of addresses, in the same order as the addressKeys | +| bytesAttributes | bytes[] | An array of bytes, in the same order as the bytesKeys | ### getBoolAttribute @@ -219,7 +219,7 @@ Used to retrieve the bool type token attributes. ### getBoolAttributes ```solidity -function getBoolAttributes(address collection, uint256 tokenId, string[] boolKeys) external view returns (struct IERC7508.BoolAttribute[] attributes) +function getBoolAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (bool[] attributes) ``` Used to get multiple bool parameter values for a token. @@ -230,15 +230,15 @@ Used to get multiple bool parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| boolKeys | string[] | An array of bool keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of bool keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.BoolAttribute[] | An array of `BoolAttribute` structs | +| attributes | bool[] | An array of bools, in the same order as the attribute keys | ### getBytesAttribute @@ -267,7 +267,7 @@ Used to retrieve the bytes type token attributes. ### getBytesAttributes ```solidity -function getBytesAttributes(address collection, uint256 tokenId, string[] bytesKeys) external view returns (struct IERC7508.BytesAttribute[] attributes) +function getBytesAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (bytes[] attributes) ``` Used to get multiple bytes parameter values for a token. @@ -278,15 +278,15 @@ Used to get multiple bytes parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| bytesKeys | string[] | An array of bytes keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of bytes keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.BytesAttribute[] | An array of `BytesAttribute` structs | +| attributes | bytes[] | An array of bytes, in the same order as the attribute keys | ### getStringAttribute @@ -315,7 +315,7 @@ Used to retrieve the string type token attributes. ### getStringAttributes ```solidity -function getStringAttributes(address collection, uint256 tokenId, string[] stringKeys) external view returns (struct IERC7508.StringAttribute[] attributes) +function getStringAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (string[] attributes) ``` Used to get multiple sting parameter values for a token. @@ -326,15 +326,15 @@ Used to get multiple sting parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| stringKeys | string[] | An array of string keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of string keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.StringAttribute[] | An array of `StringAttribute` structs | +| attributes | string[] | An array of strings, in the same order as the attribute keys | ### getUintAttribute @@ -363,7 +363,7 @@ Used to retrieve the uint type token attributes. ### getUintAttributes ```solidity -function getUintAttributes(address collection, uint256 tokenId, string[] uintKeys) external view returns (struct IERC7508.UintAttribute[] attributes) +function getUintAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (uint256[] attributes) ``` Used to get multiple uint parameter values for a token. @@ -374,15 +374,15 @@ Used to get multiple uint parameter values for a token. | Name | Type | Description | |---|---|---| -| collection | address | Address of the collection the token belongs to | -| tokenId | uint256 | ID of the token for which the attributes are being retrieved | -| uintKeys | string[] | An array of uint keys to retrieve | +| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. | +| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. | +| attributeKeys | string[] | An array of uint keys to retrieve | #### Returns | Name | Type | Description | |---|---|---| -| attributes | IERC7508.UintAttribute[] | An array of `UintAttribute` structs | +| attributes | uint256[] | An array of uints, in the same order as the attribute keys | ### isCollaborator @@ -758,7 +758,7 @@ Used to set an address attribute. ### setAddressAttributes ```solidity -function setAddressAttributes(address collection, uint256 tokenId, IERC7508.AddressAttribute[] attributes) external nonpayable +function setAddressAttributes(address[] collections, uint256[] tokenIds, IERC7508.AddressAttribute[] attributes) external nonpayable ``` @@ -769,8 +769,8 @@ function setAddressAttributes(address collection, uint256 tokenId, IERC7508.Addr | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.AddressAttribute[] | undefined | ### setAttributes @@ -817,7 +817,7 @@ Used to set a boolean attribute. ### setBoolAttributes ```solidity -function setBoolAttributes(address collection, uint256 tokenId, IERC7508.BoolAttribute[] attributes) external nonpayable +function setBoolAttributes(address[] collections, uint256[] tokenIds, IERC7508.BoolAttribute[] attributes) external nonpayable ``` @@ -828,8 +828,8 @@ function setBoolAttributes(address collection, uint256 tokenId, IERC7508.BoolAtt | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.BoolAttribute[] | undefined | ### setBytesAttribute @@ -854,7 +854,7 @@ Used to set an bytes attribute. ### setBytesAttributes ```solidity -function setBytesAttributes(address collection, uint256 tokenId, IERC7508.BytesAttribute[] attributes) external nonpayable +function setBytesAttributes(address[] collections, uint256[] tokenIds, IERC7508.BytesAttribute[] attributes) external nonpayable ``` @@ -865,8 +865,8 @@ function setBytesAttributes(address collection, uint256 tokenId, IERC7508.BytesA | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.BytesAttribute[] | undefined | ### setStringAttribute @@ -891,7 +891,7 @@ Used to set a string attribute. ### setStringAttributes ```solidity -function setStringAttributes(address collection, uint256 tokenId, IERC7508.StringAttribute[] attributes) external nonpayable +function setStringAttributes(address[] collections, uint256[] tokenIds, IERC7508.StringAttribute[] attributes) external nonpayable ``` @@ -902,8 +902,8 @@ function setStringAttributes(address collection, uint256 tokenId, IERC7508.Strin | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.StringAttribute[] | undefined | ### setUintAttribute @@ -928,7 +928,7 @@ Used to set a number attribute. ### setUintAttributes ```solidity -function setUintAttributes(address collection, uint256 tokenId, IERC7508.UintAttribute[] attributes) external nonpayable +function setUintAttributes(address[] collections, uint256[] tokenIds, IERC7508.UintAttribute[] attributes) external nonpayable ``` @@ -939,8 +939,8 @@ function setUintAttributes(address collection, uint256 tokenId, IERC7508.UintAtt | Name | Type | Description | |---|---|---| -| collection | address | undefined | -| tokenId | uint256 | undefined | +| collections | address[] | undefined | +| tokenIds | uint256[] | undefined | | attributes | IERC7508.UintAttribute[] | undefined | ### supportsInterface @@ -1135,17 +1135,6 @@ Used to signal that the collaborator and collaborator rights array are not of eq -### CollectionAlreadyRegistered - -```solidity -error CollectionAlreadyRegistered() -``` - -Used to signal that the collection is already registered in the repository. - - - - ### CollectionNotRegistered ```solidity @@ -1179,6 +1168,17 @@ Used to signal that the presigned message's signature is invalid. +### LengthsMismatch + +```solidity +error LengthsMismatch() +``` + +Used to signal that the length of the arrays is not equal. + + + + ### NotCollectionCollaborator ```solidity diff --git a/test/extensions/tokenAttributesRepository.ts b/test/extensions/tokenAttributesRepository.ts index 76f89c74..53c7c4d9 100644 --- a/test/extensions/tokenAttributesRepository.ts +++ b/test/extensions/tokenAttributesRepository.ts @@ -437,26 +437,11 @@ describe('RMRKTokenAttributesRepository', async function () { ['bytes1', 'bytes2'], ), ).to.eql([ - [ - ['string1', 'value1'], - ['string2', 'value2'], - ], - [ - ['uint1', 1n], - ['uint2', 2n], - ], - [ - ['bool1', true], - ['bool2', false], - ], - [ - ['address1', tokenOwner.address], - ['address2', await collectionOwner.getAddress()], - ], - [ - ['bytes1', '0x1234'], - ['bytes2', '0x5678'], - ], + ['value1', 'value2'], + [1n, 2n], + [true, false], + [tokenOwner.address, await collectionOwner.getAddress()], + ['0x1234', '0x5678'], ]); }); @@ -486,16 +471,7 @@ describe('RMRKTokenAttributesRepository', async function () { [], [], ), - ).to.eql([ - [ - ['string1', 'value1'], - ['string2', 'value2'], - ], - [], - [], - [], - [], - ]); + ).to.eql([['value1', 'value2'], [], [], [], []]); }); it('can set multiple uint attributes at the same time', async function () { @@ -524,16 +500,7 @@ describe('RMRKTokenAttributesRepository', async function () { [], [], ), - ).to.eql([ - [], - [ - ['uint1', 1n], - ['uint2', 2n], - ], - [], - [], - [], - ]); + ).to.eql([[], [1n, 2n], [], [], []]); }); it('can set multiple bool attributes at the same time', async function () { @@ -562,16 +529,7 @@ describe('RMRKTokenAttributesRepository', async function () { [], [], ), - ).to.eql([ - [], - [], - [ - ['bool1', true], - ['bool2', false], - ], - [], - [], - ]); + ).to.eql([[], [], [true, false], [], []]); }); it('can set multiple address attributes at the same time', async function () { @@ -600,16 +558,7 @@ describe('RMRKTokenAttributesRepository', async function () { ['address1', 'address2'], [], ), - ).to.eql([ - [], - [], - [], - [ - ['address1', tokenOwner.address], - ['address2', await collectionOwner.getAddress()], - ], - [], - ]); + ).to.eql([[], [], [], [tokenOwner.address, await collectionOwner.getAddress()], []]); }); it('can set multiple bytes attributes at the same time', async function () { @@ -638,16 +587,7 @@ describe('RMRKTokenAttributesRepository', async function () { [], ['bytes1', 'bytes2'], ), - ).to.eql([ - [], - [], - [], - [], - [ - ['bytes1', '0x1234'], - ['bytes2', '0x5678'], - ], - ]); + ).to.eql([[], [], [], [], ['0x1234', '0x5678']]); }); it('can reuse keys and values are fine', async function () { diff --git a/test/interfaces.ts b/test/interfaces.ts index 1db845b6..dd0aaf6e 100644 --- a/test/interfaces.ts +++ b/test/interfaces.ts @@ -7,7 +7,7 @@ export const IERC6220 = '0x28bc9ae4'; // Equippable and Composable export const IERC6454 = '0x91a6262f'; // Soulbound export const IERC7401 = '0x42b0e56f'; // Nestable export const IERC7409 = '0x1b3327ab'; // Emotes Repository -export const IERC7508 = '0x29b20880'; // Attributes Repository +export const IERC7508 = '0x9f89917b'; // Attributes Repository export const IERC7590 = '0x6f87c75c'; // ERC20 Token Holder export const IOtherInterface = '0xffffffff'; export const IRMRKCatalog = '0xd912401f'; // ERC6220