Attributes

What are Attributes?

Attributes are named key/value pairs that can be assigned to individual Marble NFTs to represent any kind of numerical value associated with an NFT. Since attributes are attached to individual NFTs they will travel with changes in ownership as well.

Common attribute names are ones likelevel, experience, strength, height, and bananas.

Table Breakdown

Table Name: attributes

Table Scoping: nft.serial

Field Name

Field Type

Description

attribute_name

name

Attribute name identifier (Primary Key).

points

uint64_t

Point value for attribute.

No extra indices.

Creating an Attribute

To assign a new attribute to an NFT call the newattribute() action.

Required Authority: group.manager

Action Parameters

  • uint64_t serial: The serial number of the NFT to be assigned the attribute.

  • name attribute_name: The name of the new attribute to assign.

  • int64_t initial_points: The initial point value the attribute will start with.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} newattribute '[ {params} ]' -p {manager}
Marble CLI
marble make attribute ...

Set Attribute Points

To set an attribute's points to a specific value call the setpoints() action.

Required Authority: group.manager

Action Parameters

  • uint64_t serial: The serial number of the NFT with the attribute to affect.

  • name attribute_name: The name of the attribute to affect.

  • int64_t new_points: The new point value of the attribute.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} setpoints '[ {params} ]' -p {manager}
Marble CLI
marble modify ...

Increase Points

To increase an attribute's points call theincreasepts() action.

Required Authority: group.manager

Action Parameters

  • uint64_t serial: The serial number of the NFT to affect.

  • name attribute_name: The name of the attribute to affect.

  • uint64_t points_to_add: The number of whole points to add to the attribute.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} increasepts '[ {params} ]' -p {manager}
Marble CLI
marble modify ...

Decrease Points

To decrease an attribute's points call the decreasepts() action.

Required Authority: group.manager

Action Parameters

  • uint64_t serial: The serial number of the NFT to affect.

  • name attribute_name: The name of the attribute to affect.

  • uint64_t points_to_subtract: The number of whole points to subtract from the attribute.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} decreasepts '[ {params} ]' -p {manager}
Marble CLI
marble modify ...

Remove an Attribute

To remove an attribute from an NFT call the rmvattribute() action.

Required Authority: group.manager

Action Parameters

  • uint64_t serial: The serial number of the NFT to affect.

  • name attribute_name: The name of the attribute to remove.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} rmvattribute '[ {params} ]' -p {manager}
Marble CLI
marble remove ...