New contract in CameLIGO, based on the tutorial. (Not called from the CI.)
This commit is contained in:
parent
3f47bb2e85
commit
57b1d39b6e
20
src/contracts/incr_decr.mligo
Normal file
20
src/contracts/incr_decr.mligo
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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 subtract (a : int) (b : int) : int = a - b
|
||||||
|
|
||||||
|
(* real entrypoint that re-routes the flow based on the action provided *)
|
||||||
|
|
||||||
|
let%entry main (p : action) storage =
|
||||||
|
let storage =
|
||||||
|
match p with
|
||||||
|
| Increment n -> add s n
|
||||||
|
| Decrement n -> subtract s n
|
||||||
|
in ([] : operation list), storage
|
Loading…
Reference in New Issue
Block a user