Skip to content

Commit

Permalink
Updates docs on attributes repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
steven2308 committed Mar 19, 2024
1 parent ad6aab6 commit b0f1ca6
Show file tree
Hide file tree
Showing 2 changed files with 391 additions and 60 deletions.
213 changes: 185 additions & 28 deletions docs/RMRK/extension/tokenAttributes/IERC7508.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

*RMRK team*

> IERC7508
> ERC-7508 Public On-Chain NFT Attributes Repository
Interface smart contract of the RMRK token properties extension.
Interface smart contract of Dynamic On-Chain Token Attributes Repository



Expand Down Expand Up @@ -61,39 +61,41 @@ Used to get multiple address parameter values for a token.
### getAttributes

```solidity
function getAttributes(address collection, uint256 tokenId, string[] stringKeys, string[] uintKeys, string[] boolKeys, string[] addressKeys, string[] bytesKeys) external view returns (string[] stringAttributes, uint256[] uintAttributes, bool[] boolAttributes, address[] addressAttributes, bytes[] bytesAttributes)
function getAttributes(address collection, uint256 tokenId, string[] addressKeys, string[] boolKeys, string[] bytesKeys, string[] intKeys, string[] stringKeys, string[] uintKeys) external view returns (address[] addressAttributes, bool[] boolAttributes, bytes[] bytesAttributes, int256[] intAttributes, string[] stringAttributes, uint256[] uintAttributes)
```

Used to retrieve multiple token attributes of any type at once.

