Base Types
Numerical (nat, int, timestamp, mutez)
Nat
Nat type represents natural numbers (positive integers U { 0 }); a nat literal should be always followed by an n.
A nat value can be converted to int type using the int(nat) builtin function:
Int
Int type represents integer numbers; we define an int:
We can check if the int is a nat:
Transform an int to a nat:
And negate a nat or int (the result type is always an int):
Mutez
Mutez type represents a tez amount. A mutez literal si preceeded by mtz or tz; 1000000mtz = 1tz.
Timestamp
Timestamp type represent an unix timestamp (seconds since Jan 01 1970).
We also have an helper called Timestamp.duration which produces an int value for a duration.
We can get the current timestamp using the now function:
Bool
Bool type represents a boolean, which has two possible values: true and false.
Enum
Enum type are unit variants; low level are represented as nat, so they are comparable (only for equality).
String
String are sequences of characters.
We can get the length of a string with size:
And get a slice:
Bytes
Bytes are sequences of bytes. Like strings you can get the length and a slice.
Bytes type is useful for encoding/decoding Michelson data using pack and unpack:
Unit
The unit type is a type which has only a value Unit.
Last updated