Toplevel

These functions are available without any needed prefix.

function is_nat: int -> option(nat)

Convert an int to a nat if possible.

Note that Michelson.is_nat is deprecated. Please use is_nat instead.

function abs: int -> nat

Cast an int to nat.

function int: nat -> int

Cast an nat to int.

const unit: unit

A helper to create a unit.

function failwith : string -> unit

Cause the contract to fail with an error message.

⚠ Using this currently requires in general a type annotation on the failwith call.

function assert : bool -> unit

Check if a certain condition has been met. If not the contract will fail.

function ediv : int -> int -> option (int * nat)
function ediv : mutez -> nat -> option (mutez * mutez)
function ediv : mutez -> mutez -> option (nat * mutez)
function ediv : nat -> nat -> option (nat * nat)

Compiles to Michelson EDIV, one operation to get both the quotient and remainder of a division. ediv x y returns None if y is zero, otherwise returns Some (quotient, remainder) such that x = (quotient * y) + remainder and 0 <= remainder < abs(y).