ligo/src/bin/expect_tests/contract_tests.ml

1209 lines
46 KiB
OCaml
Raw Normal View History

2019-11-22 00:06:34 +04:00
open Cli_expect
let contract basename =
"../../test/contracts/" ^ basename
2020-01-20 22:40:45 +04:00
let bad_contract basename =
"../../test/contracts/negative/" ^ basename
2019-11-22 00:06:34 +04:00
2019-11-26 03:30:12 +04:00
let%expect_test _ =
run_ligo_good [ "measure-contract" ; contract "coase.ligo" ; "main" ] ;
2019-12-04 21:30:52 +04:00
[%expect {| 1747 bytes |}] ;
2019-11-26 03:30:12 +04:00
run_ligo_good [ "measure-contract" ; contract "multisig.ligo" ; "main" ] ;
[%expect {| 1324 bytes |}] ;
2019-11-26 03:30:12 +04:00
run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ;
[%expect {| 3231 bytes |}] ;
2019-11-26 03:30:12 +04:00
run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ;
[%expect {| 642 bytes |}] ;
2019-11-26 03:30:12 +04:00
2019-12-18 19:35:17 +04:00
run_ligo_good [ "compile-parameter" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ;
[%expect {| (Left (Left 1)) |}] ;
run_ligo_good [ "compile-storage" ; contract "coase.ligo" ; "main" ; "record cards = (map end : cards) ; card_patterns = (map end : card_patterns) ; next_id = 3n ; end" ] ;
[%expect {| (Pair (Pair {} {}) 3) |}] ;
run_ligo_bad [ "compile-storage" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
ligo: different kinds: {"a":"record[card_patterns -> (TO_Map (nat,record[coefficient -> mutez , quantity -> nat])) , cards -> (TO_Map (nat,record[card_owner -> address , card_pattern -> nat])) , next_id -> nat]","b":"sum[Buy_single -> record[card_to_buy -> nat] , Sell_single -> record[card_to_sell -> nat] , Transfer_single -> record[card_to_transfer -> nat , destination -> address]]"}
2020-01-08 14:54:21 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}] ;
2019-12-18 19:35:17 +04:00
run_ligo_bad [ "compile-parameter" ; contract "coase.ligo" ; "main" ; "record cards = (map end : cards) ; card_patterns = (map end : card_patterns) ; next_id = 3n ; end" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
ligo: different kinds: {"a":"sum[Buy_single -> record[card_to_buy -> nat] , Sell_single -> record[card_to_sell -> nat] , Transfer_single -> record[card_to_transfer -> nat , destination -> address]]","b":"record[card_patterns -> (TO_Map (nat,record[coefficient -> mutez , quantity -> nat])) , cards -> (TO_Map (nat,record[card_owner -> address , card_pattern -> nat])) , next_id -> nat]"}
2020-01-08 14:54:21 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}] ;
2019-12-18 19:35:17 +04:00
2019-11-26 03:30:12 +04:00
()
let%expect_test _ =
run_ligo_good [ "compile-storage" ; contract "timestamp.ligo" ; "main" ; "now" ; "--predecessor-timestamp" ; "2042-01-01T00:00:00Z" ] ;
[%expect {| "2042-01-01T00:00:01Z" |}]
2019-11-26 03:30:12 +04:00
let%expect_test _ =
2019-11-22 00:06:34 +04:00
run_ligo_good [ "compile-contract" ; contract "coase.ligo" ; "main" ] ;
[%expect {|
{ parameter
(or (or (nat %buy_single) (nat %sell_single))
(pair %transfer_single (nat %card_to_transfer) (address %destination))) ;
storage
(pair (pair (map %card_patterns nat (pair (mutez %coefficient) (nat %quantity)))
(map %cards nat (pair (address %card_owner) (nat %card_pattern))))
(nat %next_id)) ;
2019-11-26 03:15:25 +04:00
code { DUP ;
CDR ;
DIP { DUP } ;
SWAP ;
CAR ;
IF_LEFT
{ DUP ;
IF_LEFT
{ DUP ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DUP ;
CAR ;
DIP { DUP } ;
SWAP ;
CDR ;
DIP { DUP } ;
SWAP ;
DIP { DUP ; CAR ; CAR } ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
2019-11-26 03:15:25 +04:00
DUP ;
CAR ;
DIP { DUP ; CDR ; PUSH nat 1 ; ADD } ;
MUL ;
DUP ;
AMOUNT ;
SWAP ;
COMPARE ;
GT ;
IF { PUSH string "Not enough money" ; FAILWITH } { PUSH unit Unit } ;
DIP 2 { DUP } ;
DIG 2 ;
2019-12-04 21:30:52 +04:00
DIP 3 { DUP } ;
DIG 3 ;
2019-11-26 03:15:25 +04:00
CDR ;
PUSH nat 1 ;
ADD ;
SWAP ;
CAR ;
PAIR ;
DIP 4 { DUP } ;
DIG 4 ;
2019-12-04 21:30:52 +04:00
DIP 6 { DUP } ;
DIG 6 ;
DIP { DIP { DUP } ;
SWAP ;
SOME ;
DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CAR } } ;
2019-11-26 03:15:25 +04:00
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ;
PAIR ;
PAIR ;
2019-11-26 03:15:25 +04:00
DUP ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
CDR ;
DIP { DIP 7 { DUP } ;
DIG 7 ;
2020-01-21 12:24:16 +04:00
SENDER ;
2019-12-04 21:30:52 +04:00
PAIR ;
SOME ;
DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ;
UPDATE ;
DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ;
2019-11-26 03:15:25 +04:00
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DUP ;
DIP { DUP } ;
SWAP ;
2019-11-26 03:15:25 +04:00
CDR ;
PUSH nat 1 ;
ADD ;
SWAP ;
2019-12-04 21:30:52 +04:00
CAR ;
2019-11-26 03:15:25 +04:00
PAIR ;
2019-12-04 21:30:52 +04:00
DUP ;
NIL operation ;
2019-11-26 03:15:25 +04:00
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DROP 11 } }
2019-11-26 03:15:25 +04:00
{ DUP ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DUP ;
CAR ;
DIP { DUP } ;
SWAP ;
CDR ;
DIP { DUP } ;
SWAP ;
DIP { DUP ; CAR ; CDR } ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
2019-11-26 03:15:25 +04:00
DUP ;
CAR ;
2020-01-21 12:24:16 +04:00
SENDER ;
2019-11-26 03:15:25 +04:00
SWAP ;
COMPARE ;
NEQ ;
IF { PUSH string "This card doesn't belong to you" ; FAILWITH }
{ PUSH unit Unit } ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
2019-11-26 03:15:25 +04:00
CDR ;
2019-12-04 21:30:52 +04:00
DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR } ;
2019-11-26 03:15:25 +04:00
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
2019-11-26 03:15:25 +04:00
DUP ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
2019-11-26 03:15:25 +04:00
CDR ;
PUSH nat 1 ;
SWAP ;
SUB ;
ABS ;
SWAP ;
CAR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP 4 { DUP } ;
DIG 4 ;
DIP 4 { DUP } ;
DIG 4 ;
2019-11-26 03:15:25 +04:00
CDR ;
2019-12-04 21:30:52 +04:00
DIP { DIP { DUP } ;
SWAP ;
SOME ;
DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CAR } } ;
2019-11-26 03:15:25 +04:00
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; CDR } ;
2019-11-26 03:15:25 +04:00
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP 6 { DUP } ;
DIG 6 ;
DIP { DUP ; CAR ; CDR ; NONE (pair (address %card_owner) (nat %card_pattern)) } ;
UPDATE ;
2019-11-26 03:15:25 +04:00
DIP 2 { DUP } ;
DIG 2 ;
CAR ;
DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ;
MUL ;
2020-01-21 12:24:16 +04:00
SENDER ;
2019-11-26 03:15:25 +04:00
CONTRACT unit ;
IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ;
DIP { DUP } ;
SWAP ;
DIP { DUP } ;
UNIT ;
TRANSFER_TOKENS ;
DUP ;
NIL operation ;
SWAP ;
CONS ;
2019-12-04 21:30:52 +04:00
DIP { DIP 4 { DUP } ;
DIG 4 ;
DIP 4 { DUP } ;
DIG 4 ;
DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ;
SWAP ;
PAIR ;
PAIR } ;
2019-11-26 03:15:25 +04:00
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DROP 13 } } ;
2019-11-26 03:15:25 +04:00
DIP { DROP } }
2019-11-22 00:06:34 +04:00
{ DUP ;
2019-11-26 03:15:25 +04:00
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
DUP ;
2019-11-22 00:06:34 +04:00
CAR ;
DIP { DUP } ;
SWAP ;
CDR ;
DUP ;
CAR ;
CDR ;
DIP 2 { DUP } ;
DIG 2 ;
CAR ;
DIP { DUP } ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
2019-11-22 00:06:34 +04:00
DUP ;
CAR ;
2020-01-21 12:24:16 +04:00
SENDER ;
2019-11-22 00:06:34 +04:00
SWAP ;
COMPARE ;
NEQ ;
IF { PUSH string "This card doesn't belong to you" ; FAILWITH }
{ PUSH unit Unit } ;
DIP 3 { DUP } ;
DIG 3 ;
2019-12-04 21:30:52 +04:00
DIP 5 { DUP } ;
DIG 5 ;
2019-11-22 00:06:34 +04:00
CAR ;
2019-12-04 21:30:52 +04:00
DIP { DIP 2 { DUP } ;
DIG 2 ;
DIP 6 { DUP } ;
DIG 6 ;
CDR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
SOME ;
DIP { DIP 3 { DUP } ; DIG 3 } } ;
2019-11-22 00:06:34 +04:00
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ;
2019-11-22 00:06:34 +04:00
SWAP ;
PAIR ;
PAIR ;
NIL operation ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DROP 7 } } ;
2019-11-26 03:15:25 +04:00
DIP { DROP 2 } } } |} ]
2019-11-26 03:30:12 +04:00
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "multisig.ligo" ; "main" ] ;
[%expect {|
{ parameter
(pair (pair (nat %counter) (lambda %message unit (list operation)))
2019-12-04 21:30:52 +04:00
(list %signatures (pair (key_hash %0) (signature %1)))) ;
2019-11-26 03:30:12 +04:00
storage
(pair (pair (list %auth key) (nat %counter)) (pair (string %id) (nat %threshold))) ;
code { DUP ;
CAR ;
2019-11-26 03:15:25 +04:00
DIP { DUP ; CDR } ;
PAIR ;
DUP ;
CAR ;
DIP { DUP } ;
SWAP ;
2019-11-26 03:30:12 +04:00
CDR ;
DIP { DUP } ;
SWAP ;
2019-11-26 03:15:25 +04:00
CAR ;
CDR ;
2019-12-04 21:30:52 +04:00
DUP ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
DIP 3 { DUP } ;
DIG 3 ;
2019-11-26 03:15:25 +04:00
CAR ;
CAR ;
2019-12-04 21:30:52 +04:00
DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR } ;
2019-11-26 03:15:25 +04:00
COMPARE ;
NEQ ;
IF { PUSH string "Counters does not match" ; FAILWITH }
2019-12-04 21:30:52 +04:00
{ DIP 3 { DUP } ;
2019-11-26 03:15:25 +04:00
DIG 3 ;
CDR ;
2019-12-04 21:30:52 +04:00
DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CAR ; PUSH nat 0 ; SWAP ; PAIR } ;
2019-11-26 03:15:25 +04:00
ITER { SWAP ;
PAIR ;
DUP ;
CAR ;
2019-12-04 21:30:52 +04:00
CAR ;
2019-11-26 03:15:25 +04:00
DIP { DUP } ;
SWAP ;
CAR ;
2019-12-04 21:30:52 +04:00
CDR ;
DIP 2 { DUP } ;
DIG 2 ;
CDR ;
DIP 2 { DUP } ;
DIG 2 ;
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
DIP 3 { DUP } ;
DIG 3 ;
2019-11-26 03:15:25 +04:00
IF_CONS
2019-12-04 21:30:52 +04:00
{ DIP 4 { DUP } ;
DIG 4 ;
DIP 4 { DUP } ;
DIG 4 ;
2019-11-26 03:15:25 +04:00
CAR ;
2019-12-04 21:30:52 +04:00
DIP { DIP { DUP } ; SWAP ; HASH_KEY } ;
2019-11-26 03:15:25 +04:00
COMPARE ;
EQ ;
2019-12-04 21:30:52 +04:00
IF { DIP 5 { DUP } ;
DIG 5 ;
DIP 2 { DUP } ;
DIG 2 ;
DIP { DIP 5 { DUP } ;
DIG 5 ;
CDR ;
DIP { DIP 10 { DUP } ;
DIG 10 ;
DIP { DIP 12 { DUP } ; DIG 12 ; CAR ; CAR } ;
PAIR ;
DIP { DIP 11 { DUP } ; DIG 11 ; CDR ; CAR ; CHAIN_ID ; SWAP ; PAIR } ;
PAIR ;
PACK } } ;
2019-11-26 03:15:25 +04:00
CHECK_SIGNATURE ;
2019-12-04 21:30:52 +04:00
IF { DIP 6 { DUP } ;
DIG 6 ;
2019-11-26 03:15:25 +04:00
PUSH nat 1 ;
ADD ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP { DUP } ;
2019-11-26 03:15:25 +04:00
SWAP ;
2019-12-04 21:30:52 +04:00
DIP { DROP 2 } }
{ PUSH string "Invalid signature" ; FAILWITH } ;
DIP 2 { DUP } ;
DIG 2 ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP { DROP 3 } }
2019-12-04 21:30:52 +04:00
{ DUP } ;
DIP 4 { DUP } ;
DIG 4 ;
DIP 4 { DUP } ;
DIG 4 ;
2019-12-04 21:30:52 +04:00
SWAP ;
CDR ;
SWAP ;
PAIR ;
CAR ;
DIP { DUP } ;
PAIR ;
DIP { DROP 4 } }
2019-12-04 21:30:52 +04:00
{ DUP } ;
DIP 5 { DUP } ;
DIG 5 ;
DIP 6 { DUP } ;
DIG 6 ;
2019-12-04 21:30:52 +04:00
CAR ;
DIP 2 { DUP } ;
DIG 2 ;
CDR ;
SWAP ;
CAR ;
PAIR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
DUP ;
2019-11-26 03:15:25 +04:00
DIP { DUP } ;
SWAP ;
2019-12-04 21:30:52 +04:00
CAR ;
DIP 3 { DUP } ;
DIG 3 ;
CAR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
CAR ;
DIP { DROP 7 } } ;
2019-12-04 21:30:52 +04:00
DIP 3 { DUP } ;
DIG 3 ;
2019-11-26 03:15:25 +04:00
DIP { DUP } ;
SWAP ;
2019-12-04 21:30:52 +04:00
CDR ;
2019-11-26 03:15:25 +04:00
DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CDR } ;
COMPARE ;
LT ;
IF { PUSH string "Not enough signatures passed the check" ; FAILWITH }
{ DIP 4 { DUP } ;
DIG 4 ;
2019-12-04 21:30:52 +04:00
DIP 5 { DUP } ;
DIG 5 ;
2019-11-26 03:15:25 +04:00
CAR ;
CDR ;
PUSH nat 1 ;
ADD ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; CAR } ;
2019-11-26 03:15:25 +04:00
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP { DUP } ;
SWAP ;
DIP { DROP 2 } } ;
DIP 3 { DUP } ;
DIG 3 ;
2019-12-04 21:30:52 +04:00
CAR ;
DIP { DUP } ;
PAIR ;
DIP { DROP 3 } } ;
2019-11-26 03:30:12 +04:00
DUP ;
2019-12-04 21:30:52 +04:00
CAR ;
CAR ;
2019-11-26 03:15:25 +04:00
UNIT ;
EXEC ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR } ;
2019-11-26 03:30:12 +04:00
PAIR ;
DIP { DROP 7 } } } |} ]
2019-11-26 03:30:12 +04:00
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "multisig-v2.ligo" ; "main" ] ;
[%expect {|
{ parameter
(or (or (unit %default) (lambda %send bytes (list operation)))
(lambda %withdraw bytes (list operation))) ;
2019-11-26 03:30:12 +04:00
storage
(pair (pair (pair (set %authorized_addresses address) (nat %max_message_size))
(pair (nat %max_proposal) (map %message_store bytes (set address))))
(pair (pair (map %proposal_counters address nat) (bytes %state_hash))
(nat %threshold))) ;
2019-11-26 03:30:12 +04:00
code { DUP ;
CDR ;
DIP { DUP } ;
SWAP ;
2019-11-26 03:15:25 +04:00
CAR ;
IF_LEFT
{ DUP ;
IF_LEFT
{ DIP 2 { DUP } ; DIG 2 ; NIL operation ; PAIR ; DIP { DROP } }
{ DUP ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DUP ;
CDR ;
DUP ;
CAR ;
CAR ;
CAR ;
SENDER ;
MEM ;
NOT ;
IF { PUSH string "Unauthorized address" ; FAILWITH } { PUSH unit Unit } ;
2019-12-04 21:30:52 +04:00
DIP 2 { DUP } ;
DIG 2 ;
CAR ;
DUP ;
PACK ;
DUP ;
SIZE ;
2019-12-04 21:30:52 +04:00
DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CAR ; CDR } ;
COMPARE ;
GT ;
IF { PUSH string "Message size exceed maximum limit" ; FAILWITH }
{ PUSH unit Unit } ;
2019-12-04 21:30:52 +04:00
DIP 4 { DUP } ;
DIG 4 ;
EMPTY_SET address ;
2019-12-04 21:30:52 +04:00
PAIR ;
DIP 2 { DUP } ;
DIG 2 ;
DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CDR ; CDR } ;
GET ;
IF_NONE
2019-12-04 21:30:52 +04:00
{ DIP 5 { DUP } ;
DIG 5 ;
DIP 6 { DUP } ;
DIG 6 ;
CDR ;
CAR ;
CAR ;
SENDER ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
PUSH nat 1 ;
ADD ;
SOME ;
2019-12-04 21:30:52 +04:00
DIP { DIP 6 { DUP } ; DIG 6 ; CDR ; CAR ; CAR } ;
SENDER ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
PAIR ;
PAIR ;
SWAP ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
CAR ;
DIP { DUP } ;
PAIR ;
EMPTY_SET address ;
PUSH bool True ;
SENDER ;
UPDATE ;
2019-12-04 21:30:52 +04:00
SWAP ;
CDR ;
SWAP ;
PAIR ;
DIP { DROP } }
{ DIP 6 { DUP } ;
DIG 6 ;
DIP { DUP } ;
SWAP ;
SENDER ;
MEM ;
2019-12-04 21:30:52 +04:00
IF { DUP }
{ DIP 7 { DUP } ;
DIG 7 ;
DIP 8 { DUP } ;
DIG 8 ;
CDR ;
CAR ;
CAR ;
SENDER ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
PUSH nat 1 ;
ADD ;
SOME ;
2019-12-04 21:30:52 +04:00
DIP { DIP 8 { DUP } ; DIG 8 ; CDR ; CAR ; CAR } ;
SENDER ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
PAIR ;
PAIR ;
SWAP ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP { DUP } ;
SWAP ;
DIP { DROP 2 } } ;
DIP 3 { DUP } ;
DIG 3 ;
2019-12-04 21:30:52 +04:00
CAR ;
DIP { DUP } ;
PAIR ;
DIP 3 { DUP } ;
DIG 3 ;
PUSH bool True ;
SENDER ;
UPDATE ;
SWAP ;
2019-12-04 21:30:52 +04:00
CDR ;
SWAP ;
PAIR ;
DIP { DROP 3 } } ;
2019-12-04 21:30:52 +04:00
DUP ;
CAR ;
DIP { DUP } ;
SWAP ;
CDR ;
DUP ;
CDR ;
CAR ;
CAR ;
SENDER ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
DUP ;
2019-12-04 21:30:52 +04:00
DIP { DIP { DUP } ; SWAP ; CAR ; CDR ; CAR } ;
COMPARE ;
GT ;
IF { PUSH string "Maximum number of proposal reached" ; FAILWITH }
{ PUSH unit Unit } ;
DIP 8 { DUP } ;
DIG 8 ;
2019-12-04 21:30:52 +04:00
DIP { DIP 3 { DUP } ; DIG 3 } ;
PAIR ;
DIP { DIP 7 { DUP } ; DIG 7 ; NIL operation ; SWAP ; PAIR } ;
2019-12-04 21:30:52 +04:00
PAIR ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DIP 4 { DUP } ;
DIG 4 ;
SIZE ;
2019-12-04 21:30:52 +04:00
DIP { DIP 3 { DUP } ; DIG 3 ; CDR ; CDR } ;
COMPARE ;
GE ;
IF { DIP 3 { DUP } ;
DIG 3 ;
DIP 9 { DUP } ;
DIG 9 ;
2019-12-04 21:30:52 +04:00
DIP { DIP 4 { DUP } ; DIG 4 ; CAR ; CDR ; CDR ; NONE (set address) } ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ;
SWAP ;
PAIR ;
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DUP ;
CDR ;
CAR ;
CDR ;
DIP { DIP 10 { DUP } ; DIG 10 } ;
EXEC ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP 2 { DUP } ;
DIG 2 ;
CDR ;
CAR ;
CDR ;
DIP { DIP 11 { DUP } ; DIG 11 } ;
CONCAT ;
SHA256 ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CAR } ;
SWAP ;
PAIR ;
PAIR ;
SWAP ;
PAIR ;
2019-12-04 21:30:52 +04:00
DUP ;
CDR ;
CAR ;
CAR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
ITER { SWAP ;
PAIR ;
DUP ;
CAR ;
DIP { DUP } ;
SWAP ;
CDR ;
CAR ;
DIP 2 { DUP } ;
DIG 2 ;
CDR ;
CDR ;
DIP { DUP } ;
SWAP ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
PAIR ;
DIP { DIP 2 { DUP } ; DIG 2 } ;
PAIR ;
DIP 2 { DUP } ;
DIG 2 ;
DIP { DIP 12 { DUP } ; DIG 12 } ;
MEM ;
2019-12-04 21:30:52 +04:00
IF { DIP 3 { DUP } ;
DIG 3 ;
DIP 3 { DUP } ;
DIG 3 ;
DIP { DIP 2 { DUP } ;
DIG 2 ;
PUSH nat 1 ;
SWAP ;
SUB ;
ABS ;
SOME ;
2019-12-04 21:30:52 +04:00
DIP { DIP 4 { DUP } ; DIG 4 ; CDR ; CAR ; CAR } } ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
PAIR ;
PAIR ;
SWAP ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
CAR ;
DIP { DUP } ;
PAIR ;
DIP { DROP } }
{ DUP } ;
DIP 5 { DUP } ;
DIG 5 ;
DIP 6 { DUP } ;
DIG 6 ;
2019-12-04 21:30:52 +04:00
CAR ;
DIP 2 { DUP } ;
DIG 2 ;
2019-12-04 21:30:52 +04:00
CDR ;
DIP { DROP ; CDR } ;
PAIR ;
CAR ;
DIP { DROP 6 } } ;
2019-12-04 21:30:52 +04:00
DIP 4 { DUP } ;
DIG 4 ;
DIP 4 { DUP } ;
DIG 4 ;
SWAP ;
CAR ;
PAIR ;
DIP 3 { DUP } ;
DIG 3 ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ;
SWAP ;
PAIR ;
SWAP ;
PAIR ;
PAIR ;
DIP 2 { DUP } ;
DIG 2 ;
SWAP ;
CAR ;
PAIR ;
CAR ;
DIP { DUP } ;
PAIR ;
DIP { DROP 4 } }
{ DUP ;
DIP 4 { DUP } ;
DIG 4 ;
DIP 10 { DUP } ;
DIG 10 ;
2019-12-04 21:30:52 +04:00
DIP { DIP 6 { DUP } ;
DIG 6 ;
SOME ;
DIP { DIP 5 { DUP } ; DIG 5 ; CAR ; CDR ; CDR } } ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ;
SWAP ;
PAIR ;
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
SWAP ;
CAR ;
PAIR } ;
DUP ;
2019-12-04 21:30:52 +04:00
CAR ;
CDR ;
CDR ;
DIP { DUP ; CDR } ;
PAIR ;
DIP { DROP 15 } } ;
DIP { DROP } }
{ DUP ;
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
DUP ;
CDR ;
DIP { DUP } ;
SWAP ;
CAR ;
PACK ;
DUP ;
2019-12-04 21:30:52 +04:00
DIP { DIP { DUP } ; SWAP } ;
PAIR ;
DIP { DUP } ;
SWAP ;
DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR ; CDR } ;
GET ;
IF_NONE
2019-12-04 21:30:52 +04:00
{ DUP }
{ DUP ;
PUSH bool False ;
SENDER ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP 4 { DUP } ;
DIG 4 ;
DIP 2 { DUP } ;
DIG 2 ;
SIZE ;
2019-12-04 21:30:52 +04:00
DIP { DIP { DUP } ; SWAP ; SIZE } ;
COMPARE ;
NEQ ;
2019-12-04 21:30:52 +04:00
IF { DIP 5 { DUP } ;
DIG 5 ;
DIP 6 { DUP } ;
DIG 6 ;
CDR ;
CAR ;
CAR ;
SENDER ;
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
PUSH nat 1 ;
SWAP ;
SUB ;
ABS ;
SOME ;
2019-12-04 21:30:52 +04:00
DIP { DIP 6 { DUP } ; DIG 6 ; CDR ; CAR ; CAR } ;
SENDER ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CAR ; SWAP ; CDR ; DUP ; CDR ; SWAP ; CAR ; CDR } ;
PAIR ;
PAIR ;
SWAP ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
DIP { DUP } ;
SWAP ;
DIP { DROP 2 } }
{ DUP } ;
DUP ;
DIP 3 { DUP } ;
DIG 3 ;
DIP { DIP 6 { DUP } ; DIG 6 } ;
2019-12-04 21:30:52 +04:00
PAIR ;
DIP { DUP } ;
PAIR ;
DIP 4 { DUP } ;
DIG 4 ;
SIZE ;
PUSH nat 0 ;
SWAP ;
COMPARE ;
EQ ;
2019-12-04 21:30:52 +04:00
IF { DIP { DUP } ;
SWAP ;
DIP 8 { DUP } ;
DIG 8 ;
2019-12-04 21:30:52 +04:00
DIP { DIP 2 { DUP } ; DIG 2 ; CAR ; CDR ; CDR ; NONE (set address) } ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ;
SWAP ;
PAIR ;
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
DIP { DUP } ;
SWAP ;
CAR ;
DIP { DUP } ;
PAIR ;
DIP { DROP } }
{ DUP ;
DIP 2 { DUP } ;
DIG 2 ;
DIP 9 { DUP } ;
DIG 9 ;
DIP { DIP 6 { DUP } ;
DIG 6 ;
2019-12-04 21:30:52 +04:00
SOME ;
DIP { DIP 3 { DUP } ; DIG 3 ; CAR ; CDR ; CDR } } ;
UPDATE ;
2019-12-04 21:30:52 +04:00
DIP { DUP ; CDR ; SWAP ; CAR ; DUP ; CAR ; SWAP ; CDR ; CAR } ;
SWAP ;
PAIR ;
SWAP ;
PAIR ;
PAIR ;
2019-12-04 21:30:52 +04:00
SWAP ;
CAR ;
PAIR } ;
DIP 7 { DUP } ;
DIG 7 ;
DIP 3 { DUP } ;
DIG 3 ;
2019-12-04 21:30:52 +04:00
SWAP ;
CAR ;
PAIR ;
DIP { DUP } ;
SWAP ;
CAR ;
CDR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
DIP { DUP } ;
SWAP ;
CDR ;
SWAP ;
CAR ;
PAIR ;
DIP { DUP } ;
SWAP ;
CAR ;
CDR ;
SWAP ;
CDR ;
SWAP ;
PAIR ;
DIP { DUP } ;
SWAP ;
CDR ;
SWAP ;
CAR ;
PAIR ;
DIP { DROP 7 } } ;
2019-12-04 21:30:52 +04:00
DUP ;
CDR ;
NIL operation ;
PAIR ;
DIP { DROP 6 } } ;
DIP { DROP 2 } } } |} ]
2019-11-26 03:30:12 +04:00
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "vote.mligo" ; "main" ] ;
[%expect {|
{ parameter
(or (pair %init
(pair (timestamp %beginning_time) (timestamp %finish_time))
(string %title))
(string %vote)) ;
storage
(pair (pair (pair (timestamp %beginning_time) (map %candidates string int))
(pair (timestamp %finish_time) (string %title)))
(set %voters address)) ;
2019-11-26 03:15:25 +04:00
code { DUP ;
CAR ;
IF_LEFT
2019-11-26 03:30:12 +04:00
{ DUP ;
DIP { DIP { DUP } ; SWAP ; CDR } ;
PAIR ;
2019-11-26 04:10:49 +04:00
DUP ;
CAR ;
CAR ;
CAR ;
2019-11-26 03:30:12 +04:00
DIP { PUSH int 0 ;
SOME ;
2019-11-26 04:10:49 +04:00
DIP { PUSH int 0 ;
SOME ;
EMPTY_MAP string int ;
SWAP ;
PUSH string "Yes" ;
UPDATE } ;
PUSH string "No" ;
2019-11-26 03:30:12 +04:00
UPDATE } ;
PAIR ;
DIP { DUP ; CAR ; CAR ; CDR ; DIP { DUP ; CAR ; CDR } ; PAIR } ;
2019-11-26 03:30:12 +04:00
PAIR ;
EMPTY_SET address ;
SWAP ;
PAIR ;
NIL operation ;
PAIR ;
2019-11-26 04:10:49 +04:00
DIP { DROP 2 } }
2019-11-26 03:30:12 +04:00
{ DUP ;
2019-11-26 03:15:25 +04:00
DIP { DIP { DUP } ; SWAP ; CDR } ;
PAIR ;
DUP ;
2019-11-26 03:30:12 +04:00
CAR ;
DIP { DUP ; CDR ; CAR ; CAR ; CDR } ;
2019-11-26 03:30:12 +04:00
GET ;
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
2019-11-26 04:10:49 +04:00
DIP { DUP } ;
SWAP ;
CDR ;
2019-11-26 03:30:12 +04:00
CAR ;
CAR ;
CAR ;
DIP { DIP { DUP } ;
SWAP ;
CAR ;
2019-11-26 03:30:12 +04:00
DIP { DUP ;
PUSH int 1 ;
ADD ;
SOME ;
DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CAR ; CDR } } ;
2019-11-26 03:30:12 +04:00
UPDATE } ;
PAIR ;
2019-11-26 04:10:49 +04:00
DIP { DIP { DUP } ;
SWAP ;
CDR ;
2019-11-26 03:30:12 +04:00
CAR ;
CDR ;
CAR ;
DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CDR ; CDR } ;
2019-11-26 03:30:12 +04:00
PAIR } ;
PAIR ;
2020-01-21 12:24:16 +04:00
DIP { DIP { DUP } ; SWAP ; CDR ; CDR ; PUSH bool True ; SENDER ; UPDATE } ;
2019-11-26 03:30:12 +04:00
PAIR ;
NIL operation ;
PAIR ;
DIP { DROP 3 } } ;
2019-11-26 03:15:25 +04:00
DIP { DROP } } } |}]
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "implicit.mligo" ; "main" ] ;
[%expect {|
{ parameter key_hash ;
storage unit ;
code { DUP ;
CAR ;
IMPLICIT_ACCOUNT ;
UNIT ;
NIL operation ;
PAIR ;
DIP { DROP 2 } } } |}]
2019-12-24 15:20:39 +04:00
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_type_operator.ligo" ; "main" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
ligo: bad type operator (TO_Map (unit,unit)):
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}]
let%expect_test _ =
2020-01-17 19:35:53 +04:00
run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
2020-01-17 20:02:54 +04:00
failwith("some_string") |}]
2020-01-08 14:54:21 +04:00
2020-01-17 19:35:53 +04:00
let%expect_test _ =
run_ligo_good [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ; "--format=json" ] ;
[%expect {|
2020-01-17 20:02:54 +04:00
{"status":"ok","content":"failwith(\"some_string\")"} |}]
2020-01-02 18:02:02 +04:00
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_address_format.religo" ; "main" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
2019-12-04 21:30:52 +04:00
ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted literal: @"KT1badaddr" {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"}
2020-01-08 14:54:21 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}]
2020-01-03 20:46:31 +04:00
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_timestamp.ligo" ; "main" ] ;
2020-01-08 14:54:21 +04:00
[%expect {|
ligo: in file "bad_timestamp.ligo", line 7, characters 30-44. Badly formatted timestamp "badtimestamp": {"location":"in file \"bad_timestamp.ligo\", line 7, characters 30-44"}
2020-01-08 14:54:21 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}]
2020-01-06 21:51:43 +04:00
let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ;
[%expect {|( list[] , 0 ) |}]
2020-01-06 21:51:43 +04:00
let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "double_main.ligo" ; "main" ; "unit" ; "0" ] ;
[%expect {|( list[] , 2 ) |}]
2020-01-07 00:19:14 +04:00
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "subtle_nontail_fail.mligo" ; "main" ] ;
[%expect {|
{ parameter unit ;
storage unit ;
code { PUSH bool True ;
IF { PUSH string "This contract always fails" ; FAILWITH }
{ PUSH string "This contract still always fails" ; FAILWITH } } } |}]
let%expect_test _ =
(* TODO should not be bad? *)
2020-01-17 19:35:53 +04:00
run_ligo_good [ "dry-run" ; contract "subtle_nontail_fail.mligo" ; "main" ; "()" ; "()" ] ;
2020-01-07 00:19:14 +04:00
[%expect {|
2020-01-17 20:02:54 +04:00
failwith("This contract always fails") |}]
2020-01-07 00:19:14 +04:00
2020-01-20 22:40:45 +04:00
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; bad_contract "self_in_lambda.mligo" ; "main" ] ;
[%expect {|
ligo: Wrong SELF_ADDRESS location: SELF_ADDRESS is only allowed at top-level
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
2020-01-27 14:42:32 +04:00
* Check the changelog by running 'ligo changelog' |}]
let%expect_test _ =
run_ligo_good [ "compile-storage" ; contract "big_map.ligo" ; "main" ; "(big_map1,unit)" ] ;
[%expect {|
(Pair { Elt 23 0 ; Elt 42 0 } Unit) |}]
let%expect_test _ =
run_ligo_good [ "compile-contract" ; contract "key_hash_comparable.ligo" ; "main" ] ;
[%expect {|
{ parameter int ;
storage (pair (map %one key_hash nat) (big_map %two key_hash bool)) ;
code { DUP ; CDR ; NIL operation ; PAIR ; DIP { DROP } } } |}]
let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "super-counter.mligo" ; "main" ; "test_param" ; "test_storage" ] ;
[%expect {|
( list[] , 3 ) |}]
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; bad_contract "redundant_constructors.mligo" ; "main" ] ;
[%expect {|
ligo: redundant constructor: {"constructor":"Add","environment":"- E[]\tT[union_a -> sum[Add -> int , Remove -> int]] ]"}
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
2020-02-28 22:49:51 +04:00
* Check the changelog by running 'ligo changelog' |}]
let%expect_test _ =
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_toplevel.mligo" ; "main" ] ;
[%expect {|
2020-03-02 15:53:10 +04:00
ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8. No free variable allowed in this lambda: variable 'store' {"expression":"CREATE_CONTRACT(lambda (#P : ( nat * string ):Some(( nat * string ))) : None return let rhs#752 = #P in let p = rhs#752.0 in let s = rhs#752.1 in ( list[] : (TO_list(operation)) , store ) , NONE() : (TO_option(key_hash)) , 300000000mutez , \"un\")","location":"in file \"create_contract_toplevel.mligo\", line 4, character 35 to line 8, character 8"}
2020-02-28 22:49:51 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}] ;
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_var.mligo" ; "main" ] ;
[%expect {|
2020-03-02 15:53:10 +04:00
ligo: in file "create_contract_var.mligo", line 6, character 35 to line 10, character 5. No free variable allowed in this lambda: variable 'a' {"expression":"CREATE_CONTRACT(lambda (#P : ( nat * int ):Some(( nat * int ))) : None return let rhs#755 = #P in let p = rhs#755.0 in let s = rhs#755.1 in ( list[] : (TO_list(operation)) , a ) , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_var.mligo\", line 6, character 35 to line 10, character 5"}
2020-02-28 22:49:51 +04:00
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}] ;
2020-03-02 15:53:10 +04:00
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_no_inline.mligo" ; "main" ] ;
[%expect {|
ligo: in file "create_contract_no_inline.mligo", line 9, characters 19-89. CREATE_CONTRACT first argument must be inlined: contract code can be inlined using a lambda {"expression":"CREATE_CONTRACT(dummy_contract , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_no_inline.mligo\", line 9, characters 19-89"}
If you're not sure how to fix this error, you can
do one of the following:
* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/
* Ask a question on our Discord: https://discord.gg/9rhYaEt
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
* Check the changelog by running 'ligo changelog' |}] ;
2020-02-28 22:49:51 +04:00
run_ligo_good [ "compile-contract" ; contract "create_contract.mligo" ; "main" ] ;
[%expect {|
{ parameter string ;
storage string ;
code { PUSH string "un" ;
PUSH mutez 300000000 ;
NONE key_hash ;
CREATE_CONTRACT
{ parameter nat ;
storage string ;
code { PUSH string "one" ; NIL operation ; PAIR ; DIP { DROP } } } ;
PAIR ;
DUP ;
CAR ;
NIL operation ;
SWAP ;
CONS ;
DIP { DIP { DUP } ; SWAP ; CDR } ;
PAIR ;
DIP { DROP 2 } } } |}]