diff --git a/src/client/embedded/alpha/client_proto_programs.ml b/src/client/embedded/alpha/client_proto_programs.ml index e5f87b9b4..2e9d65587 100644 --- a/src/client/embedded/alpha/client_proto_programs.ml +++ b/src/client/embedded/alpha/client_proto_programs.ml @@ -517,7 +517,7 @@ let unexpand_macros type_map (program : Script.code) = match node with | Seq (loc, l) -> begin match caddr type_map [] l with - | None -> + | None | Some [] -> let type_map, l = List.fold_left (fun (type_map, acc) e -> diff --git a/src/proto/alpha/docs/language.md b/src/proto/alpha/docs/language.md index e6734df69..ca71ecda2 100644 --- a/src/proto/alpha/docs/language.md +++ b/src/proto/alpha/docs/language.md @@ -1052,7 +1052,7 @@ for under/overflows. Forge a new contract. - :: key : key? : bool : bool : tez : lambda (pair (pair tez 'p) 'g) (pair 'r 'g) : 'g : 'S + :: key : key? : bool : bool : tez : lambda (pair 'p 'g) (pair 'r 'g) : 'g : 'S -> contract 'p 'r : 'S As with non code-emitted originations the @@ -1061,7 +1061,7 @@ for under/overflows. the global data and returns it to be stored and retrieved on the next transaction. These data are initialized by another parameter. The calling convention for the code is as follows: - `(Pair (Pair amount arg) globals)) -> (Pair ret globals)`, as + `(Pair arg globals)) -> (Pair ret globals)`, as extrapolable from the instruction type. The first parameters are the manager, optional delegate, then spendable and delegatable flags and finally the initial amount taken from the currently @@ -1149,12 +1149,12 @@ for under/overflows. :: 'a : 'S -> string : 'S - * `CHECK_SIGNATURE` + * `CHECK_SIGNATURE`: Check that a sequence of bytes has been signed with a given key. :: key : pair signature string : 'S -> bool : 'S - * `COMPARE` + * `COMPARE`: :: key : key : 'S -> int64 : 'S @@ -1349,27 +1349,23 @@ data storage. The type of the global data of the storage is fixed for each contract at origination time. This is ensured statically by checking on origination that the code preserves the type of the global data. For this, the code of the contract is checked to be of the -following type lambda (pair (pair tez 'arg) 'global) -> (pair 'ret +following type lambda (pair 'arg 'global) -> (pair 'ret 'global) where 'global is the type of the original global store given -on origination. The contract also takes a parameter and an amount, and +on origination. The contract also takes a parameter and returns a value, hence the complete calling convention above. ### Empty contract -Because of the calling convention, the empty sequence is not a valid -contract of type `(contract unit unit)`. The code for building a -contract of such a type must take a `unit` argument, an amount in `tez`, -and transform a unit global storage, and must thus be of type `(lambda -(pair (pair tez unit) unit) (pair unit unit))`. +Any contract with the same `parameter` and `return` types +may be written with an empty sequence in its `code` section. +The simplest contracts is the contract for which the +`parameter`, `storage`, and `return` are all of type `unit`. +This contract is as follows: -Such a minimal contract code is thus `{ CDR ; UNIT ; PAIR }`. - -A valid contract source file would be as follows. - - code { CDR ; UNIT ; PAIR } - storage unit - parameter unit - return unit + code { }; + storage unit; + parameter unit; + return unit; ### Reservoir contract @@ -1393,13 +1389,13 @@ Hence, the global data of the contract has the following type Following the contract calling convention, the code is a lambda of type lambda - pair (pair tez unit) 'g + pair unit 'g pair unit 'g writen as lambda - pair (pair tez unit) + pair unit pair pair timestamp tez pair (contract unit unit) (contract unit unit) @@ -1614,9 +1610,8 @@ At the beginning of the transaction: S via a CDDDDADR W via a CDDDDDR the delivery counter via a CDAAR - the amount versed by the buyer via a CDADAR the amount versed by the seller via a CDADDR - the argument via a CADR + the argument via a CAR The contract returns a unit value, and we assume that it is created with the minimum amount, set to `(Tez "1.00")`. @@ -1640,12 +1635,12 @@ The complete source `forward.tz` is: PUSH uint64 86400 ; SWAP ; ADD ; # one day in second NOW ; COMPARE ; LT ; IF { # Before Z + 24 - DUP ; CADR ; # we must receive (Left "buyer") or (Left "seller") + DUP ; CAR ; # we must receive (Left "buyer") or (Left "seller") IF_LEFT { DUP ; PUSH string "buyer" ; COMPARE ; EQ ; IF { DROP ; DUP ; CDADAR ; # amount already versed by the buyer - DIP { DUP ; CAAR } ; ADD ; # transaction + DIP { AMOUNT } ; ADD ; # transaction # then we rebuild the globals DIP { DUP ; CDADDR } ; PAIR ; # seller amount PUSH uint32 0 ; PAIR ; # delivery counter at 0 @@ -1654,7 +1649,7 @@ The complete source `forward.tz` is: UNIT ; PAIR } { PUSH string "seller" ; COMPARE ; EQ ; IF { DUP ; CDADDR ; # amount already versed by the seller - DIP { DUP ; CAAR } ; ADD ; # transaction + DIP { AMOUNT } ; ADD ; # transaction # then we rebuild the globals DIP { DUP ; CDADAR } ; SWAP ; PAIR ; # buyer amount PUSH uint32 0 ; PAIR ; # delivery counter at 0 @@ -1693,11 +1688,11 @@ The complete source `forward.tz` is: NOW ; COMPARE ; LT IF { # Between T and T + 24 # we only accept transactions from the buyer - DUP ; CADR ; # we must receive (Left "buyer") + DUP ; CAR ; # we must receive (Left "buyer") IF_LEFT { PUSH string "buyer" ; COMPARE ; EQ ; IF { DUP ; CDADAR ; # amount already versed by the buyer - DIP { DUP ; CAAR } ; ADD ; # transaction + DIP { AMOUNT } ; ADD ; # transaction # The amount must not exceed Q * K DUP ; DIIP { DUP ; CDDAAR ; # Q @@ -1736,7 +1731,7 @@ The complete source `forward.tz` is: SOURCE unit unit ; MANAGER ; COMPARE ; NEQ ; IF { FAIL } {} # fail if not the warehouse - DUP ; CADR ; # we must receive (Right amount) + DUP ; CAR ; # we must receive (Right amount) IF_LEFT { FAIL } # (Left _) { # We increment the counter @@ -1763,7 +1758,7 @@ The complete source `forward.tz` is: UNIT ; TRANSFER_TOKENS ; DROP ; # and return unit UNIT ; PAIR } } } } } } } - + X - Full grammar ---------------- diff --git a/src/proto/alpha/script_interpreter.ml b/src/proto/alpha/script_interpreter.ml index 8db3a0c07..301715757 100644 --- a/src/proto/alpha/script_interpreter.ml +++ b/src/proto/alpha/script_interpreter.ml @@ -512,14 +512,14 @@ and execute ?log origination orig source ctxt storage script amount arg qta = (Lwt.return (parse_ty arg_type)) >>=? fun (Ex_ty arg_type) -> (Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) -> (Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) -> - let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in + let arg_type_full = Pair_t (arg_type, storage_type) in let ret_type_full = Pair_t (ret_type, storage_type) in trace (Ill_typed_contract (code, arg_type, ret_type, storage_type, [])) (parse_lambda ~storage_type ctxt arg_type_full ret_type_full code) >>=? fun lambda -> parse_data ctxt arg_type arg >>=? fun arg -> parse_data ctxt storage_type storage >>=? fun storage -> - interp ?log origination qta orig source amount ctxt lambda ((amount, arg), storage) + interp ?log origination qta orig source amount ctxt lambda (arg, storage) >>=? fun (ret, qta, ctxt, origination) -> let ret, storage = ret in return (unparse_data storage_type storage, diff --git a/src/proto/alpha/script_ir_translator.ml b/src/proto/alpha/script_ir_translator.ml index 9f134e76d..7a4d4d388 100644 --- a/src/proto/alpha/script_ir_translator.ml +++ b/src/proto/alpha/script_ir_translator.ml @@ -1275,7 +1275,7 @@ and parse_instr (Bool_t, Item_t (Bool_t, Item_t (Tez_t, Item_t - (Lambda_t (Pair_t (Pair_t (Tez_t, p), gp), + (Lambda_t (Pair_t (p, gp), Pair_t (r, gr)), Item_t (ginit, rest))))))) -> check_item_ty gp gr loc "CREATE_CONTRACT" 5 7 >>=? fun (Eq _) -> @@ -1437,7 +1437,7 @@ let parse_script (Lwt.return (parse_ty ret_type)) >>=? fun (Ex_ty ret_type) -> (Lwt.return (parse_ty init_storage_type)) >>=? fun (Ex_ty init_storage_type) -> (Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) -> - let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in + let arg_type_full = Pair_t (arg_type, storage_type) in let ret_type_full = Pair_t (ret_type, storage_type) in Lwt.return (ty_eq init_storage_type storage_type) >>=? fun (Eq _) -> parse_data ?type_logger ctxt storage_type storage >>=? fun storage -> @@ -1546,7 +1546,7 @@ let typecheck_code trace (Ill_formed_type (Some "storage", storage_type)) (Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) -> - let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in + let arg_type_full = Pair_t (arg_type, storage_type) in let ret_type_full = Pair_t (ret_type, storage_type) in let result = parse_lambda ctxt diff --git a/src/proto/alpha/script_typed_ir.ml b/src/proto/alpha/script_typed_ir.ml index 4ac24f2f7..cd8813370 100644 --- a/src/proto/alpha/script_typed_ir.ml +++ b/src/proto/alpha/script_typed_ir.ml @@ -40,7 +40,7 @@ end type ('key, 'value) map = (module Boxed_map with type key = 'key and type value = 'value) type ('arg, 'ret, 'storage) script = - { code : (((Tez.t, 'arg) pair, 'storage) pair, ('ret, 'storage) pair) lambda ; + { code : (('arg, 'storage) pair, ('ret, 'storage) pair) lambda ; arg_type : 'arg ty ; ret_type : 'ret ty ; storage : 'storage ; @@ -270,7 +270,7 @@ and ('bef, 'aft) instr = | Default_account : (public_key_hash * 'rest, (unit, unit) typed_contract * 'rest) instr | Create_contract : 'g ty * 'p ty * 'r ty -> (public_key_hash * (public_key_hash option * (bool * (bool * (Tez.t * - (((Tez.t * 'p) * 'g, 'r * 'g) lambda * ('g * 'rest)))))), + (('p * 'g, 'r * 'g) lambda * ('g * 'rest)))))), ('p, 'r) typed_contract * 'rest) instr | Now : ('rest, Timestamp.t * 'rest) instr diff --git a/test/contracts/and.tz b/test/contracts/and.tz index 8a2d6e9ee..f536ba865 100644 --- a/test/contracts/and.tz +++ b/test/contracts/and.tz @@ -1,5 +1,4 @@ parameter (pair bool bool); return bool; storage unit; -code {DUP; CADR; CAR; SWAP; CADR; CDR; AND; - UNIT; SWAP; PAIR}; +code {CAR; DUP; CAR; DIP{CDR}; AND; UNIT; SWAP; PAIR}; diff --git a/test/contracts/build_list.tz b/test/contracts/build_list.tz index 97611a20b..ce08aa4e8 100644 --- a/test/contracts/build_list.tz +++ b/test/contracts/build_list.tz @@ -1,7 +1,7 @@ parameter uint64; return (list uint64); storage unit; -code {CADR; NIL uint64; SWAP; DUP; PUSH uint64 0; CMPNEQ; +code {CAR; NIL uint64; SWAP; DUP; PUSH uint64 0; CMPNEQ; LOOP {DUP; DIP {SWAP}; CONS; SWAP; PUSH uint64 1; SWAP; SUB; DUP; PUSH uint64 0; CMPNEQ}; CONS; UNIT; SWAP; PAIR}; diff --git a/test/contracts/check_signature.tz b/test/contracts/check_signature.tz index abe354528..e331a6fe7 100644 --- a/test/contracts/check_signature.tz +++ b/test/contracts/check_signature.tz @@ -2,4 +2,4 @@ parameter key; storage (pair signature string); return bool; code {DUP; DUP; DIP{CDR; DUP; CAR; DIP{CDR; H}; PAIR}; - CADR; CHECK_SIGNATURE; DIP{CDR}; PAIR}; + CAR; CHECK_SIGNATURE; DIP{CDR}; PAIR}; diff --git a/test/contracts/compare.tz b/test/contracts/compare.tz index 7f09a9a4c..e68faf9a5 100644 --- a/test/contracts/compare.tz +++ b/test/contracts/compare.tz @@ -1,7 +1,7 @@ parameter (pair tez tez); return (list bool); storage unit; -code {CADR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; +code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS}; DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS}; DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS}; diff --git a/test/contracts/concat_hello.tz b/test/contracts/concat_hello.tz index d8726cdb5..f6f3afbb5 100644 --- a/test/contracts/concat_hello.tz +++ b/test/contracts/concat_hello.tz @@ -1,4 +1,5 @@ parameter (list string); return (list string); storage unit; -code {CADR; LAMBDA string string {PUSH string "Hello "; CONCAT}; MAP; UNIT; SWAP; PAIR}; +code{CAR; LAMBDA string string {PUSH string "Hello "; CONCAT}; + MAP; UNIT; SWAP; PAIR}; diff --git a/test/contracts/concat_list.tz b/test/contracts/concat_list.tz index 345cf24d0..f347f7d10 100644 --- a/test/contracts/concat_list.tz +++ b/test/contracts/concat_list.tz @@ -1,5 +1,6 @@ parameter (list string); return string; storage unit; -code {CADR; PUSH string ""; SWAP; LAMBDA (pair string string) string {DUP; CAR; SWAP; CDR; SWAP; CONCAT}; REDUCE; - UNIT; SWAP; PAIR}; +code {CAR; PUSH string ""; SWAP; + LAMBDA (pair string string) string {DUP; CAR; SWAP; CDR; SWAP; CONCAT}; + REDUCE; UNIT; SWAP; PAIR}; diff --git a/test/contracts/contains_all.tz b/test/contracts/contains_all.tz index f67b14521..8b6d30583 100644 --- a/test/contracts/contains_all.tz +++ b/test/contracts/contains_all.tz @@ -1,8 +1,10 @@ parameter (pair (list string) (list string)); storage unit; return bool; -code {CADR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP; +code {CAR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP; LAMBDA (pair string (set string)) (set string) {DUP; CAR; DIP{CDR}; PUSH bool True; SWAP; UPDATE}; REDUCE; PUSH bool True; SWAP; PAIR; SWAP; - LAMBDA (pair string (pair (set string) bool)) (pair (set string) bool) {DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR}; + LAMBDA (pair string (pair (set string) bool)) + (pair (set string) bool) + {DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR}; REDUCE; CDR; UNIT; SWAP; PAIR}; diff --git a/test/contracts/create_account.tz b/test/contracts/create_account.tz index 989bb9024..4dd2c78da 100644 --- a/test/contracts/create_account.tz +++ b/test/contracts/create_account.tz @@ -1,5 +1,5 @@ parameter key; return unit; storage (contract unit unit); -code {CADR; DIP{PUSH tez "100.00"; PUSH bool False; NONE key}; CREATE_ACCOUNT; - UNIT; PAIR}; +code {CAR; DIP{PUSH tez "100.00"; PUSH bool False; NONE key}; + CREATE_ACCOUNT; UNIT; PAIR}; diff --git a/test/contracts/create_contract.tz b/test/contracts/create_contract.tz index be0e3c19e..0dd677d6b 100644 --- a/test/contracts/create_contract.tz +++ b/test/contracts/create_contract.tz @@ -1,7 +1,11 @@ parameter key; storage string; return unit; -code {CADR; DIP{UNIT; LAMBDA (pair (pair tez string) unit) (pair string unit) {CADR; UNIT; SWAP; PAIR}; - PUSH tez "100.00"; PUSH bool False; PUSH bool False; NONE key}; - CREATE_CONTRACT; DIP{PUSH string ""}; PUSH tez "0.00"; PUSH string "abcdefg"; TRANSFER_TOKENS; +code {CAR; DIP{UNIT; LAMBDA (pair string unit) + (pair string unit) + {CAR; UNIT; SWAP; PAIR}; + PUSH tez "100.00"; PUSH bool False; + PUSH bool False; NONE key}; + CREATE_CONTRACT; DIP{PUSH string ""}; PUSH tez "0.00"; + PUSH string "abcdefg"; TRANSFER_TOKENS; DIP{DROP}; UNIT; PAIR}; diff --git a/test/contracts/default_account.tz b/test/contracts/default_account.tz index c4faaf331..bc890528d 100644 --- a/test/contracts/default_account.tz +++ b/test/contracts/default_account.tz @@ -1,4 +1,5 @@ parameter key return unit storage unit -code {DIP{UNIT}; CADR; DEFAULT_ACCOUNT; PUSH tez "100"; UNIT; TRANSFER_TOKENS; PAIR} +code {DIP{UNIT}; CAR; DEFAULT_ACCOUNT; + PUSH tez "100"; UNIT; TRANSFER_TOKENS; PAIR} diff --git a/test/contracts/empty_map.tz b/test/contracts/empty_map.tz index 8a85874ab..ff7b3d0d2 100644 --- a/test/contracts/empty_map.tz +++ b/test/contracts/empty_map.tz @@ -1,4 +1,7 @@ storage unit; return (map string string); parameter unit; -code {DROP; EMPTY_MAP string string; PUSH string "world"; SOME; PUSH string "hello"; UPDATE; UNIT; SWAP; PAIR}; +code {DROP; + EMPTY_MAP string string; + PUSH string "world"; SOME; PUSH string "hello"; UPDATE; + UNIT; SWAP; PAIR}; diff --git a/test/contracts/exec_concat.tz b/test/contracts/exec_concat.tz index 216b05f65..7278670a7 100644 --- a/test/contracts/exec_concat.tz +++ b/test/contracts/exec_concat.tz @@ -1,4 +1,6 @@ parameter string; return string; storage unit; -code {CADR; LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT}; SWAP; EXEC; UNIT; SWAP; PAIR}; +code {CAR; + LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT}; + SWAP; EXEC; UNIT; SWAP; PAIR}; diff --git a/test/contracts/fail_amount.tz b/test/contracts/fail_amount.tz index 71d9e9a6a..9f9be1fcc 100644 --- a/test/contracts/fail_amount.tz +++ b/test/contracts/fail_amount.tz @@ -2,4 +2,4 @@ parameter unit; storage unit; return unit; -code {CAAR; PUSH tez "10"; CMPGT; IF {FAIL} {UNIT; UNIT; PAIR}} +code {AMOUNT; PUSH tez "10"; CMPGT; IF {FAIL} {}} diff --git a/test/contracts/get_map_value.tz b/test/contracts/get_map_value.tz index 544b26d57..d8d95a783 100644 --- a/test/contracts/get_map_value.tz +++ b/test/contracts/get_map_value.tz @@ -1,4 +1,4 @@ parameter string; storage (map string string); return (option string); -code {DUP; CADR; DIP{CDR; DUP}; GET; PAIR}; +code {DUP; CAR; DIP{CDR; DUP}; GET; PAIR}; diff --git a/test/contracts/hash_string.tz b/test/contracts/hash_string.tz index a72d6e90d..2afbfb56e 100644 --- a/test/contracts/hash_string.tz +++ b/test/contracts/hash_string.tz @@ -1,4 +1,4 @@ parameter string; return string; storage unit; -code {CADR; H; UNIT; SWAP; PAIR}; +code {CAR; H; UNIT; SWAP; PAIR}; diff --git a/test/contracts/if.tz b/test/contracts/if.tz index 537637eb9..5a0d423a7 100644 --- a/test/contracts/if.tz +++ b/test/contracts/if.tz @@ -1,4 +1,4 @@ parameter bool; storage unit; return bool; -code {CADR; IF {PUSH bool True} {PUSH bool False}; UNIT; SWAP; PAIR}; +code {CAR; IF {PUSH bool True} {PUSH bool False}; UNIT; SWAP; PAIR}; diff --git a/test/contracts/max_in_list.tz b/test/contracts/max_in_list.tz index 2ce85a4f9..fb73b44dd 100644 --- a/test/contracts/max_in_list.tz +++ b/test/contracts/max_in_list.tz @@ -1,10 +1,10 @@ parameter (list int32); storage unit; return (option int32); -code {CADR; DIP{NONE int32}; +code {CAR; DIP{NONE int32}; LAMBDA (pair int32 (option int32)) (option int32) - {DUP; DUP; CAR; SWAP; CDR; + {DUP; DUP; CAR; SWAP; CDR; IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}}; REDUCE; UNIT; SWAP; PAIR}; diff --git a/test/contracts/noop.tz b/test/contracts/noop.tz index 2346162f5..54a511a24 100644 --- a/test/contracts/noop.tz +++ b/test/contracts/noop.tz @@ -1,7 +1,4 @@ -parameter unit -code - { # This is a noop contract - CDR ; UNIT ; PAIR - } -return unit -storage unit \ No newline at end of file +parameter unit; +code {}; +return unit; +storage unit; diff --git a/test/contracts/not.tz b/test/contracts/not.tz index 4d17f16ae..b6155da09 100644 --- a/test/contracts/not.tz +++ b/test/contracts/not.tz @@ -1,4 +1,4 @@ parameter bool; return bool; storage unit; -code {CADR; NOT; UNIT; SWAP; PAIR}; +code {CAR; NOT; UNIT; SWAP; PAIR}; diff --git a/test/contracts/or.tz b/test/contracts/or.tz index caf0007e7..1b45ccc8f 100644 --- a/test/contracts/or.tz +++ b/test/contracts/or.tz @@ -1,5 +1,5 @@ parameter (pair bool bool); return bool; storage unit; -code {CADR; DUP; CAR; SWAP; CDR; OR; +code {CAR; DUP; CAR; SWAP; CDR; OR; UNIT; SWAP; PAIR}; diff --git a/test/contracts/originator.tz b/test/contracts/originator.tz index e7d80d0ee..bb1460e51 100644 --- a/test/contracts/originator.tz +++ b/test/contracts/originator.tz @@ -2,16 +2,16 @@ storage unit ; parameter uint16 ; return (list (contract unit unit)) ; code - { CADR ; DUP ; PUSH uint16 0 ; CMPNEQ ; + { CAR ; DUP ; PUSH uint16 0 ; CMPNEQ ; DIIP { NIL (contract unit unit) } ; LOOP { PUSH tez "5.00" ; PUSH bool True ; # delegatable NONE key ; # delegate - PUSH key "Nf4DPTCksayh83VhjDVE8M8et7KmXAppD3s7" ; # manager + PUSH key "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager CREATE_ACCOUNT ; SWAP ; DIP { CONS } ; PUSH uint16 1 ; SWAP ; SUB ; DUP ; PUSH uint16 0 ; CMPNEQ } ; DROP ; - UNIT ; SWAP ; PAIR } \ No newline at end of file + UNIT ; SWAP ; PAIR } diff --git a/test/contracts/ret_int.tz b/test/contracts/ret_int.tz index 732bb1b7f..05b2fa622 100644 --- a/test/contracts/ret_int.tz +++ b/test/contracts/ret_int.tz @@ -1,4 +1,4 @@ parameter unit; -code {CADR; PUSH uint32 300; PAIR}; +code {CAR; PUSH uint32 300; PAIR}; return uint32; storage unit; diff --git a/test/contracts/reverse.tz b/test/contracts/reverse.tz index f8891fb58..aa5a824ad 100644 --- a/test/contracts/reverse.tz +++ b/test/contracts/reverse.tz @@ -1,7 +1,7 @@ parameter (list string); storage unit; return (list string); -code {CADR; DIP {NIL string}; SWAP; PUSH bool True; +code {CAR; DIP {NIL string}; SWAP; PUSH bool True; # INV: BOOL : ORIG_LIST : REV_LIST : [] LOOP {IF_CONS {DIP {SWAP}; CONS; SWAP; PUSH bool True} {NIL string; PUSH bool False}}; DROP; UNIT; SWAP; PAIR}; diff --git a/test/contracts/set_member.tz b/test/contracts/set_member.tz index 2f708ba02..3aa55693d 100644 --- a/test/contracts/set_member.tz +++ b/test/contracts/set_member.tz @@ -1,4 +1,4 @@ parameter string; storage (set string); return bool; -code {DUP; CADR; DIP{CDR}; MEM; DIP{EMPTY_SET string}; PAIR}; +code {DUP; CAR; DIP{CDR}; MEM; DIP{EMPTY_SET string}; PAIR}; diff --git a/test/contracts/store_input.tz b/test/contracts/store_input.tz index 010364736..1ccaf78e1 100644 --- a/test/contracts/store_input.tz +++ b/test/contracts/store_input.tz @@ -1,4 +1,4 @@ parameter string; return unit; storage string; -code {CADR; UNIT; PAIR}; +code {CAR; UNIT; PAIR}; diff --git a/test/contracts/str_id.tz b/test/contracts/str_id.tz index 2df99b5d5..2eaecaaf4 100644 --- a/test/contracts/str_id.tz +++ b/test/contracts/str_id.tz @@ -1,4 +1,4 @@ parameter string; return string; storage unit; -code {CADR; UNIT; SWAP; PAIR}; +code {CAR; UNIT; SWAP; PAIR}; diff --git a/test/contracts/swap_left_right.tz b/test/contracts/swap_left_right.tz index 8046c696e..00bcfcbf0 100644 --- a/test/contracts/swap_left_right.tz +++ b/test/contracts/swap_left_right.tz @@ -1,4 +1,4 @@ parameter (or bool string); return (or string bool); storage unit; -code {CADR; IF_LEFT {RIGHT string} {LEFT bool}; UNIT; SWAP; PAIR}; +code {CAR; IF_LEFT {RIGHT string} {LEFT bool}; UNIT; SWAP; PAIR}; diff --git a/test/contracts/tez_add_sub.tz b/test/contracts/tez_add_sub.tz index 2d9479585..ad3a1c2d9 100644 --- a/test/contracts/tez_add_sub.tz +++ b/test/contracts/tez_add_sub.tz @@ -1,6 +1,6 @@ parameter (pair tez tez); storage unit; return (pair tez tez); -code {CADR; DUP; DUP; CAR; DIP{CDR}; ADD; +code {CAR; DUP; DUP; CAR; DIP{CDR}; ADD; DIP{DUP; CAR; DIP{CDR}; SUB}; PAIR; UNIT; SWAP; PAIR}; diff --git a/test/contracts/transfer_to.tz b/test/contracts/transfer_to.tz index 26e71bd46..c4a8673f5 100644 --- a/test/contracts/transfer_to.tz +++ b/test/contracts/transfer_to.tz @@ -1,4 +1,4 @@ parameter (contract unit unit); return unit; storage unit; -code {CADR; DIP{UNIT}; PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR}; +code {CAR; DIP{UNIT}; PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR}; diff --git a/test/contracts/weather_insurance.tz b/test/contracts/weather_insurance.tz index 739c89d67..5eaa7bed7 100644 --- a/test/contracts/weather_insurance.tz +++ b/test/contracts/weather_insurance.tz @@ -4,12 +4,12 @@ parameter (pair signature uint16); storage (pair (pair (contract unit unit) (contract unit unit)) (pair uint16 key)); return unit; code {DUP; DUP; - CADR; DUP; DIP{CDR; H}; CAR; PAIR; + CAR; DUP; DIP{CDR; H}; CAR; PAIR; SWAP; CDDDR; CHECK_SIGNATURE; # Check if the data has been correctly signed - IF {NOP} {FAIL} # If signature is not correct, end the execution + IF {} {FAIL} # If signature is not correct, end the execution DUP; DUP; DUP; DIIIP{CDR}; # Place storage type on bottom of stack DIIP{CDAR}; # Place contracts below numbers - DIP{CADDR}; # Get actual rain + DIP{CADR}; # Get actual rain CDDAR; # Get rain threshold CMPLT; IF {CAR} {CDR}; # Select contract to receive tokens BALANCE; UNIT; TRANSFER_TOKENS; # Setup and execute transfer diff --git a/test/contracts/xor.tz b/test/contracts/xor.tz index 90055e027..f7185a14a 100644 --- a/test/contracts/xor.tz +++ b/test/contracts/xor.tz @@ -1,4 +1,4 @@ parameter (pair bool bool); return bool; storage unit; -code {CADR; DUP; CAR; DIP{CDR}; XOR; UNIT; SWAP; PAIR}; +code {CAR; DUP; CAR; DIP{CDR}; XOR; UNIT; SWAP; PAIR};