toplevel
type string
type bytes
type int
type nat
type unit
type operation
type tez
type address
type signature
type key
type key_hash
type timestamp
type list
type big_map
type map
type set
type contract
type michelson_or
type michelson_pair
type chain_id
type baker_hash
type pvss_key
type sapling_state
type sapling_transaction
type baker_operation
type bls12_381_g1
type bls12_381_g2
type bls12_381_fr
type never
type ticket
type chest
type chest_key
type external_ediv
type external_and
type external_or
type external_xor
type external_lsl
type external_lsr
type external_bytes
type entrypoint<param, storage> = (_: param) => (_: storage) => [list<operation>, storage]
Type of entrypointstype bool = bool
Type of the booleans. Note: Values true
and false
are
predefined constants.
type option<a> = option<a>
Type of optional values. They are useful, for example, when a
function can fail, but the caller wants to be able to handle the
failure, which is then denoted by the result None()
. Note:
Assertions and failwith
do not allow handling.
let unit: unit
Unit type. It is useful for typing side-effects, for example failures, some iterators and implicit accounts.let ignore: <a>(_: a) => unit
The call ignore(v)
evaluates v
and ignores its value, returning
instead the unit value. This is useful when the argument of ignore
performs side-effects.
let curry: <a, b, c>(_: (_: [a, b]) => c) => (_: a) => (_: b) => c
**Deprecated:** In a future version, this function will be deprecated, and using `Tuple2.curry` is encouraged for a smoother migration.The call curry(f,x,y)
has the same value as f(x,y)
.
let uncurry: <a, b, c>(_: (_: a) => (_: b) => c) => (_: [a, b]) => c
**Deprecated:** In a future version, this function will be deprecated, and using `Tuple2.uncurry` is encouraged for a smoother migration.The call uncurry(f,[x,y])
has the same value as f(x)(y)
.
let fst: <a, b>(_: [a, b]) => a
**Deprecated:** In a future version, this function will be deprecated, and using `Tuple2.get1` is encouraged for a smoother migration.Projecting the first component of a pair
let snd: <a, b>(_: [a, b]) => b
**Deprecated:** In a future version, this function will be deprecated, and using `Tuple2.get2` is encouraged for a smoother migration.Projecting the second component of a pair.
let failwith: <err, a>(_: err) => a
The call failwith(e)
terminates the execution with the value e
,
standing for an error. Note: Using a string for an error message can
be costly in terms of size.
let bytes: <a>(_: a) => external_bytes<a>
The function `bytes` encodes an integer or a natural number to bytes using the big-endian encoding. For integers, negative numbers are considered in two's complement representation.let assert_with_error: (_: bool) => (_: string) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.Error.assert` is encouraged for a smoother migration.The call assert_with_error(cond, error)
terminates the execution
with the string error
(that is, an error message) if, and only if,
the boolean condition cond
is false.
let assert: (_: bool) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.assert` is encouraged for a smoother migration.The call assert(cond)
terminates the execution with the string
"failed assertion"
if, and only if, the boolean condition cond
is false.
let assert_some_with_error: <a>(_: option<a>) => (_: string) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.Error.some` is encouraged for a smoother migration.The call assert_some_with_error(opt, err)
terminates the execution
with the string err
(that is, an error message) if, and only if,
opt
is None()
.
let assert_some: <a>(_: option<a>) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.some` is encouraged for a smoother migration.The call assert_some(opt)
terminates the execution with the
string "failed assert some"
if, and only if, opt
is None()
.
let assert_none_with_error: <a>(_: option<a>) => (_: string) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.Error.none` is encouraged for a smoother migration.The call assert_none_with_error(opt, err)
terminates the execution
with the string err
(that is, an error message) if, and only if,
opt
is an optional value different from None()
.
let assert_none: <a>(_: option<a>) => unit
**Deprecated:** In a future version, this function will be deprecated, and using `Assert.none` is encouraged for a smoother migration.The call assert_none(opt)
terminates the execution with the string
"failed assert none"
if, and only if, opt
is not None()
.
let abs: (_: int) => nat
The call abs(i)
is the absolute value of i
.
let is_nat: (_: int) => option<nat>
The call is_nat(i)
is Some(n)
, where n
is the absolute
value of i
, if, and only if, i
is positive or zero.
let int: <a>(_: a) => int
The call int(v)
casts the value v
to an integer.
For natural numbers, the function int
is the identity cast from
nat
to int
. For BLS12-381 field elements, the returned value is
always between 0 (inclusive) and the order of the BLS12-381 field
(exclusive). For bytes, the function int
decodes the bytes using
the big-endian encoding, where negative numbers are considered in
two's complement representation.
let nat: (_: bytes) => nat
The call nat(b)
casts the bytes b
into a natural number.
let ediv: <a, b>(_: a) => (_: b) => external_ediv<a, b>
The call ediv(z1, z2)
, where z1
and z2
are either of type
int
or nat
, returns None()
if z2
is zero; otherwise, it
returns the pair [q,r]
, where q
is the quotient and r
the
positive remainder, as is the convention of the mathematical
Euclidian division. The function ediv
is also overloaded to work
on values of type tez
. When z1
and z2
are of type tez
and
z2
is nonzero, we get a nat
quotient and a tez
remainder. When z1
is a tez
and z2
is a nonzero nat
, the
calls yields a quotient and a remainder both of type tez
.
type big_set<elt> = Big_set.t<elt>
The type of the big sets is based on big_map
.
type dynamic_entrypoints = big_map<nat, bytes>
Dynamic entrypointsDynamic entrypoints are lazy entrypoints stored in the contract within a big_map. They can then be updated or removed without deploying a new contract.
A contract with dynamic entrypoints must have at least one @entry
declaration (as any other contract); it also must obey some
convention on storage type definition and have at least one
@dyn_entry
declaration.
LIGO will then include the defined dynamic entries into the contract initial storage.