Skip to main content
Version: 1.2.0

CLI Commands

Contracts written in LIGO can be compiled using the ligo executable.

Compiling a contract

Compile your contract.

ligo compile contract SOURCE_FILE

Example

ligo compile contract examples/counter.mligo

Compiling a view

Compile a view.

ligo compile view SOURCE_FILE VIEW_NAME

Example

ligo compile view examples/counter.mligo v1

Defining the initial storage

If your contract implements a sophisticated storage, you can compile a LIGO expression into a Michelson value quite easily.

ligo compile storage SOURCE_FILE EXPRESSION --entry-point ENTRY_POINT

Example

ligo compile storage examples/counter.mligo 5
# Outputs: 5

Invoking the contract with a parameter

ligo compile parameter SOURCE_FILE EXPRESSION

Example

ligo compile parameter examples/counter.mligo "Increment(5)" --entry-point main
# Outputs: (Right 5)