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 like level, experience, strength, height, or bananas.

Table Breakdown

Table Name: attributes

Table Scope: item.serial

Field Name

Field Type

Description

attribute_name

name

Attribute name identifier (Primary Key).

points

uint64_t

Point value for attribute.

locked

bool

Attribute locked state.

No extra indices.

Creating an Attribute

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

Required Authority: group.manager

Action Parameters

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the Item to be assigned the attribute.

attribute_name

name

health

The name of the new attribute to assign.

initial_points

int64_t

true

The initial points 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

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the item with the attribute to affect.

attribute_name

name

health

The name of the attribute to affect.

new_points

int64_t

25

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

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the Item with the attribute to affect.

attribute_name

name

health

The name of the attribute to affect.

points_to_add

uint64_t

10

The number of points to add to the current attribute points.

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

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the Item to affect.

attribute_name

name

health

The name of the attribute to affect.

points_to_subtract

uint64_t

10

The number of points to subtract from the current attribute points.

Examples

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

Lock an Attribute

Lock an attribute and prevent future updates with the lockattr() action.

Required Authority: group.manager

Action Parameters

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the Item with the behavior to lock.

attribute_name

name

level

The name of the attribute to lock.

Examples

Cleos
Marble CLI
Cleos
cleos push action {account} lockattr '[ ... ]' -p {account}
Marble CLI
marble lock ...

Remove an Attribute

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

Required Authority: group.manager

Action Parameters

Name

Type

Example

Description

serial

uint64_t

5

The serial number of the Item with the attribute to remove.

attribute_name

name

health

The name of the attribute to remove.

Examples

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