Indigo eDSL

Indigo eDSL is a high level language for Michelson contract development.

It is meant first and foremost to free you from the burden of manual stack management and supports common features of imperative languages.

Even with a very small example the difference in ease of use is quite visible:

exampleContract :: IndigoContract Integer Integer
exampleContract param = defContract do
  a <- new$ 1 int
  storageVar =: param + a

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 };

Overall idea

Michelson contracts are stack-based and often follow the repetitive pattern of copying the required values on top of the stack to apply an instruction to them. Indigo can associate variables to values in the stack and it's able to refer to them in order to handle this pattern automatically.

In addition to this it can override existing variables with new values, allowing the manipulation of the stack to be automatic.

Leveraging this ability, it also supports features such as: imperative statements (if, while, ...), expressions, operators (+, ||, ==, ...), scoped functions definition and errors.

Indigo is built on top of Lorentz, which in turn is built on top of Morley, a dialect that is a superset of vanilla Michelson. If you are interested more in the relationships between these projects you can head over to the repo on GitLab.

Indigo uses Morley to map values from Michelson to Haskell and to compile to Michelson code (or to any of the other projects in the chain mentioned above).

Learning and using Indigo

An introduction to the syntax and the features of the Indigo language, as well as instructions on how to use it, are available in the form of a step-by-step tutorial.

This aims to be accessible to as many people as possible, but also contains more technical informations for Haskell developers that are interested in learning more.

For this reason anyone interested in learning more about the language in practice should start by taking a look at its Getting started page.

Additional documentation

In addition to the tutorial, this documentation contains full reference pages and, as for the other Morley projects, Indigo has Haddock documentation.