Skip to content

Add struct functionality #27

@rkalis

Description

@rkalis

Structs can be defined by the implementer of a contract like this:

struct PriceMessage {
    bytes4 blockheight;
    bytes4 price;
}

The CashScript SDK can automatically serialise JSON data into a byte array containing these concatenated struct members. This serialised struct can then be passed into a contract function and the compiled script can use OP_SPLIT and OP_BIN2NUM to extract the correct struct members where needed.

To make sure the components can be extracted, they should use sized bytes types, so the usefulness of these structs is dependent on issue #20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cashc-compilerRelates to the cashc compiler

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions