Skip to main content

Ithaca

API

New primitives / behaviour

Subtraction operator -

The behaviour of the subtraction operator - on values of type tez has been changed in protocol Ithaca.

Subtracting values of type tez yeilds on optional value. (This emits the SUB_MUTEZ Michelson instruction)


const d : option (tez) = 5mutez - 1mutez (* Some (4mutez) *)

const e : option (tez) = 1mutez - 5mutez (* None *)

let d : tez option = 5mutez - 1mutez (* Some (4mutez) *)
let e : tez option = 1mutez - 5mutez (* None *)

let d : option<tez> = (5 as mutez) - (1 as mutez); /* Some (4mutez) */
let e : option<tez> = (1 as mutez) - (5 as mutez); /* None */

Option Module

val map : ('a -> 'b) -> option ('a) -> option ('b)

val map : ('a -> 'b) -> 'a option -> 'b option

let map: (f : ((item: 'a) => 'b), value : option<'a>) => option<'b>

Applies the mapper function to the value if it is wrapped in the Some constructor.

If the value is None the function is not executed/applied.

Feature no longer supported

Test

val set_now : timestamp -> unit

val set_now : timestamp -> unit

let set_now = (now: timestamp) => unit

We no longer support Test.set_now in LIGO 0.38.0 onwards, this is because the underlying functions used by the LIGO Testing framework do not support setting exact timestamps.