ligo/src/test/contracts/big_map.ligo

21 lines
598 B
Plaintext
Raw Normal View History

2019-09-04 19:05:45 +02:00
type storage_ is big_map(int, int) * unit
function main(const p : unit; const s : storage_) : list(operation) * storage_ is
2019-09-03 18:33:30 +02:00
var toto : option (int) := Some(0);
block {
2019-10-18 17:36:33 +02:00
toto := s.0[23];
s.0[2] := 444;
2019-09-03 18:33:30 +02:00
}
2019-09-05 17:23:51 +02:00
with ((nil: list(operation)), s)
function set_ (var n : int ; var m : storage_) : storage_ is block {
2019-10-18 17:36:33 +02:00
m.0[23] := n ;
2019-09-05 17:23:51 +02:00
} with m
function rm (var m : storage_) : storage_ is block {
2019-10-18 17:36:33 +02:00
remove 42 from map m.0;
2019-09-05 17:23:51 +02:00
} with m
function gf (const m : storage_) : int is begin skip end with get_force(23, m.0)
2019-10-18 17:36:33 +02:00
function get (const m : storage_) : option(int) is begin skip end with m.0[42]