Skip to content

Traits encoded in Reserve Address #21

@runvnc

Description

@runvnc

I am planning to start putting the trait data in the Reserve Address field (in addition to the config notes). I don't see another option that will allow smart contracts to access it.

Example: item has color, and power traits. 3 different colors (0 - bronze 1 - silver, 2 - gold), and power from 0 to 100. So say the item is color: silver and power: 50 the reserve address (as a byte array) would be something like

[1,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

This will allow for the development of games that run on chain. For example (forgive me if I am getting some details wrong, just a hypothetical I haven't tried), a battle between two characters (represented as ASAs) can use the Txn.ForeignAssets to pass in two fighting characters, then access the asset params, generate a random number and weight it with the second (or 31st?) byte (the power level) and compare the two to see which character wins the fight round. Etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions