ligo/src/test/contracts/match_bis.mligo
John David Pressman 71989876db Fix a bug, test added:
A never accounted message was not adding anything to the map
2020-01-08 20:58:26 +00:00

20 lines
450 B
Plaintext

type storage = int
(* variant defining pseudo multi-entrypoint actions *)
type action =
Increment of int
| Decrement of int
let add (a: int) (b: int) : int = a + b
let sub (a: int) (b: int) : int = a - b
(* real entrypoint that re-routes the flow based on the action provided *)
let main (p, s: action * storage) =
let storage =
match p with
Increment n -> add s n
| Decrement n -> sub s n
in ([] : operation list), storage