Example.hs 663 Bytes
Newer Older
Kirill Elagin's avatar
Kirill Elagin committed
1 2 3 4
-- SPDX-FileCopyrightText: 2020 Tocqueville Group
--
-- SPDX-License-Identifier: LicenseRef-MIT-TQ

5
module Indigo.Tutorial.GettingStarted.Example
6 7 8 9 10 11
  ( exampleContract
  ) where

import Indigo

exampleContract :: IndigoContract Integer Integer
12 13
exampleContract param = defContract do
  a <- new$ 1 int
14
  storageVar =: param + a
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

{-
Resulting Michelson Contract:

parameter int;
storage int;
code { NIL operation;
       SWAP;
       DUP;
       CAR;
       DIP { CDR };
       PUSH int 1;
       DUP;
       DIP 2
           { DUP };
       DIG 2;
       ADD;
       DIP 3
           { DROP };
       DUG 2;
       DROP;
       DROP;
       SWAP;
       PAIR };

-}