UNPKG

code-example

Version:
20 lines (19 loc) 629 B
const code = `type storage = int type parameter = Increment of int | Decrement of int | Reset type return = operation list * storage // Two entrypoints let add (store, delta : storage * int) : storage = store + delta let sub (store, delta : storage * int) : storage = store - delta (* Main access point that dispatches to the entrypoints according to the smart contract parameter. *) let main (action, store : parameter * storage) : return = ([] : operation list), // No operations (match action with Increment (n) -> add (store, n) | Decrement (n) -> sub (store, n) | Reset -> 0) `; export default code;