A tuple is a list of anonymous values of different types. The type is a list of types separated by
*. A tuple litteral is a list of values separated by
, and surrounded by parentheis.
It is represented in Michelson as a right-comb pair of values.
A record is a list of named fields of different types. It is declared by the
record keyword followed by a list of pairs of an identifier and a basic type or a composite type. It cannot be recursive though.
It is possible to specify the default value of a record field.
For example, the following declaration specifies that the default values of
The effect is that fields with a default value may not be specified when creating a record value. For example, the following creates a
voter record without specified values for these fields:
By default, the Michelson structure of a record is a right comb of pairs.
It means for example that the Michelson type of the
voter record declared above is:
It is possible to specify another structure and/or other field names, with the
as keyword, as illustrated below:
The resulting Michelson type is then:
For example, the type
RGB below is the tuple of 3
When named types have no argument (like in
juice_size example above), they are represented by an
int value from
n is the number of named types.
With argument (like in
color example above), named types are represented with imbricated
or values. For example the Michelson type of
When designing the contract as a state machine, the
states keyword is used to declare the list of states.
One state may be followed by the
initial keyword to specify the initial machine's state. If omitted, the first state is the initial state.
The Michelson representation of the contract state is a storage variable named
_state and typed
Archetype defines events with the
event keyword declaration. An event may possess several fields, like a record.
For example the following declares the HighestBidIncreased event with two fields bidder and amount: