Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Token attributes #264

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 100 additions & 70 deletions contracts/RMRK/extension/tokenAttributes/IERC7508.sol
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ interface IERC7508 is IERC165 {
address specificAddress
);

/**
* @notice Used to notify listeners that the metadata URI for a collection has been updated.
* @param collection Address of the collection
* @param attributesMetadataURI The new attributes metadata URI
*/
event MetadataURIUpdated(
address indexed collection,
string attributesMetadataURI
);

/**
* @notice Used to notify listeners that a new collaborator has been added or removed.
* @param collection Address of the collection
Expand Down Expand Up @@ -244,6 +254,26 @@ interface IERC7508 is IERC165 {
bool[] memory collaboratorAddressAccess
) external;

/**
* @notice Used to retrieve the attributes metadata URI for a collection, which contains all the information about the collection attributes.
* @param collection Address of the collection
* @return attributesMetadataURI The URI of the attributes metadata
*/
function getAttributesMetadataURI(
address collection
) external view returns (string memory attributesMetadataURI);

/**
* @notice Used to set the metadata URI for a collection, which contains all the information about the collection attributes.
* @dev Emits a {MetadataURIUpdated} event.
* @param collection Address of the collection
* @param attributesMetadataURI The URI of the attributes metadata
*/
function setAttributesMetadataURI(
address collection,
string memory attributesMetadataURI
) external;

/**
* @notice Used to set a number attribute.
* @dev Emits a {UintAttributeUpdated} event.
Expand Down Expand Up @@ -326,13 +356,13 @@ interface IERC7508 is IERC165 {
* string key,
* string value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param collections Addresses of the collections, in the same order as the attributes. 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 attributes. If all attributes are for the same token the array can contain a single element with the token ID.
* @param attributes An array of `StringAttribute` structs to be assigned to the given token
*/
function setStringAttributes(
address collection,
uint256 tokenId,
address[] memory collections,
uint256[] memory tokenIds,
StringAttribute[] memory attributes
) external;

