2019-05-13 17:55:32 +04:00
|
|
|
---
|
2019-11-09 18:40:53 +04:00
|
|
|
id: cli-commands
|
2019-05-13 17:55:32 +04:00
|
|
|
title: CLI Commands
|
|
|
|
---
|
|
|
|
|
2020-05-05 06:35:03 +04:00
|
|
|
Contracts written in LIGO can be compiled using the `ligo` executable.
|
2019-05-13 17:55:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
## Compiling a contract
|
|
|
|
|
|
|
|
Compile your contract with a specific entry point.
|
|
|
|
|
|
|
|
```zsh
|
|
|
|
ligo compile-contract SOURCE_FILE [ENTRY_POINT]
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example
|
|
|
|
|
|
|
|
```zsh
|
|
|
|
ligo compile-contract examples/counter.ligo main
|
|
|
|
```
|
|
|
|
|
|
|
|
## Defining the initial storage
|
|
|
|
|
|
|
|
If your contract implements a sophisticated storage, you can compile a Ligo expression into a Michelson value quite easily.
|
|
|
|
|
|
|
|
```zsh
|
|
|
|
ligo compile-storage SOURCE_FILE ENTRY_POINT EXPRESSION
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example
|
|
|
|
```zsh
|
|
|
|
ligo compile-storage examples/counter.ligo main 5
|
|
|
|
# Outputs: 5
|
|
|
|
```
|
|
|
|
|
|
|
|
## Invoking the contract with a parameter
|
|
|
|
|
|
|
|
```zsh
|
|
|
|
ligo compile-parameter SOURCE_FILE ENTRY_POINT EXPRESSION
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example
|
|
|
|
```zsh
|
|
|
|
ligo compile-parameter examples/counter.ligo main "Increment(5)"
|
|
|
|
# Outputs: (Right 5)
|
|
|
|
```
|