*The `StringAttribute`, `UintAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists to the following fields (where `value` is of the appropriate type): [ key, value, ]*
*The `StringAttribute`, `UintAttribute`, `IntAttribute`, `BoolAttribute`, `AddressAttribute` and `BytesAttribute` structs consists to the following fields (where `value` is of the appropriate type): [ key, value, ]*

#### Parameters

| Name | Type | Description |
|---|---|---|
| collection | address | The collection address |
| tokenId | uint256 | The token ID |
| stringKeys | string[] | An array of string type attribute keys to retrieve |
| uintKeys | string[] | An array of uint type attribute keys to retrieve |
| boolKeys | string[] | An array of bool type attribute keys to retrieve |
| addressKeys | string[] | An array of address type attribute keys to retrieve |
| boolKeys | string[] | An array of bool type attribute keys to retrieve |
| bytesKeys | string[] | An array of bytes type attribute keys to retrieve |
| intKeys | string[] | An array of int type attribute keys to retrieve |
| stringKeys | string[] | An array of string type attribute keys to retrieve |
| uintKeys | string[] | An array of uint type attribute keys to retrieve |

#### Returns

| Name | Type | Description |
|---|---|---|
| stringAttributes | string[] | An array of strings, in the same order as the stringKeys |
| uintAttributes | uint256[] | An array of uints, in the same order as the uintKeys |
| boolAttributes | bool[] | An array of bools, in the same order as the boolKeys |
| addressAttributes | address[] | An array of addresses, in the same order as the addressKeys |
| boolAttributes | bool[] | An array of bools, in the same order as the boolKeys |
| bytesAttributes | bytes[] | An array of bytes, in the same order as the bytesKeys |
| intAttributes | int256[] | An array of ints, in the same order as the intKeys |
| stringAttributes | string[] | An array of strings, in the same order as the stringKeys |
| uintAttributes | uint256[] | An array of uints, in the same order as the uintKeys |

### getAttributesMetadataURI
### getAttributesMetadataURIForCollection

```solidity
function getAttributesMetadataURI(address collection) external view returns (string attributesMetadataURI)
function getAttributesMetadataURIForCollection(address collection) external view returns (string attributesMetadataURI)
```

Used to retrieve the attributes metadata URI for a collection, which contains all the information about the collection attributes.
Expand Down Expand Up @@ -208,6 +210,54 @@ Used to get multiple bytes parameter values for a token.
|---|---|---|
| attributes | bytes[] | An array of bytes, in the same order as the attribute keys |

### getIntAttribute

```solidity
function getIntAttribute(address collection, uint256 tokenId, string key) external view returns (int256 attribute)
```

Used to retrieve the int type token attributes.



#### Parameters

| Name | Type | Description |
|---|---|---|
| collection | address | The collection address |
| tokenId | uint256 | The token ID |
| key | string | The key of the attribute |

#### Returns

| Name | Type | Description |
|---|---|---|
| attribute | int256 | The value of the uint attribute |

### getIntAttributes

```solidity
function getIntAttributes(address[] collections, uint256[] tokenIds, string[] attributeKeys) external view returns (int256[] attributes)
```

Used to get multiple int parameter values for a token.



#### Parameters

| Name | Type | Description |
|---|---|---|
| collections | address[] | Addresses of the collections, in the same order as the attribute keys. If all tokens are from the same collection the array can contain a single element with the collection address. |
| tokenIds | uint256[] | IDs of the tokens, in the same order as the attribute keys. If all attributes are for the same token the array can contain a single element with the token ID. |
| attributeKeys | string[] | An array of int keys to retrieve |

#### Returns

| Name | Type | Description |
|---|---|---|
| attributes | int256[] | An array of ints, in the same order as the attribute keys |

### getStringAttribute

```solidity
Expand Down Expand Up @@ -240,7 +290,7 @@ function getStringAttributes(address[] collections, uint256[] tokenIds, string[]

Used to get multiple sting parameter values for a token.

*The `StringAttribute` struct contains the following fields: [ string key, string value ]*


#### Parameters

Expand Down Expand Up @@ -288,7 +338,7 @@ function getUintAttributes(address[] collections, uint256[] tokenIds, string[] a

Used to get multiple uint parameter values for a token.

*The `UintAttribute` struct contains the following fields: [ string key, uint value ]*


#### Parameters

Expand Down Expand Up @@ -359,7 +409,7 @@ function manageAccessControl(address collection, string key, enum IERC7508.Acces

Used to manage the access control settings for a specific parameter.

*Only the `issuer` of the collection can call this function.The possible `accessType` values are: [ Issuer, Collaborator, IssuerOrCollaborator, TokenOwner, SpecificAddress, ]Emits an {AccessControlUpdated} event.*
*Only the `owner` of the collection can call this function.The possible `accessType` values are: [ Owner, Collaborator, OwnerOrCollaborator, TokenOwner, SpecificAddress, ]Emits an {AccessControlUpdated} event.*

#### Parameters

Expand Down Expand Up @@ -466,6 +516,32 @@ Used to retrieve the message to be signed for submitting a presigned bytes attri
|---|---|---|
| message | bytes32 | Raw message to be signed by the authorized account |

### prepareMessageToPresignIntAttribute

```solidity
function prepareMessageToPresignIntAttribute(address collection, uint256 tokenId, string key, int256 value, uint256 deadline) external view returns (bytes32 message)
```

Used to retrieve the message to be signed for submitting a presigned int attribute change.



#### Parameters

| Name | Type | Description |
|---|---|---|
| collection | address | The address of the collection smart contract of the token receiving the attribute |
| tokenId | uint256 | The ID of the token receiving the attribute |
| key | string | The attribute key |
| value | int256 | The attribute value |
| deadline | uint256 | The deadline timestamp for the presigned transaction after which the message is invalid |

#### Returns

| Name | Type | Description |
|---|---|---|
| message | bytes32 | Raw message to be signed by the authorized account |

### prepareMessageToPresignStringAttribute

```solidity
Expand Down Expand Up @@ -590,6 +666,30 @@ Used to set the bytes attribute on behalf of an authorized account.
| r | bytes32 | `r` value of an ECDSA signature of the presigned message |
| s | bytes32 | `s` value of an ECDSA signature of the presigned message |

### presignedSetIntAttribute

```solidity
function presignedSetIntAttribute(address setter, address collection, uint256 tokenId, string key, int256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable
```

Used to set the int attribute on behalf of an authorized account.

*Emits a {IntAttributeUpdated} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| setter | address | Address of the account that presigned the attribute change |
| collection | address | Address of the collection receiving the attribute |
| tokenId | uint256 | The ID of the token receiving the attribute |
| key | string | The attribute key |
| value | int256 | The attribute value |
| deadline | uint256 | The deadline timestamp for the presigned transaction |
| v | uint8 | `v` value of an ECDSA signature of the presigned message |
| r | bytes32 | `r` value of an ECDSA signature of the presigned message |
| s | bytes32 | `s` value of an ECDSA signature of the presigned message |

### presignedSetStringAttribute

```solidity
Expand Down Expand Up @@ -641,7 +741,7 @@ Used to set the uint attribute on behalf of an authorized account.
### registerAccessControl

```solidity
function registerAccessControl(address collection, address issuer, bool useOwnable) external nonpayable
function registerAccessControl(address collection, address owner, bool useOwnable) external nonpayable
```

Used to register a collection to use the RMRK token attributes repository.
Expand All @@ -653,8 +753,8 @@ Used to register a collection to use the RMRK token attributes repository.
| Name | Type | Description |
|---|---|---|
| collection | address | The address of the collection that will use the RMRK token attributes repository. |
| issuer | address | The address of the issuer of the collection. |
| useOwnable | bool | 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`). |
| owner | address | The address of the owner of the collection. |
| useOwnable | bool | 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 owner (`true`) or to use the manually set owner address (`false`). |

### setAddressAttribute

Expand Down Expand Up @@ -696,7 +796,7 @@ function setAddressAttributes(address[] collections, uint256[] tokenIds, IERC750
### setAttributes

```solidity
function setAttributes(address collection, uint256 tokenId, IERC7508.StringAttribute[] stringAttributes, IERC7508.UintAttribute[] uintAttributes, IERC7508.BoolAttribute[] boolAttributes, IERC7508.AddressAttribute[] addressAttributes, IERC7508.BytesAttribute[] bytesAttributes) external nonpayable
function setAttributes(address collection, uint256 tokenId, IERC7508.AddressAttribute[] addressAttributes, IERC7508.BoolAttribute[] boolAttributes, IERC7508.BytesAttribute[] bytesAttributes, IERC7508.IntAttribute[] intAttributes, IERC7508.StringAttribute[] stringAttributes, IERC7508.UintAttribute[] uintAttributes) external nonpayable
```


Expand All @@ -709,16 +809,17 @@ function setAttributes(address collection, uint256 tokenId, IERC7508.StringAttri
|---|---|---|
| collection | address | undefined |
| tokenId | uint256 | undefined |
| stringAttributes | IERC7508.StringAttribute[] | undefined |
| uintAttributes | IERC7508.UintAttribute[] | undefined |
| boolAttributes | IERC7508.BoolAttribute[] | undefined |
| addressAttributes | IERC7508.AddressAttribute[] | undefined |
| boolAttributes | IERC7508.BoolAttribute[] | undefined |
| bytesAttributes | IERC7508.BytesAttribute[] | undefined |
| intAttributes | IERC7508.IntAttribute[] | undefined |
| stringAttributes | IERC7508.StringAttribute[] | undefined |
| uintAttributes | IERC7508.UintAttribute[] | undefined |

### setAttributesMetadataURI
### setAttributesMetadataURIForCollection

```solidity
function setAttributesMetadataURI(address collection, string attributesMetadataURI) external nonpayable
function setAttributesMetadataURIForCollection(address collection, string attributesMetadataURI) external nonpayable
```

Used to set the metadata URI for a collection, which contains all the information about the collection attributes.
Expand Down Expand Up @@ -806,6 +907,43 @@ function setBytesAttributes(address[] collections, uint256[] tokenIds, IERC7508.
| tokenIds | uint256[] | undefined |
| attributes | IERC7508.BytesAttribute[] | undefined |

### setIntAttribute

```solidity
function setIntAttribute(address collection, uint256 tokenId, string key, int256 value) external nonpayable
```

Used to set a signed number attribute.

*Emits a {IntAttributeUpdated} event.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| collection | address | Address of the collection receiving the attribute |
| tokenId | uint256 | The token ID |
| key | string | The attribute key |
| value | int256 | The attribute value |

### setIntAttributes

```solidity
function setIntAttributes(address[] collections, uint256[] tokenIds, IERC7508.IntAttribute[] attributes) external nonpayable
```





#### Parameters

| Name | Type | Description |
|---|---|---|
| collections | address[] | undefined |
| tokenIds | uint256[] | undefined |
| attributes | IERC7508.IntAttribute[] | undefined |

### setStringAttribute

```solidity
Expand Down Expand Up @@ -849,7 +987,7 @@ function setStringAttributes(address[] collections, uint256[] tokenIds, IERC7508
function setUintAttribute(address collection, uint256 tokenId, string key, uint256 value) external nonpayable
```

Used to set a number attribute.
Used to set an unsigned number attribute.

*Emits a {UintAttributeUpdated} event.*

Expand Down Expand Up @@ -909,7 +1047,7 @@ function supportsInterface(bytes4 interfaceId) external view returns (bool)
### AccessControlRegistration

```solidity
event AccessControlRegistration(address indexed collection, address indexed issuer, address indexed registeringAddress, bool useOwnable)
event AccessControlRegistration(address indexed collection, address indexed owner, address indexed registeringAddress, bool useOwnable)
```

Used to notify listeners that a new collection has been registered to use the repository.
Expand All @@ -921,9 +1059,9 @@ Used to notify listeners that a new collection has been registered to use the re
| Name | Type | Description |
|---|---|---|
| collection `indexed` | address | Address of the collection |
| issuer `indexed` | address | Address of the issuer of the collection; the addess authorized to manage the access control |
| owner `indexed` | address | Address of the owner of the collection; the addess authorized to manage the access control |
| registeringAddress `indexed` | address | Address that registered the collection |
| useOwnable | bool | A boolean value indicating whether the collection uses the Ownable extension to verify the issuer (`true`) or not (`false`) |
| useOwnable | bool | A boolean value indicating whether the collection uses the Ownable extension to verify the owner (`true`) or not (`false`) |

### AccessControlUpdate

Expand Down Expand Up @@ -1019,6 +1157,25 @@ Used to notify listeners that a new collaborator has been added or removed.
| collaborator `indexed` | address | Address of the collaborator |
| isCollaborator | bool | A boolean value indicating whether the collaborator has been added (`true`) or removed (`false`) |

### IntAttributeUpdated

```solidity
event IntAttributeUpdated(address indexed collection, uint256 indexed tokenId, string key, int256 value)
```

Used to notify listeners that an int attribute has been updated.



#### Parameters

| Name | Type | Description |
|---|---|---|
| collection `indexed` | address | The collection address |
| tokenId `indexed` | uint256 | The token ID |
| key | string | The key of the attribute |
| value | int256 | The new value of the attribute |

### MetadataURIUpdated

```solidity
Expand Down
Loading

0 comments on commit b0f1ca6

Please sign in to comment.