Expand All @@ -343,13 +373,13 @@ interface IERC7508 is IERC165 {
* string key,
* uint value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param collections Addresses of the collections, in the same order as the attributes. 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 attributes. If all attributes are for the same token the array can contain a single element with the token ID.
* @param attributes An array of `UintAttribute` structs to be assigned to the given token
*/
function setUintAttributes(
address collection,
uint256 tokenId,
address[] memory collections,
uint256[] memory tokenIds,
UintAttribute[] memory attributes
) external;

Expand All @@ -360,13 +390,13 @@ interface IERC7508 is IERC165 {
* string key,
* bool value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param collections Addresses of the collections, in the same order as the attributes. 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 attributes. If all attributes are for the same token the array can contain a single element with the token ID.
* @param attributes An array of `BoolAttribute` structs to be assigned to the given token
*/
function setBoolAttributes(
address collection,
uint256 tokenId,
address[] memory collections,
uint256[] memory tokenIds,
BoolAttribute[] memory attributes
) external;

Expand All @@ -377,13 +407,13 @@ interface IERC7508 is IERC165 {
* string key,
* address value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param collections Addresses of the collections, in the same order as the attributes. 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 attributes. If all attributes are for the same token the array can contain a single element with the token ID.
* @param attributes An array of `AddressAttribute` structs to be assigned to the given token
*/
function setAddressAttributes(
address collection,
uint256 tokenId,
address[] memory collections,
uint256[] memory tokenIds,
AddressAttribute[] memory attributes
) external;

Expand All @@ -394,13 +424,13 @@ interface IERC7508 is IERC165 {
* string key,
* bytes value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param collections Addresses of the collections, in the same order as the attributes. 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 attributes. If all attributes are for the same token the array can contain a single element with the token ID.
* @param attributes An array of `BytesAttribute` structs to be assigned to the given token
*/
function setBytesAttributes(
address collection,
uint256 tokenId,
address[] memory collections,
uint256[] memory tokenIds,
BytesAttribute[] memory attributes
) external;

Expand Down Expand Up @@ -748,11 +778,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,
Expand All @@ -766,11 +796,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
);

/**
Expand All @@ -780,16 +810,16 @@ interface IERC7508 is IERC165 {
* string key,
* string value
* ]
* @param collection Address of the collection the token belongs to
* @param tokenId ID of the token for which the attributes are being retrieved
* @param stringKeys An array of string keys to retrieve
* @return attributes An array of `StringAttribute` structs
* @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 strings, in the same order as the attribute keys
*/
function getStringAttributes(
address collection,
uint256 tokenId,
string[] memory stringKeys
) external view returns (StringAttribute[] memory attributes);
address[] memory collections,
uint256[] memory tokenIds,
string[] memory attributeKeys
) external view returns (string[] memory attributes);

/**
* @notice Used to get multiple uint parameter values for a token.
Expand All @@ -798,16 +828,16 @@ interface IERC7508 is IERC165 {
* string key,
* uint value
* ]
* @param collection Address of the collection the token belongs to
* @param tokenId ID of the token for which the attributes are being retrieved
* @param uintKeys An array of uint keys to retrieve
* @return attributes An array of `UintAttribute` structs
* @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 uints, in the same order as the attribute keys
*/
function getUintAttributes(
address collection,
uint256 tokenId,
string[] memory uintKeys
) external view returns (UintAttribute[] memory attributes);
address[] memory collections,
uint256[] memory tokenIds,
string[] memory attributeKeys
) external view returns (uint256[] memory attributes);

/**
* @notice Used to get multiple bool parameter values for a token.
Expand All @@ -816,16 +846,16 @@ interface IERC7508 is IERC165 {
* string key,
* bool value
* ]
* @param collection Address of the collection the token belongs to
* @param tokenId ID of the token for which the attributes are being retrieved
* @param boolKeys An array of bool keys to retrieve
* @return attributes An array of `BoolAttribute` structs
* @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 bools, in the same order as the attribute keys
*/
function getBoolAttributes(
address collection,
uint256 tokenId,
string[] memory boolKeys
) external view returns (BoolAttribute[] memory attributes);
address[] memory collections,
uint256[] memory tokenIds,
string[] memory attributeKeys
) external view returns (bool[] memory attributes);

/**
* @notice Used to get multiple address parameter values for a token.
Expand All @@ -834,16 +864,16 @@ interface IERC7508 is IERC165 {
* string key,
* address value
* ]
* @param collection Address of the collection the token belongs to
* @param tokenId ID of the token for which the attributes are being retrieved
* @param addressKeys An array of address keys to retrieve
* @return attributes An array of `AddressAttribute` structs
* @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 addresses, in the same order as the attribute keys
*/
function getAddressAttributes(
address collection,
uint256 tokenId,
string[] memory addressKeys
) external view returns (AddressAttribute[] memory attributes);
address[] memory collections,
uint256[] memory tokenIds,
string[] memory attributeKeys
) external view returns (address[] memory attributes);

/**
* @notice Used to get multiple bytes parameter values for a token.
Expand All @@ -852,14 +882,14 @@ interface IERC7508 is IERC165 {
* string key,
* bytes value
* ]
* @param collection Address of the collection the token belongs to
* @param tokenId ID of the token for which the attributes are being retrieved
* @param bytesKeys An array of bytes keys to retrieve
* @return attributes An array of `BytesAttribute` structs
* @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 bytes, in the same order as the attribute keys
*/
function getBytesAttributes(
address collection,
uint256 tokenId,
string[] memory bytesKeys
) external view returns (BytesAttribute[] memory attributes);
address[] memory collections,
uint256[] memory tokenIds,
string[] memory attributeKeys
) external view returns (bytes[] memory attributes);
}
Loading
Loading