How to deploy ligo contract to Tezos
Purpose
For Maintenance
Procedures
Assuming folder structure is like
code:markdown
- tezos
- scripts
- localnet.sh
- ligo
- main.ligo
- storage.tz
- main.tz
Get the latest CEL-customized ligo
You can get it via Dockerhub
Compile ligo resources into bytecode and initial values
code:bash
cd ./ligo
# This ligo command is different from current directory and
# this executable is in /usr/local/bin/ligo
ligo compile-storage main.ligo main "echo $(cat initial_storage)" > storage.tz
ligo compile-contract main.ligo main > ./main.tz
Initial Storage is very initial value of the contract. In solidity, constructor of a contract is doing the same thing.
Storage syntax is a bit tricky. You can find here doc ref For src/contracts/test/level_lock.ligo
code:bash
cat initial_storage
# record
# balances = map
# ("tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV": address) -> record
# unlock_level = 1;
# amount = 1mutez;
# end;
# end;
# end
ligo compile-storage src/test/contracts/level_lock.ligo main "echo $(cat initial_storage)" > storage.tz
ligo compile-contract src/test/contracts/level_lock.ligo main > ./main.tz
Deploy them to Tezos
Run below
code:bash
./scripts/localnet.sh client originate contract ovm_contract for my_identity transferring 2.01 from my_account running container:../ligo/main.tz -init 'cat ../ligo/storage.tz'
# originate contract <new> transferring <qty> from <src> running <prg> --fee <amount> ovm_contract is arbitrary contract nickname.
Replace my_identity with funded identity
Replace my_account with funded account