From 57b1d39b6ea72b688026197747a55438259a18bf Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Thu, 29 Aug 2019 17:25:35 +0200 Subject: [PATCH] New contract in CameLIGO, based on the tutorial. (Not called from the CI.) --- src/contracts/incr_decr.mligo | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/contracts/incr_decr.mligo diff --git a/src/contracts/incr_decr.mligo b/src/contracts/incr_decr.mligo new file mode 100644 index 000000000..6e2f7e8f9 --- /dev/null +++ b/src/contracts/incr_decr.mligo @@ -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