ligo/src/test/contracts/big_map.ligo

37 lines
869 B
Plaintext
Raw Normal View History

2019-09-04 19:05:45 +02:00
type storage_ is big_map(int, int) * unit
type foo is big_map(int, int)
function main(const p : unit; const s : storage_) : list(operation) * storage_ is
2019-09-03 18:33:30 +02:00
block {
var toto : option (int) := Some(0);
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 : foo) : foo is block {
m[23] := n ;
2019-09-05 17:23:51 +02:00
} with m
function rm (var m : foo) : foo is block {
remove 42 from map m;
2019-09-05 17:23:51 +02:00
} with m
function gf (const m : foo) : int is begin skip end with get_force(23, m)
2019-09-05 17:23:51 +02:00
function get (const m : foo) : option(int) is begin skip end with m[42]
2019-10-18 17:52:26 +02:00
const empty_big_map : big_map(int,int) = big_map end
const big_map1 : big_map(int,int) = big_map
2019-10-18 17:52:26 +02:00
23 -> 0 ;
42 -> 0 ;
end
function mutimaps (const m : foo ; const n : foo) : foo is block
{
var bar : foo := m ;
bar[42] := 0 ;
n[42] := get_force(42, bar) ;
} with n