Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC7508, which proposes a mechanism for associating and managing various attributes with NFTs.
The following explanation translates, summarizes, and supplements the material linked below.
As of September 22, 2023, 7508 was in the Draft stage.
Overview
This proposal concerns tokens using two different token standards, ERC721 and ERC1155, typically representing digital assets or game items. These tokens can have different attributes for each individual token, such as the artist's name, production date, or rarity.
The proposal provides a way to store these attributes on the blockchain and make them accessible to external programs such as other smart contracts. There is a dedicated location for storing these attributes, The Public On-Chain Non-Fungible Token Attributes Repository, which is accessible at the same address across all networks. This allows the same information to be accessed across networks.
The repository smart contract is provided as a shared resource and is intended for use by projects and developers with tokens conforming to ERC721 or ERC1155.
People with different projects and tokens can use the same repository to manage attributes. This provides a common platform for efficiently managing token attributes on the blockchain and integrating with other smart contracts.
Motivation
NFTs (non-fungible tokens) are widely used in the Ethereum ecosystem for various purposes, including digital assets and game items. However, these NFTs need to offer more utility. This ERC (Ethereum proposal standard) standardizes new functionality for NFTs to enable the following capabilities.
Cross-collection interactivity
This feature makes it easy for tokens to interact across different NFT collections. An NFT can be moved to another NFT collection or integrated with other NFTs. This makes NFT exchange and use more flexible.
Perpetual storage of attributes
Token attributes are stored persistently on the blockchain. This preserves the token's history and value without losing its attributes. Attributes remain accessible at any time.
Token evolution
NFTs can evolve over time and acquire new features and attributes. This makes NFTs more engaging and creates new possibilities for communities and projects.
Dynamic state tracking
This feature enables real-time tracking and updating of NFT state. It allows effective monitoring of a token's current state and strengthens integration with smart contracts. This is particularly useful for in-game items.
This ERC improves NFT utility, strengthens interactions across NFT collections, ensures persistent storage of attributes, and enables token evolution and dynamic state tracking. As a result, NFTs can be used across more industries and projects and become more valuable digital assets.
Cross-Collection Interactivity
Storing attributes on-chain in a consistent format allows external smart contracts to use a token's attributes without the token needing to know that those external contracts exist. For example, if a token represents a game character, its attributes can be reused as the same character statistics in another game without retrieving them again from an off-chain source. This allows attributes to be shared across games while preventing unauthorized changes and maintaining reliability.
Perpetual Store of Attributes
Standardizing and storing attributes on the blockchain allows them to be retained indefinitely. With off-chain attribute storage, the information is available only as long as the off-chain storage remains available. With on-chain storage, however, attributes remain accessible for as long as the blockchain exists. This helps preserve the token's value over time and ensures that its attributes persist alongside the token itself.
Token Evolution
Storing token attributes on the blockchain allows tokens to evolve over time. The owner's actions may change the attributes. Because attributes are stored on-chain, smart contracts can modify them when specified conditions are met. This makes tokens more interactive and allows them to reflect the owner's participation and effort.
Dynamic State Tracking
Storing token attributes on the blockchain allows the state of a token and its owner to be tracked in real time. This makes tokens useful for various applications. For example, in a supply chain, a token may represent a product whose attributes track statuses such as pending, shipped, and delivered. This is particularly useful for areas such as logistics management.
These capabilities help increase the value of NFTs and open new possibilities across industries and projects. Storing attributes on the blockchain ensures data reliability and transparency and substantially improves NFT utility.
Specification
/// @title ERC-7508 Public On-Chain NFT Attributes Repository
/// @dev See https://eips.ethereum.org/EIPS/eip-7508
/// @dev Note: the ERC-165 identifier for this interface is 0x07cd44c7.
pragma solidity ^0.8.21;
interface IRMRKTokenAttributesRepository /*is IERC165*/ {
/**
* @notice A list of supported access types.
* @return The `Issuer` type, where only the issuer can manage the parameter.
* @return The `Collaborator` type, where only the collaborators can manage the parameter.
* @return The `IssuerOrCollaborator` type, where only the issuer or collaborators can manage the parameter.
* @return The `TokenOwner` type, where only the token owner can manage the parameters of their tokens.
* @return The `SpecificAddress` type, where only specific addresses can manage the parameter.
*/
enum AccessType {
Issuer,
Collaborator,
IssuerOrCollaborator,
TokenOwner,
SpecificAddress
}
/**
* @notice Structure used to represent a string attribute.
* @return key The key of the attribute
* @return value The value of the attribute
*/
struct StringAttribute {
string key;
string value;
}
/**
* @notice Structure used to represent an uint attribute.
* @return key The key of the attribute
* @return value The value of the attribute
*/
struct UintAttribute {
string key;
uint256 value;
}
/**
* @notice Structure used to represent a boolean attribute.
* @return key The key of the attribute
* @return value The value of the attribute
*/
struct BoolAttribute {
string key;
bool value;
}
/**
* @notice Structure used to represent an address attribute.
* @return key The key of the attribute
* @return value The value of the attribute
*/
struct AddressAttribute {
string key;
address value;
}
/**
* @notice Structure used to represent a bytes attribute.
* @return key The key of the attribute
* @return value The value of the attribute
*/
struct BytesAttribute {
string key;
bytes value;
}
/**
* @notice Used to notify listeners that a new collection has been registered to use the repository.
* @param collection Address of the collection
* @param issuer Address of the issuer of the collection; the addess authorized to manage the access control
* @param registeringAddress Address that registered the collection
* @param useOwnable A boolean value indicating whether the collection uses the Ownable extension to verify the
* issuer (`true`) or not (`false`)
*/
event AccessControlRegistration(
address indexed collection,
address indexed issuer,
address indexed registeringAddress,
bool useOwnable
);
/**
* @notice Used to notify listeners that the access control settings for a specific parameter have been updated.
* @param collection Address of the collection
* @param key The name of the parameter for which the access control settings have been updated
* @param accessType The AccessType of the parameter for which the access control settings have been updated
* @param specificAddress The specific addresses that has been updated
*/
event AccessControlUpdate(
address indexed collection,
string key,
AccessType accessType,
address specificAddress
);
/**
* @notice Used to notify listeners that a new collaborator has been added or removed.
* @param collection Address of the collection
* @param collaborator Address of the collaborator
* @param isCollaborator A boolean value indicating whether the collaborator has been added (`true`) or removed
* (`false`)
*/
event CollaboratorUpdate(
address indexed collection,
address indexed collaborator,
bool isCollaborator
);
/**
* @notice Used to notify listeners that a string attribute has been updated.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @param value The new value of the attribute
*/
event StringAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
string value
);
/**
* @notice Used to notify listeners that an uint attribute has been updated.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @param value The new value of the attribute
*/
event UintAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
uint256 value
);
/**
* @notice Used to notify listeners that a boolean attribute has been updated.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @param value The new value of the attribute
*/
event BoolAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
bool value
);
/**
* @notice Used to notify listeners that an address attribute has been updated.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @param value The new value of the attribute
*/
event AddressAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
address value
);
/**
* @notice Used to notify listeners that a bytes attribute has been updated.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @param value The new value of the attribute
*/
event BytesAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
bytes value
);
/**
* @notice Used to register a collection to use the RMRK token attributes repository.
* @dev If the collection does not implement the Ownable interface, the `useOwnable` value must be set to `false`.
* @dev Emits an {AccessControlRegistration} event.
* @param collection The address of the collection that will use the RMRK token attributes repository.
* @param issuer The address of the issuer of the collection.
* @param useOwnable The boolean value to indicate if the collection implements the Ownable interface and whether it
* should be used to validate that the caller is the issuer (`true`) or to use the manually set issuer address
* (`false`).
*/
function registerAccessControl(
address collection,
address issuer,
bool useOwnable
) external;
/**
* @notice Used to manage the access control settings for a specific parameter.
* @dev Only the `issuer` of the collection can call this function.
* @dev The possible `accessType` values are:
* [
* Issuer,
* Collaborator,
* IssuerOrCollaborator,
* TokenOwner,
* SpecificAddress,
* ]
* @dev Emits an {AccessControlUpdated} event.
* @param collection The address of the collection being managed.
* @param key The key of the attribute
* @param accessType The type of access control to be applied to the parameter.
* @param specificAddress The address to be added as a specific addresses allowed to manage the given
* parameter.
*/
function manageAccessControl(
address collection,
string memory key,
AccessType accessType,
address specificAddress
) external;
/**
* @notice Used to manage the collaborators of a collection.
* @dev The `collaboratorAddresses` and `collaboratorAddressAccess` arrays must be of the same length.
* @dev Emits a {CollaboratorUpdate} event.
* @param collection The address of the collection
* @param collaboratorAddresses The array of collaborator addresses being managed
* @param collaboratorAddressAccess The array of boolean values indicating if the collaborator address should
* receive the permission (`true`) or not (`false`).
*/
function manageCollaborators(
address collection,
address[] memory collaboratorAddresses,
bool[] memory collaboratorAddressAccess
) external;
/**
* @notice Used to set a number attribute.
* @dev Emits a {UintAttributeUpdated} event.
* @param collection Address of the collection receiving the attribute
* @param tokenId The token ID
* @param key The attribute key
* @param value The attribute value
*/
function setUintAttribute(
address collection,
uint256 tokenId,
string memory key,
uint256 value
) external;
/**
* @notice Used to set a string attribute.
* @dev Emits a {StringAttributeUpdated} event.
* @param collection Address of the collection receiving the attribute
* @param tokenId The token ID
* @param key The attribute key
* @param value The attribute value
*/
function setStringAttribute(
address collection,
uint256 tokenId,
string memory key,
string memory value
) external;
/**
* @notice Used to set a boolean attribute.
* @dev Emits a {BoolAttributeUpdated} event.
* @param collection Address of the collection receiving the attribute
* @param tokenId The token ID
* @param key The attribute key
* @param value The attribute value
*/
function setBoolAttribute(
address collection,
uint256 tokenId,
string memory key,
bool value
) external;
/**
* @notice Used to set an bytes attribute.
* @dev Emits a {BytesAttributeUpdated} event.
* @param collection Address of the collection receiving the attribute
* @param tokenId The token ID
* @param key The attribute key
* @param value The attribute value
*/
function setBytesAttribute(
address collection,
uint256 tokenId,
string memory key,
bytes memory value
) external;
/**
* @notice Used to set an address attribute.
* @dev Emits a {AddressAttributeUpdated} event.
* @param collection Address of the collection receiving the attribute
* @param tokenId The token ID
* @param key The attribute key
* @param value The attribute value
*/
function setAddressAttribute(
address collection,
uint256 tokenId,
string memory key,
address value
) external;
/**
* @notice Sets multiple string attributes for a token at once.
* @dev The `StringAttribute` struct contains the following fields:
* [
* string key,
* string value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param attributes An array of `StringAttribute` structs to be assigned to the given token
*/
function setStringAttributes(
address collection,
uint256 tokenId,
StringAttribute[] memory attributes
) external;
/**
* @notice Sets multiple uint attributes for a token at once.
* @dev The `UintAttribute` struct contains the following fields:
* [
* string key,
* uint value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param attributes An array of `UintAttribute` structs to be assigned to the given token
*/
function setUintAttributes(
address collection,
uint256 tokenId,
UintAttribute[] memory attributes
) external;
/**
* @notice Sets multiple bool attributes for a token at once.
* @dev The `BoolAttribute` struct contains the following fields:
* [
* string key,
* bool value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param attributes An array of `BoolAttribute` structs to be assigned to the given token
*/
function setBoolAttributes(
address collection,
uint256 tokenId,
BoolAttribute[] memory attributes
) external;
/**
* @notice Sets multiple address attributes for a token at once.
* @dev The `AddressAttribute` struct contains the following fields:
* [
* string key,
* address value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param attributes An array of `AddressAttribute` structs to be assigned to the given token
*/
function setAddressAttributes(
address collection,
uint256 tokenId,
AddressAttribute[] memory attributes
) external;
/**
* @notice Sets multiple bytes attributes for a token at once.
* @dev The `BytesAttribute` struct contains the following fields:
* [
* string key,
* bytes value
* ]
* @param collection Address of the collection
* @param tokenId ID of the token
* @param attributes An array of `BytesAttribute` structs to be assigned to the given token
*/
function setBytesAttributes(
address collection,
uint256 tokenId,
BytesAttribute[] memory attributes
) external;
/**
* @notice Sets multiple attributes of multiple types for a token at the same time.
* @dev Emits a separate event for each attribute set.
* @dev The `StringAttribute`, `UintAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists
* to the following fields (where `value` is of the appropriate type):
* [
* key,
* value,
* ]
* @param collection The address of the collection
* @param tokenId The token ID
* @param stringAttributes An array of `StringAttribute` structs containing string attributes to set
* @param uintAttributes An array of `UintAttribute` structs containing uint attributes to set
* @param boolAttributes An array of `BoolAttribute` structs containing bool attributes to set
* @param addressAttributes An array of `AddressAttribute` structs containing address attributes to set
* @param bytesAttributes An array of `BytesAttribute` structs containing bytes attributes to set
*/
function setTokenAttributes(
address collection,
uint256 tokenId,
StringAttribute[] memory stringAttributes,
UintAttribute[] memory uintAttributes,
BoolAttribute[] memory boolAttributes,
AddressAttribute[] memory addressAttributes,
BytesAttribute[] memory bytesAttributes
) external;
/**
* @notice Used to set the uint attribute on behalf of an authorized account.
* @dev Emits a {UintAttributeUpdated} event.
* @param setter Address of the account that presigned the attribute change
* @param collection Address of the collection receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction
* @param v `v` value of an ECDSA signature of the presigned message
* @param r `r` value of an ECDSA signature of the presigned message
* @param s `s` value of an ECDSA signature of the presigned message
*/
function presignedSetUintAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Used to set the string attribute on behalf of an authorized account.
* @dev Emits a {StringAttributeUpdated} event.
* @param setter Address of the account that presigned the attribute change
* @param collection Address of the collection receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction
* @param v `v` value of an ECDSA signature of the presigned message
* @param r `r` value of an ECDSA signature of the presigned message
* @param s `s` value of an ECDSA signature of the presigned message
*/
function presignedSetStringAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
string memory value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Used to set the bool attribute on behalf of an authorized account.
* @dev Emits a {BoolAttributeUpdated} event.
* @param setter Address of the account that presigned the attribute change
* @param collection Address of the collection receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction
* @param v `v` value of an ECDSA signature of the presigned message
* @param r `r` value of an ECDSA signature of the presigned message
* @param s `s` value of an ECDSA signature of the presigned message
*/
function presignedSetBoolAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
bool value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Used to set the bytes attribute on behalf of an authorized account.
* @dev Emits a {BytesAttributeUpdated} event.
* @param setter Address of the account that presigned the attribute change
* @param collection Address of the collection receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction
* @param v `v` value of an ECDSA signature of the presigned message
* @param r `r` value of an ECDSA signature of the presigned message
* @param s `s` value of an ECDSA signature of the presigned message
*/
function presignedSetBytesAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
bytes memory value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Used to set the address attribute on behalf of an authorized account.
* @dev Emits a {AddressAttributeUpdated} event.
* @param setter Address of the account that presigned the attribute change
* @param collection Address of the collection receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction
* @param v `v` value of an ECDSA signature of the presigned message
* @param r `r` value of an ECDSA signature of the presigned message
* @param s `s` value of an ECDSA signature of the presigned message
*/
function presignedSetAddressAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
address value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Used to check if the specified address is listed as a collaborator of the given collection's parameter.
* @param collaborator Address to be checked.
* @param collection Address of the collection.
* @return Boolean value indicating if the address is a collaborator of the given collection's (`true`) or not
* (`false`).
*/
function isCollaborator(
address collaborator,
address collection
) external view returns (bool);
/**
* @notice Used to check if the specified address is listed as a specific address of the given collection's
* parameter.
* @param specificAddress Address to be checked.
* @param collection Address of the collection.
* @param key The key of the attribute
* @return Boolean value indicating if the address is a specific address of the given collection's parameter
* (`true`) or not (`false`).
*/
function isSpecificAddress(
address specificAddress,
address collection,
string memory key
) external view returns (bool);
/**
* @notice Used to retrieve the string type token attributes.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @return The value of the string attribute
*/
function getStringTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (string memory);
/**
* @notice Used to retrieve the uint type token attributes.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @return The value of the uint attribute
*/
function getUintTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (uint256);
/**
* @notice Used to retrieve the bool type token attributes.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @return The value of the bool attribute
*/
function getBoolTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (bool);
/**
* @notice Used to retrieve the address type token attributes.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @return The value of the address attribute
*/
function getAddressTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (address);
/**
* @notice Used to retrieve the bytes type token attributes.
* @param collection The collection address
* @param tokenId The token ID
* @param key The key of the attribute
* @return The value of the bytes attribute
*/
function getBytesTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (bytes memory);
/**
* @notice Used to retrieve the message to be signed for submitting a presigned uint attribute change.
* @param collection The address of the collection smart contract of the token receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction after which the message is invalid
* @return Raw message to be signed by the authorized account
*/
function prepareMessageToPresignUintAttribute(
address collection,
uint256 tokenId,
string memory key,
uint256 value,
uint256 deadline
) external view returns (bytes32);
/**
* @notice Used to retrieve the message to be signed for submitting a presigned string attribute change.
* @param collection The address of the collection smart contract of the token receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction after which the message is invalid
* @return Raw message to be signed by the authorized account
*/
function prepareMessageToPresignStringAttribute(
address collection,
uint256 tokenId,
string memory key,
string memory value,
uint256 deadline
) external view returns (bytes32);
/**
* @notice Used to retrieve the message to be signed for submitting a presigned bool attribute change.
* @param collection The address of the collection smart contract of the token receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction after which the message is invalid
* @return Raw message to be signed by the authorized account
*/
function prepareMessageToPresignBoolAttribute(
address collection,
uint256 tokenId,
string memory key,
bool value,
uint256 deadline
) external view returns (bytes32);
/**
* @notice Used to retrieve the message to be signed for submitting a presigned bytes attribute change.
* @param collection The address of the collection smart contract of the token receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction after which the message is invalid
* @return Raw message to be signed by the authorized account
*/
function prepareMessageToPresignBytesAttribute(
address collection,
uint256 tokenId,
string memory key,
bytes memory value,
uint256 deadline
) external view returns (bytes32);
/**
* @notice Used to retrieve the message to be signed for submitting a presigned address attribute change.
* @param collection The address of the collection smart contract of the token receiving the attribute
* @param tokenId The ID of the token receiving the attribute
* @param key The attribute key
* @param value The attribute value
* @param deadline The deadline timestamp for the presigned transaction after which the message is invalid
* @return Raw message to be signed by the authorized account
*/
function prepareMessageToPresignAddressAttribute(
address collection,
uint256 tokenId,
string memory key,
address value,
uint256 deadline
) external view returns (bytes32);
/**
* @notice Used to retrieve multiple token attributes of any type at once.
* @dev The `StringAttribute`, `UintAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists
* to the following fields (where `value` is of the appropriate type):
* [
* key,
* value,
* ]
* @param collection The collection address
* @param tokenId The token ID
* @param stringKeys An array of string type attribute keys to retrieve
* @param uintKeys An array of uint type attribute keys to retrieve
* @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
*/
function getTokenAttributes(
address collection,
uint256 tokenId,
string[] memory stringKeys,
string[] memory uintKeys,
string[] memory boolKeys,
string[] memory addressKeys,
string[] memory bytesKeys
)
external
view
returns (
StringAttribute[] memory stringAttributes,
UintAttribute[] memory uintAttributes,
BoolAttribute[] memory boolAttributes,
AddressAttribute[] memory addressAttributes,
BytesAttribute[] memory bytesAttributes
);
/**
* @notice Used to get multiple sting parameter values for a token.
* @dev The `StringAttribute` struct contains the following fields:
* [
* 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 An array of `StringAttribute` structs
*/
function getStringTokenAttributes(
address collection,
uint256 tokenId,
string[] memory stringKeys
) external view returns (StringAttribute[] memory);
/**
* @notice Used to get multiple uint parameter values for a token.
* @dev The `UintAttribute` struct contains the following fields:
* [
* 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 An array of `UintAttribute` structs
*/
function getUintTokenAttributes(
address collection,
uint256 tokenId,
string[] memory uintKeys
) external view returns (UintAttribute[] memory);
/**
* @notice Used to get multiple bool parameter values for a token.
* @dev The `BoolAttribute` struct contains the following fields:
* [
* 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 An array of `BoolAttribute` structs
*/
function getBoolTokenAttributes(
address collection,
uint256 tokenId,
string[] memory boolKeys
) external view returns (BoolAttribute[] memory);
/**
* @notice Used to get multiple address parameter values for a token.
* @dev The `AddressAttribute` struct contains the following fields:
* [
* 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 An array of `AddressAttribute` structs
*/
function getAddressTokenAttributes(
address collection,
uint256 tokenId,
string[] memory addressKeys
) external view returns (AddressAttribute[] memory);
/**
* @notice Used to get multiple bytes parameter values for a token.
* @dev The `BytesAttribute` struct contains the following fields:
* [
* 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 An array of `BytesAttribute` structs
*/
function getBytesTokenAttributes(
address collection,
uint256 tokenId,
string[] memory bytesKeys
) external view returns (BytesAttribute[] memory);
}AccessType
enum AccessType {
Issuer,
Collaborator,
IssuerOrCollaborator,
TokenOwner,
SpecificAddress
}Overview An enumeration of supported access types.
Parameters
Issuer- Only the issuer can manage parameters.
Collaborator- Only collaborators can manage parameters.
IssuerOrCollaborator- Only the issuer or collaborators can manage parameters.
TokenOwner- Only the token owner can manage the parameters of their own token.
SpecificAddress- Only a specific address can manage parameters.
StringAttribute
struct StringAttribute {
string key;
string value;
}Overview A struct representing a string attribute.
Parameters
key: Attribute key.value: Attribute value.
UintAttribute
struct UintAttribute {
string key;
uint256 value;
}Overview A struct representing an unsigned integer attribute.
Parameters
key- Attribute key.
value- Attribute value.
BoolAttribute
struct BoolAttribute {
string key;
bool value;
}Overview A struct representing a boolean attribute.
Parameters
key- Attribute key.
value- Attribute value.
AddressAttribute
struct AddressAttribute {
string key;
address value;
}Overview A struct representing an address attribute.
Parameters
key- Attribute key.
value- Attribute value.
BytesAttribute
struct BytesAttribute {
string key;
bytes value;
}Overview A struct representing a bytes attribute.
Parameters
key- Attribute key.
value- Attribute value.
AccessControlRegistration
event AccessControlRegistration(
address indexed collection,
address indexed issuer,
address indexed registeringAddress,
bool useOwnable
);Overview An event emitted when a new collection registers to use the repository.
Parameters
collection- Collection address.
issuer- Address of the collection issuer.
registeringAddress- Address that registered the collection.
useOwnable- Boolean indicating whether the collection uses the Ownable extension.
AccessControlUpdate
event AccessControlUpdate(
address indexed collection,
string key,
AccessType accessType,
address specificAddress
);Overview An event emitted when the access control configuration for a specific parameter is updated.
Parameters
collection- Collection address.
key- Name of the parameter whose access control configuration was updated.
accessType- AccessType of the parameter whose access control configuration was updated.
specificAddress- Updated specific address.
CollaboratorUpdate
event CollaboratorUpdate(
address indexed collection,
address indexed collaborator,
bool isCollaborator
);Overview An event emitted when a collaborator is added or removed.
Parameters
collection- Collection address.
collaborator- Collaborator address.
isCollaborator- Boolean indicating whether the collaborator was added or removed.
StringAttributeUpdated
event StringAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
string value
);Overview An event emitted when a string attribute is updated.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
value- New attribute value.
UintAttributeUpdated
event UintAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
uint256 value
);Overview An event emitted when an unsigned integer attribute is updated.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
value- New attribute value.
BoolAttributeUpdated
event BoolAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
bool value
);**
Overview An event emitted when a boolean attribute is updated.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
value- New attribute value.
AddressAttributeUpdated
event AddressAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
address value
);Overview An event emitted when an address attribute is updated.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
value- New attribute value.
BytesAttributeUpdated
event BytesAttributeUpdated(
address indexed collection,
uint256 indexed tokenId,
string key,
bytes value
);Overview An event emitted when a bytes attribute is updated.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
value- New attribute value.
registerAccessControl
function registerAccessControl(
address collection,
address issuer,
bool useOwnable
) external;Overview
A function that registers a collection to use the RMRK token attributes repository.
Details
If the collection does not implement the Ownable interface, useOwnable must be set to false.
This function emits the AccessControlRegistration event.
Parameters
collection- Address of the collection using the RMRK token attributes repository.
issuer- Address of the collection issuer.
useOwnable- Boolean indicating whether the collection implements the
Ownableinterface. trueto useOwnableto verify the issuer;falseto use a manually configured issuer address.
- Boolean indicating whether the collection implements the
manageAccessControl
function manageAccessControl(
address collection,
string memory key,
AccessType accessType,
address specificAddress
) external;Overview
A function that manages the access control configuration for a specific parameter.
Details
Only the issuer of the specified collection can call this function.
The possible values of accessType are listed below.
[Issuer, Collaborator, IssuerOrCollaborator, TokenOwner, SpecificAddress]。
This function emits the AccessControlUpdated event.
Parameters
collection- Address of the collection being managed.
key- Attribute key.
accessType- Type of access control applied to the parameter.
specificAddress- Address authorized under the specific-address access type.
manageCollaborators
function manageCollaborators(
address collection,
address[] memory collaboratorAddresses,
bool[] memory collaboratorAddressAccess
) external;Overview
A function that manages a collection's collaborators.
Details
The collaboratorAddresses and collaboratorAddressAccess arrays must have the same length.
This function emits the CollaboratorUpdate event.
Parameters
collection- Collection address.
collaboratorAddresses- Array of collaborator addresses being managed.
collaboratorAddressAccess- Boolean array containing
trueif a collaborator address receives access andfalseotherwise.
- Boolean array containing
setUintAttribute
function setUintAttribute(
address collection,
uint256 tokenId,
string memory key,
uint256 value
) external;Overview
A function that sets an unsigned integer attribute.
Details
Sets an unsigned integer attribute for the specified collection.
Emits the UintAttributeUpdated event.
Parameters
collection- Address of the collection receiving the attribute.
tokenId- Token ID.
key- Attribute key.
value- Attribute value.
setStringAttribute
function setStringAttribute(
address collection,
uint256 tokenId,
string memory key,
string memory value
) external;Overview
A function that sets a string attribute.
Details
Sets a string attribute for the specified collection.
Emits the StringAttributeUpdated event.
Parameters
collection- Address of the collection receiving the attribute.
tokenId- Token ID.
key- Attribute key.
value- Attribute value.
setBoolAttribute
function setBoolAttribute(
address collection,
uint256 tokenId,
string memory key,
bool value
) external;Overview
A function that sets a boolean attribute.
Details
Sets a boolean attribute for the specified collection.
Emits the BoolAttributeUpdated event.
Parameters
collection- Address of the collection receiving the attribute.
tokenId- Token ID.
key- Attribute key.
value- Attribute value.
setBytesAttribute
function setBytesAttribute(
address collection,
uint256 tokenId,
string memory key,
bytes memory value
) external;Overview
A function that sets a bytes attribute.
Details
Sets a bytes attribute for the specified collection.
Emits the BytesAttributeUpdated event.
Parameters
collection- Address of the collection receiving the attribute.
tokenId- Token ID.
key- Attribute key.
value- Attribute value.
setAddressAttribute
function setAddressAttribute(
address collection,
uint256 tokenId,
string memory key,
address value
) external;Overview
A function that sets an address attribute for the specified collection and token.
Details
Sets an address attribute with the specified key for the specified collection and token.
An address (of type address) is provided as the attribute value.
When the attribute is set, the AddressAttributeUpdated event is emitted.
Parameters
collection- Address of the collection for which the address attribute is set.
tokenId- ID of the token for which the address attribute is set.
key- Attribute key, a string uniquely identifying the attribute.
value- Address to set as the attribute value.
setStringAttributes
function setStringAttributes(
address collection,
uint256 tokenId,
StringAttribute[] memory attributes
) external;Overview
A function that sets multiple string attributes at once for the specified collection and token.
Details
Sets multiple string attributes at once for the specified collection and token.
The attributes parameter receives an array of StringAttribute structs.
Each struct contains an attribute key and value, which are assigned to the specified token.
Parameters
collection- Address of the collection for which string attributes are set.
tokenId- ID of the token for which string attributes are set.
attributes- Array of
StringAttributestructs. - Each struct stores information about a string attribute.
- Array of
setUintAttributes
function setUintAttributes(
address collection,
uint256 tokenId,
UintAttribute[] memory attributes
) external;Overview A function that sets multiple unsigned integer attributes at once for the specified collection and token.
Details
Sets multiple unsigned integer attributes at once for the specified collection and token.
The attributes parameter receives an array of UintAttribute structs.
Each struct contains an attribute key and value, which are assigned to the specified token.
Parameters
collection- Address of the collection for which unsigned integer attributes are set.
tokenId- ID of the token for which unsigned integer attributes are set.
attributes- Array of
UintAttributestructs. - Each struct stores information about an unsigned integer attribute.
- Array of
setBoolAttributes
function setBoolAttributes(
address collection,
uint256 tokenId
,
BoolAttribute[] memory attributes
) external;Overview
A function that sets multiple boolean attributes at once for the specified collection and token.
Details
Sets multiple boolean attributes at once for the specified collection and token.
The attributes parameter receives an array of BoolAttribute structs.
Each struct contains an attribute key and boolean value, which are assigned to the specified token.
Parameters
collection- Address of the collection for which boolean attributes are set.
tokenId- ID of the token for which boolean attributes are set.
attributes- Array of
BoolAttributestructs. - Each struct stores information about a boolean attribute.
- Array of
setAddressAttributes
function setAddressAttributes(
address collection,
uint256 tokenId,
AddressAttribute[] memory attributes
) external;Overview
A function that sets multiple address attributes at once for the specified collection and token.
Details
This function sets multiple address attributes at once for the specified collection and token.
The attributes parameter receives an array of AddressAttribute structs.
Each struct contains an attribute key and address, which are assigned to the specified token.
Parameters
collection- Address of the collection for which the address attribute is set.
tokenId- ID of the token for which the address attribute is set.
attributes- Array of
AddressAttributestructs. - Each struct stores information about an address attribute.
- Array of
setBytesAttributes
function setBytesAttributes(
address collection,
uint256 tokenId,
BytesAttribute[] memory attributes
) external;Overview
A function that sets multiple bytes attributes at once for the specified collection and token.
Details
Sets multiple bytes attributes at once for the specified collection and token.
The attributes parameter receives an array of BytesAttribute structs.
Each struct contains an attribute key and byte data, which are assigned to the specified token.
Parameters
collection- Address of the collection for which bytes attributes are set.
tokenId- ID of the token for which bytes attributes are set.
attributes- Array of
BytesAttributestructs. - Each struct stores information about a bytes attribute.
- Array of
setTokenAttributes
function setTokenAttributes(
address collection,
uint256 tokenId,
StringAttribute[] memory stringAttributes,
UintAttribute[] memory uintAttributes,
BoolAttribute[] memory boolAttributes,
AddressAttribute[] memory addressAttributes,
BytesAttribute[] memory bytesAttributes
) external;Overview
A function that sets multiple attributes of different types at once for the specified collection and token.
Details
Sets string, unsigned integer, boolean, address, and bytes attributes at once for the specified collection and token. Each attribute type is specified using an array of the corresponding structs. Each struct contains an attribute key and value, which are assigned to the specified token. A separate event is emitted for each attribute that is set.
Parameters
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
stringAttributes- Array of
StringAttributestructs for setting string attributes.
- Array of
uintAttributes- Array of
UintAttributestructs for setting unsigned integer attributes.
- Array of
boolAttributes- Array of
BoolAttributestructs for setting boolean attributes.
- Array of
addressAttributes- Array of
AddressAttributestructs for setting address attributes.
- Array of
bytesAttributes- Array of
BytesAttributestructs for setting bytes attributes.
- Array of
presignedSetUintAttribute
function presignedSetUintAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;Overview
A function that sets an unsigned integer attribute on behalf of an authorized account.
Details
Sets an unsigned integer attribute using a message previously signed by a specific account.
This allows an account to authorize an attribute change before another account submits it.
When the attribute is set, the UintAttributeUpdated event is emitted.
Parameters
setter- Address of the account that signed the attribute change in advance.
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
key- Attribute key, a string uniquely identifying the attribute.
value- Unsigned integer to set as the attribute value.
deadline- Deadline timestamp for the authorization transaction.
- The transaction must be executed by this timestamp.
v- The
vvalue of the ECDSA signature.
- The
r- The
rvalue of the ECDSA signature.
- The
s- The
svalue of the ECDSA signature.
- The
presignedSetStringAttribute
function presignedSetStringAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
string memory value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;Overview
A function that sets a string attribute on behalf of an authorized account.
Details
Sets a string attribute using a message previously signed by a specific account.
This allows an account to authorize an attribute change before another account submits it.
When the attribute is set, the StringAttributeUpdated event is emitted.
Parameters
setter- Address of the account that signed the attribute change in advance.
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
key- Attribute key, a string uniquely identifying the attribute.
value- String to set as the attribute value.
deadline- Deadline timestamp for the authorization transaction.
- The transaction must be executed by this timestamp.
v- The
vvalue of the ECDSA signature.
- The
r- The
rvalue of the ECDSA signature.
- The
s- The
svalue of the ECDSA signature.
- The
presignedSetBoolAttribute
function presignedSetBoolAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
bool value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;Overview
A function that sets a boolean attribute on behalf of an authorized account.
Details
This function sets a boolean attribute using a message previously signed by a specific account.
This allows an account to authorize an attribute change before another account submits it.
When the attribute is set, the BoolAttributeUpdated event is emitted.
Parameters
setter- Address of the account that signed the attribute change in advance.
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
key- Attribute key.
- A string uniquely identifying the attribute.
value- Boolean to set as the attribute value.
deadline- Deadline timestamp for the authorization transaction.
- The transaction must be executed by this timestamp.
v- The
vvalue of the ECDSA signature.
- The
r- The
rvalue of the ECDSA signature.
- The
s- The
svalue of the ECDSA signature.
- The
presignedSetBytesAttribute
function presignedSetBytesAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
bytes memory value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;Overview
A function that sets a bytes attribute on behalf of an authorized account.
Details
This function sets a bytes attribute using a message previously signed by a specific account.
This allows an account to authorize an attribute change before another account submits it.
When the attribute is set, the BytesAttributeUpdated event is emitted.
Parameters
setter- Address of the account that signed the attribute change in advance.
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
key- Attribute key.
- A string uniquely identifying the attribute.
value- Byte sequence to set as the attribute value.
deadline- Deadline timestamp for the authorization transaction.
- The transaction must be executed by this timestamp.
v- The
vvalue of the ECDSA signature.
- The
r- The
rvalue of the ECDSA signature.
- The
s- The
svalue of the ECDSA signature.
- The
presignedSetAddressAttribute
function presignedSetAddressAttribute(
address setter,
address collection,
uint256 tokenId,
string memory key,
address value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;Overview
A function that sets an address attribute on behalf of an authorized account.
Details
Sets an address attribute using a message previously signed by a specific account.
This allows an account to authorize an attribute change before another account submits it.
When the attribute is set, the AddressAttributeUpdated event is emitted.
Parameters
setter- Address of the account that signed the attribute change in advance.
collection- Address of the collection for which attributes are set.
tokenId- ID of the token for which attributes are set.
key- Attribute key.
- A string uniquely identifying the attribute.
value- Address to set as the attribute value.
deadline- Deadline timestamp for the authorization transaction.
- The transaction must be executed by this timestamp.
v- The
vvalue of the ECDSA signature.
- The
r- The
rvalue of the ECDSA signature.
- The
s- The
svalue of the ECDSA signature.
- The
isCollaborator
function isCollaborator(
address collaborator,
address collection
) external view returns (bool);Overview A function that checks whether a specified address is listed as a collaborator for a specified collection.
Details
Used to check whether the specified address is a collaborator for a particular collection.
Addresses listed as collaborators may have permission to perform certain actions.
Returns true if the address is a collaborator, and false otherwise.
Parameters
collaborator- Address to check.
collection- Collection address.
Return value
true- The specified address is a collaborator for the collection.
false- The specified address is not a collaborator for the collection.
isSpecificAddress
function isSpecificAddress(
address specificAddress,
address collection,
string memory key
) external view returns (bool);Overview
A function that checks whether a specified address is listed as the designated address for a specified collection.
Details
Used to check whether the specified address is the designated address for a particular collection.
An address listed as a designated address may have special permissions or attributes.
Returns true if it is the designated address, and false otherwise.
Parameters
specificAddress- Address to check.
collection- Collection address.
key- Attribute key.
- A string uniquely identifying the designated address.
Return value
true- The specified address is the designated address for the collection.
false- The specified address is not the designated address for the collection.
getStringTokenAttribute
function getStringTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (string memory);Overview
A function that retrieves a string token attribute associated with the specified collection and token ID.
Details
Retrieves the token's string attribute value using the specified collection, token ID, and attribute key. This provides additional information about the token.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
- A string uniquely identifying the attribute to retrieve.
Return value
- String attribute value.
getUintTokenAttribute
function getUintTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (uint256);Overview
A function that retrieves an unsigned integer token attribute associated with the specified collection and token ID.
Details
Retrieves the token's unsigned integer attribute value using the specified collection, token ID, and attribute key. This provides additional information about the token.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
- A string uniquely identifying the attribute to retrieve.
Return value
- Unsigned integer attribute value.
Sure, I'll provide explanations for the remaining functions in the requested format.
getBoolTokenAttribute
/**
* @notice ブール型のトークン属性を取得します。
* @param collection コレクションのアドレス
* @param tokenId トークンのID
* @param key 属性のキー
* @return ブール属性の値
*/
function getBoolTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (bool);Overview
This function retrieves a boolean token attribute associated with the specified collection and token ID.
Details
This function retrieves the token's boolean attribute value using the specified collection, token ID, and attribute key. Boolean attributes have a value of true or false and can represent a particular state or flag of a token.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key: a string uniquely identifying the attribute to retrieve.
Return value
- Boolean attribute value (
trueorfalse).
getAddressTokenAttribute
/**
* @notice アドレス型のトークン属性を取得します。
* @param collection コレクションのアドレス
* @param tokenId トークンのID
* @param key 属性のキー
* @return アドレス属性の値
*/
function getAddressTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (address);Overview
This function retrieves an address token attribute associated with the specified collection and token ID.
Details
This function retrieves the token's address attribute value using the specified collection, token ID, and attribute key. Address attributes store Ethereum addresses and are useful when a token is associated with another contract or user account.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key: a string uniquely identifying the attribute to retrieve.
Return value
- Address attribute value (an Ethereum address).
getBytesTokenAttribute
function getBytesTokenAttribute(
address collection,
uint256 tokenId,
string memory key
) external view returns (bytes memory);Overview
A function that retrieves a bytes token attribute associated with the specified collection and token ID.
Details
Retrieves the token's bytes attribute value using the specified collection, token ID, and attribute key. Bytes attributes store binary data and are useful when a token has a complex data structure.
Parameters
collection- Collection address.
tokenId- Token ID.
key- Attribute key.
- A string uniquely identifying the attribute to retrieve.
Return value
- Bytes attribute value.
prepareMessageToPresignUintAttribute
function prepareMessageToPresignUintAttribute(
address collection,
uint256 tokenId,
string memory key,
uint256 value,
uint256 deadline
) external view returns (bytes32);Overview
A function that retrieves the message used to submit a uint attribute change signed in advance by an authorized account.
Details
Generates the message to sign for a uint attribute change submitted by an authorized account.
The message includes information such as the change and transaction expiration. The signed message is used to submit the attribute update transaction.
Parameters
collection- Address of the collection smart contract for the token receiving the attribute.
tokenId- ID of the token receiving the attribute.
key- Attribute key.
- A string uniquely identifying the attribute to change.
value- New attribute value (type
uint).
- New attribute value (type
deadline- Deadline timestamp for the authorization transaction.
- The message becomes invalid after this timestamp.
Return value
- Raw message (
bytes32) to be signed by an authorized account.
prepareMessageToPresignStringAttribute
function prepareMessageToPresignStringAttribute(
address collection,
uint256 tokenId,
string memory key,
string memory value,
uint256 deadline
) external view returns (bytes32);Overview
A function that retrieves the message used to submit a string attribute change signed in advance by an authorized account.
Details
Generates the message to sign for a string attribute change submitted by an authorized account. The message includes information such as the change and transaction expiration. The signed message is used to submit the attribute update transaction.
Parameters
collection- Address of the collection smart contract for the token receiving the attribute.
tokenId- ID of the token receiving the attribute.
key- Attribute key.
- A string uniquely identifying the attribute to change.
value- New attribute value (string).
deadline- Deadline timestamp for the authorization transaction. The message becomes invalid after this timestamp.
Return value
- Raw message (
bytes32) to be signed by an authorized account.
prepareMessageToPresignBoolAttribute
function prepareMessageToPresignBoolAttribute(
address collection,
uint256 tokenId,
string memory key,
bool value,
uint256 deadline
) external view returns (bytes32);Overview
A function that retrieves the message used to submit a boolean attribute change signed in advance by an authorized account.
Details
Generates the message to sign for a boolean attribute change submitted by an authorized account. The message includes information such as the change and transaction expiration. The signed message is used to submit the attribute update transaction.
Parameters
collection- Address of the collection smart contract for the token receiving the attribute.
tokenId- ID of the token receiving the attribute.
key- Attribute key: a string uniquely identifying the attribute to change.
value- New attribute value (boolean).
deadline- Deadline timestamp for the authorization transaction. The message becomes invalid after this timestamp.
Return value
- Raw message (
bytes32) to be signed by an authorized account.
prepareMessageToPresignBytesAttribute
function prepareMessageToPresignBytesAttribute(
address collection,
uint256 tokenId,
string memory key,
bytes memory value,
uint256 deadline
) external view returns (bytes32);Overview
A function that retrieves the message used to submit a bytes attribute change signed in advance by an authorized account.
Details
Generates the message to sign for a bytes attribute change submitted by an authorized account. The message includes information such as the change and transaction expiration. The signed message is used to submit the attribute update transaction.
Parameters
collection- Address of the collection smart contract for the token receiving the attribute.
tokenId- ID of the token receiving the attribute.
key- Attribute key: a string uniquely identifying the attribute to change.
value- New attribute value (byte array).
deadline- Deadline timestamp for the authorization transaction. The message becomes invalid after this timestamp.
Return value
- Raw message (
bytes32) to be signed by an authorized account.
prepareMessageToPresignAddressAttribute
function prepareMessageToPresignAddressAttribute(
address collection,
uint256 tokenId,
string memory key,
address value,
uint256 deadline
) external view returns (bytes32);Overview A function that retrieves the message for a presigned address attribute change.
Details Generates a message to sign in advance for changing an address attribute of a token in the specified collection. The message includes the specified collection, token ID, attribute key, attribute value, and deadline. This helps ensure that an attribute change transaction is securely signed and submitted.
Parameters
collection- Address of the collection smart contract for the token receiving the attribute.
tokenId- ID of the token receiving the attribute.
key- Attribute key.
value- Attribute value.
deadline- Deadline timestamp for the presigned transaction.
- The message becomes invalid after the deadline.
Return value
bytes32- Raw message to be signed by an authorized account.
- This message is used for the presigned transaction.
getTokenAttributes
function getTokenAttributes(
address collection,
uint256 tokenId,
string[] memory stringKeys,
string[] memory uintKeys,
string[] memory boolKeys,
string[] memory addressKeys,
string[] memory bytesKeys
) external view returns (
StringAttribute[] memory stringAttributes,
UintAttribute[] memory uintAttributes,
BoolAttribute[] memory boolAttributes,
AddressAttribute[] memory addressAttributes,
BytesAttribute[] memory bytesAttributes
);Overview A function that retrieves multiple token attributes of any type at once.
Details
Retrieves attributes of different types (string, uint, bool, address, and bytes) associated with the specified collection and token ID in a single call.
Returns the value of each attribute based on the specified lists of attribute keys.
This is used to efficiently retrieve multiple attributes associated with a token.
Parameters
collection- Collection address.
tokenId- Token ID.
stringKeys- Array of string attribute keys to retrieve.
uintKeys- Array of
uintattribute keys to retrieve.
- Array of
boolKeys- Array of
boolattribute keys to retrieve.
- Array of
addressKeys- Array of
addressattribute keys to retrieve.
- Array of
bytesKeys- Array of
bytesattribute keys to retrieve.
- Array of
Return value
stringAttributes- Array of
StringAttributestructs containing string attributes.
- Array of
uintAttributes- Array of
UintAttributestructs containinguintattributes.
- Array of
boolAttributes- Array of
BoolAttributestructs containingboolattributes.
- Array of
addressAttributes- Array of
AddressAttributestructs containingaddressattributes.
- Array of
bytesAttributes- Array of
BytesAttributestructs containingbytesattributes.
- Array of
getStringTokenAttributes
function getStringTokenAttributes(
address collection,
uint256 tokenId,
string[] memory stringKeys
) external view returns (StringAttribute[] memory);Overview A function that retrieves multiple string parameter values for a token.
Details
Retrieves parameter values for the specified string attribute keys associated with the specified collection and token ID.
Each string parameter is represented by a key-value pair, and those pairs are returned as elements of an array of StringAttribute structs.
This makes it easy to retrieve string attributes associated with a token.
Parameters
collection- Address of the collection to which the token belongs.
tokenId- ID of the token whose attributes are retrieved.
stringKeys- Array of string attribute keys to retrieve.
Return value
StringAttribute[]- Array of
StringAttributestructs. - Each struct contains the key and value of a string parameter.
- Array of
getUintTokenAttributes
function getUintTokenAttributes(
address collection,
uint256 tokenId,
string[] memory uintKeys
) external view returns (UintAttribute[] memory);Overview
A function that retrieves multiple uint parameter values for a token.
Details
Retrieves parameter values for the specified uint attribute keys associated with the specified collection and token ID.
Each uint parameter is represented by a key-value pair, and those pairs are returned as elements of an array of UintAttribute structs.
This makes it easy to retrieve uint attributes associated with a token.
Parameters
collection- Address of the collection to which the token belongs.
tokenId- ID of the token whose attributes are retrieved.
uintKeys- Array of
uintattribute keys to retrieve.
- Array of
Return value
UintAttribute[]- Array of
UintAttributestructs. - Each struct contains the key and value of a
uintparameter.
- Array of
getBoolTokenAttributes
function getBoolTokenAttributes(
address collection,
uint256 tokenId,
string[] memory boolKeys
) external view returns (BoolAttribute[] memory);Overview
A function that retrieves multiple bool parameter values for a token.
Details
Retrieves parameter values for the specified bool attribute keys associated with the specified collection and token ID.
Each bool parameter is represented by a key-value pair, and those pairs are returned as elements of an array of BoolAttribute structs.
This makes it easy to retrieve bool attributes associated with a token.
Parameters
collection- Address of the collection to which the token belongs.
tokenId- ID of the token whose attributes are retrieved.
boolKeys- Array of
boolattribute keys to retrieve.
- Array of
Return value
BoolAttribute[]- Array of
BoolAttributestructs. - Each struct contains the key and value of a
boolparameter.
- Array of
getAddressTokenAttributes
function getAddressTokenAttributes(
address collection,
uint256 tokenId,
string[] memory addressKeys
) external view returns (AddressAttribute[] memory);Overview
Used to retrieve multiple address parameter values for a token.
Details
Retrieves parameter values for the specified address attribute keys associated with the specified collection and token ID.
Each address parameter is represented by a key-value pair, and those pairs are returned as elements of an array of AddressAttribute structs.
This makes it easy to retrieve address attributes associated with a token.
Parameters
collection- Address of the collection to which the token belongs.
tokenId- ID of the token whose attributes are retrieved.
addressKeys- Array of
addressattribute keys to retrieve.
- Array of
Return value
AddressAttribute[]- Array of
AddressAttributestructs. - Each struct contains the key and value of an
addressparameter.
- Array of
getBytesTokenAttributes
function getBytesTokenAttributes(
address collection,
uint256 tokenId,
string[] memory bytesKeys
) external view returns (BytesAttribute[] memory);Overview A function that retrieves multiple bytes parameter values for a token.
Details
Retrieves parameter values for the specified bytes attribute keys associated with the specified collection and token ID.
Each bytes parameter is represented by a key-value pair, and those pairs are returned as elements of an array of BytesAttribute structs.
This makes it easy to retrieve bytes attributes associated with a token.
Parameters
collection- Address of the collection to which the token belongs.
tokenId- ID of the token whose attributes are retrieved.
bytesKeys- Array of
bytesattribute keys to retrieve.
- Array of
Return value
BytesAttribute[]- Array of
BytesAttributestructs. - Each struct contains the key and value of a
bytesparameter.
- Array of
Message format for signed attributes
The following message format is used for signatures by the authorized setter of an attribute. This message is used to provide security and consists of the following elements.
keccak256(
abi.encode(
DOMAIN_SEPARATOR,
METHOD_TYPEHASH,
collection,
tokenId,
key,
value,
deadline
)
);keccak256- A hash function that converts the message into a fixed-length hash.
- Used for security purposes to verify that the message has not been tampered with.
abi.encode- A function for encoding data.
- Converts the specified data into a byte sequence.
DOMAIN_SEPARATOR- Domain separator of the attributes repository smart contract.
- A unique value used to identify the origin of the attribute-setting transaction.
- This value differs for each smart contract.
METHOD_TYPEHASH- A value called a method type hash that uniquely identifies a particular method, such as setting an attribute.
- This value also differs for each method.
-
SET_UINT_ATTRIBUTE_TYPEHASH- Type hash used when setting a
uintattribute.
- Type hash used when setting a
SET_STRING_ATTRIBUTE_TYPEHASH- Type hash used when setting a string attribute.
SET_BOOL_ATTRIBUTE_TYPEHASH- Type hash used when setting a boolean attribute.
SET_BYTES_ATTRIBUTE_TYPEHASH- Type hash used when setting a bytes attribute.
SET_ADDRESS_ATTRIBUTE_TYPEHASH- Type hash used when setting an address attribute.
collection- Address of the collection to which the token receiving the attribute belongs.
tokenId- Unique identifier (ID) of the token receiving the attribute.
key- Attribute key.
- Name or label uniquely identifying the attribute.
value- Attribute value.
- Must have the appropriate data type for the attribute:
uint, string, boolean, bytes, or address.
deadline- UNIX timestamp specifying the deadline for submitting the signature.
- Signatures are invalid after this deadline.
The information is encoded into a byte sequence using abi.encode, and keccak256 is applied to generate a hash.
This hash is submitted with the signed transaction and used to verify and authorize the attribute update.
This process is important for ensuring secure attribute updates.
DOMAIN_SEPARATOR is generated as follows.
keccak256(
abi.encode(
"ERC-7508: Public Non-Fungible Token Attributes Repository",
"1",
block.chainid,
address(this)
)
);SET_UINT_ATTRIBUTE_TYPEHASH is generated as follows.
keccak256(
"setUintAttribute(address collection,uint256 tokenId,string memory key,uint256 value)"
);SET_STRING_ATTRIBUTE_TYPEHASH is generated as follows.
keccak256(
"setStringAttribute(address collection,uint256 tokenId,string memory key,string memory value)"
);SET_BOOL_ATTRIBUTE_TYPEHASH is generated as follows.
keccak256(
"setBoolAttribute(address collection,uint256 tokenId,string memory key,bool value)"
);SET_BYTES_ATTRIBUTE_TYPEHASH is generated as follows.
keccak256(
"setBytesAttribute(address collection,uint256 tokenId,string memory key,bytes memory value)"
);SET_ADDRESS_ATTRIBUTE_TYPEHASH is generated as follows.
keccak256(
"setAddressAttribute(address collection,uint256 tokenId,string memory key,address value)"
);Each chain on which the attributes repository smart contract is deployed has a different DOMAIN_SEPARATOR because its chain ID differs.
Predefined attributes repository address
The address begins with 0xA77B75, where 0xA77B75 is a stylized representation of ATTBTS.
The full address is 0xA77b75D5fDEC6E6e8E00e05c707a7CA81a3F9f4a.
The design of this address is meaningful.
The initial sequence 0xA77B75 represents the concept or name ATTBTS.
This kind of address design makes it easier to understand what a smart contract is associated with.
In particular, when multiple smart contracts operate on a blockchain, it helps identify the function or purpose of a given contract.
The address design makes it easier to recognize visually that the Emotable repository smart contract stores and provides attribute information. It is an effective way to communicate the intended use and purpose of a smart contract on the blockchain.
Additional considerations
Use of the terms properties and attributes
The proposal considered how to describe the characteristics and features associated with tokens. Historically, the term property was common, but the proposal adopted the more general term attribute. The rationale was that an attribute describes a quality or characteristic of something or someone and is therefore appropriate in a broader context.
Whether to include access control
The proposal considered whether to explicitly specify access control rules. Including access control requires implementers to configure it before using the attributes repository. Leaving access control to implementers provides greater flexibility but requires them to design their own access control mechanisms. Including access control in the proposal also helps preserve backward compatibility with existing collections.
Attribute extension or shared repository
An attribute extension for ERC721 tokens was initially considered, but the proposal chose a shared attributes repository to enable broader use. This allows both existing and new tokens to use the repository and ensures compatibility with ERC1155 tokens.
Single actions and batch actions
The proposal considered whether to support single actions that assign one attribute to one token or batch actions that assign attributes to multiple tokens at once. Ultimately, both were included, giving users a choice.
Assigning attributes on behalf of other users
Although not considered initially, the usefulness of this feature was recognized later. It allows users to assign attributes on behalf of other users. The proposal also introduced ECDSA signatures to verify that assignments made on behalf of others are authorized.
Chain ID parameter for attributes
The proposal considered whether to include a chain ID parameter when assigning attributes to tokens. Ultimately, it decided not to include one. The reasoning was that the chain ID parameter would rarely be used, would only increase the cost of attribute assignment transactions, and that collection smart contracts and marketplaces expect attributes to be available on the same chain.
Reducing the cost of strings
The high cost of using strings was identified as a problem. To address it, the proposal adopted an approach that uses string indices instead of strings. As a result, only the first user pays the cost of registering a new string, while subsequent users pay only the cost of setting the string index. This approach also applies to the entire repository, so other collections using the same string do not need to register it again.
Backward compatibility
The attributes repository standard is fully compatible with ERC721 and ERC1155. This means that the attributes repository can integrate seamlessly with these token standards and operate with existing ERC721 token infrastructure.
The attributes repository can efficiently manage information about tokens and attributes used in ERC721 and ERC1155. This allows tools and processes for adding, updating, and querying token attributes to be integrated smoothly. Compatibility with existing ERC721 infrastructure and tools also makes it easy to introduce the attributes repository into existing token systems and add new attributes to existing tokens.
Tests
The tests are available in the following GitHub repository.
Source: https://eips.ethereum.org/EIPS/eip-7508
Reference implementation
The tests are available in the following GitHub repository.
Source: https://eips.ethereum.org/EIPS/eip-7508
Security considerations
The proposal is not intended to manage or process any form of user assets, and users' assets are not put at risk when interacting with the attributes repository.
The feature that uses ECDSA signatures to set attributes on behalf of other users may introduce a security risk known as a replay attack.
However, the proposal defines a message format intended to prevent replay attacks. In particular, the DOMAIN_SEPARATOR used in the signed message is unique to the repository smart contract on the blockchain where it is deployed.
This means that a signature is invalid on another blockchain, and an attributes repository deployed on another chain should reject the operation if a replay attack is attempted.
The reuse of presigned messages must also be considered. The message includes a signature expiration time, and the same message can be reused any number of times until it expires. However, because the proposal allows only one value to be set for a specific key, the presigned message cannot be used to set additional attribute values. If a service using the repository relies on the ability to revoke or change an attribute after a specific action, however, a valid presigned message can be used to restore the token's attribute. For this reason, the proposal recommends using a relatively short validity period for presigned messages.
Care is necessary when interacting with unaudited smart contracts. Smart contracts whose security has not been established may pose risks and should be treated with caution.
References
Steven Pineda (@steven2308), Jan Turk (@ThunderDeliverer), "ERC-7508: Dynamic On-Chain Token Attributes Repository [DRAFT]," Ethereum Improvement Proposals, no. 7508, August 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7508.
Conclusion
This article covered ERC7508, a proposal for associating and managing various types of attribute information with NFTs. I hope this overview was helpful.
If you have any questions, feel free to contact me via Twitter DM or the channels below.
I also share information on other platforms, so feel free to explore them.


