From 702896f420e1aab146007120830ac65747d40f4e Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Wed, 2 May 2018 18:29:07 +0200 Subject: [PATCH] Michelson: switch string tez constants to int mutez constants --- src/bin_client/test/contracts/accounts.tz | 10 +-- src/bin_client/test/contracts/at_least.tz | 2 +- src/bin_client/test/contracts/auction.tz | 2 +- src/bin_client/test/contracts/bad_lockup.tz | 4 +- src/bin_client/test/contracts/balance.tz | 2 +- src/bin_client/test/contracts/compare.tz | 2 +- src/bin_client/test/contracts/cps_fact.tz | 2 +- .../test/contracts/create_account.tz | 4 +- .../test/contracts/create_contract.tz | 6 +- .../test/contracts/default_account.tz | 2 +- src/bin_client/test/contracts/fail_amount.tz | 2 +- src/bin_client/test/contracts/forward.tz | 8 +- .../contracts/hash_consistency_checker.tz | 2 +- .../test/contracts/int_publisher.tz | 2 +- src/bin_client/test/contracts/king_of_tez.tz | 4 +- .../test/contracts/list_of_transactions.tz | 2 +- src/bin_client/test/contracts/lockup.tz | 2 +- src/bin_client/test/contracts/map_caddaadr.tz | 4 +- src/bin_client/test/contracts/originator.tz | 2 +- src/bin_client/test/contracts/reentrancy.tz | 4 +- src/bin_client/test/contracts/reservoir.tz | 2 +- .../test/contracts/scrutable_reservoir.tz | 12 +-- src/bin_client/test/contracts/set_caddaadr.tz | 4 +- .../test/contracts/spawn_identities.tz | 2 +- .../test/contracts/take_my_money.tz | 2 +- src/bin_client/test/contracts/tez_add_sub.tz | 4 +- .../test/contracts/transfer_amount.tz | 2 +- src/bin_client/test/contracts/transfer_to.tz | 2 +- src/bin_client/test/test_contracts.sh | 32 +++---- .../lib_protocol/src/alpha_context.mli | 2 +- .../src/michelson_v1_primitives.ml | 8 +- .../src/michelson_v1_primitives.mli | 2 +- .../lib_protocol/src/script_interpreter.ml | 2 +- .../lib_protocol/src/script_ir_translator.ml | 84 +++++++++---------- .../lib_protocol/src/script_typed_ir.ml | 4 +- .../lib_protocol/test/contracts/accounts.tz | 10 +-- .../lib_protocol/test/contracts/at_least.tz | 2 +- .../lib_protocol/test/contracts/auction.tz | 2 +- .../lib_protocol/test/contracts/bad_lockup.tz | 4 +- .../lib_protocol/test/contracts/balance.tz | 2 +- .../lib_protocol/test/contracts/compare.tz | 2 +- .../lib_protocol/test/contracts/cps_fact.tz | 2 +- .../test/contracts/create_account.tz | 4 +- .../test/contracts/create_contract.tz | 6 +- .../test/contracts/default_account.tz | 2 +- .../test/contracts/fail_amount.tz | 2 +- .../contracts/hash_consistency_checker.tz | 2 +- .../test/contracts/int_publisher.tz | 2 +- .../test/contracts/king_of_tez.tz | 4 +- .../test/contracts/list_of_transactions.tz | 2 +- .../lib_protocol/test/contracts/lockup.tz | 2 +- .../test/contracts/map_caddaadr.tz | 4 +- .../lib_protocol/test/contracts/originator.tz | 2 +- .../lib_protocol/test/contracts/reentrancy.tz | 4 +- .../test/contracts/set_caddaadr.tz | 4 +- .../test/contracts/spawn_identities.tz | 2 +- .../test/contracts/take_my_money.tz | 2 +- .../test/contracts/tez_add_sub.tz | 4 +- .../test/contracts/transfer_amount.tz | 2 +- .../test/contracts/transfer_to.tz | 2 +- .../lib_protocol/test/test_michelson.ml | 18 ++-- 61 files changed, 163 insertions(+), 163 deletions(-) diff --git a/src/bin_client/test/contracts/accounts.tz b/src/bin_client/test/contracts/accounts.tz index f6ca5350b..2496225d9 100644 --- a/src/bin_client/test/contracts/accounts.tz +++ b/src/bin_client/test/contracts/accounts.tz @@ -1,11 +1,11 @@ # This is a very simple accounts system. # (Left key) initializes or deposits into an account -# (Right key (pair tez (signed tez))) withdraws tez amount to a +# (Right key (pair mutez (signed mutez))) withdraws mutez amount to a # IMPLICIT_ACCOUNT created from the key if the balance is available # and the key is correctly signed -parameter (or key_hash (pair key (pair tez signature))); +parameter (or key_hash (pair key (pair mutez signature))); # Maps the key to the balance they have stored -storage (map key_hash tez); +storage (map key_hash mutez); code { DUP; CAR; # Deposit into account IF_LEFT { DUP; DIIP{ CDR; DUP }; @@ -30,8 +30,8 @@ code { DUP; CAR; IF { FAIL } { SUB; DIP{ DUP; DIP{ SWAP }}; DUP; # Delete account if balance is 0 - PUSH tez "0.00"; CMPEQ; - IF { DROP; NONE tez } + PUSH mutez 0; CMPEQ; + IF { DROP; NONE mutez } # Otherwise update storage with new balance { SOME }; SWAP; CAR; HASH_KEY; UPDATE; diff --git a/src/bin_client/test/contracts/at_least.tz b/src/bin_client/test/contracts/at_least.tz index 8fb126cbe..6c6d2968c 100644 --- a/src/bin_client/test/contracts/at_least.tz +++ b/src/bin_client/test/contracts/at_least.tz @@ -1,5 +1,5 @@ parameter unit; -storage tez; # How much you have to send me +storage mutez; # How much you have to send me code {CDR; DUP; # Get the amount required (once for comparison, once to save back in storage) AMOUNT; CMPLT; # Check to make sure no one is wasting my time IF {FAIL} # Reject the person diff --git a/src/bin_client/test/contracts/auction.tz b/src/bin_client/test/contracts/auction.tz index 48f477394..af8aedfb7 100644 --- a/src/bin_client/test/contracts/auction.tz +++ b/src/bin_client/test/contracts/auction.tz @@ -1,5 +1,5 @@ parameter key_hash; -storage (pair timestamp (pair tez key_hash)); +storage (pair timestamp (pair mutez key_hash)); code { DUP; CDAR; DUP; NOW; CMPGT; IF {FAIL} {}; SWAP; # Check if auction has ended DUP; CAR; DIP{CDDR}; AMOUNT; PAIR; SWAP; DIP{SWAP; PAIR}; # Setup replacement storage DUP; CAR; AMOUNT; CMPLE; IF {FAIL} {}; # Check to make sure that the new amount is greater diff --git a/src/bin_client/test/contracts/bad_lockup.tz b/src/bin_client/test/contracts/bad_lockup.tz index b2ebfc266..aeb3ec7fe 100644 --- a/src/bin_client/test/contracts/bad_lockup.tz +++ b/src/bin_client/test/contracts/bad_lockup.tz @@ -1,6 +1,6 @@ parameter unit; storage (pair timestamp (pair (contract unit) (contract unit))); code { CDR; DUP; CAR; NOW; CMPLT; IF {FAIL} {}; - DUP; CDAR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; SWAP; - DUP; CDDR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; DIP {SWAP} ; + DUP; CDAR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; SWAP; + DUP; CDDR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; DIP {SWAP} ; NIL operation ; SWAP ; CONS ; SWAP ; CONS ; PAIR } diff --git a/src/bin_client/test/contracts/balance.tz b/src/bin_client/test/contracts/balance.tz index 98568476e..0a9bfc614 100644 --- a/src/bin_client/test/contracts/balance.tz +++ b/src/bin_client/test/contracts/balance.tz @@ -1,3 +1,3 @@ parameter unit; -storage tez; +storage mutez; code {DROP; BALANCE; NIL operation; PAIR}; diff --git a/src/bin_client/test/contracts/compare.tz b/src/bin_client/test/contracts/compare.tz index f31561c51..698ef3e69 100644 --- a/src/bin_client/test/contracts/compare.tz +++ b/src/bin_client/test/contracts/compare.tz @@ -1,4 +1,4 @@ -parameter (pair tez tez); +parameter (pair mutez mutez); storage (list bool); code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS}; diff --git a/src/bin_client/test/contracts/cps_fact.tz b/src/bin_client/test/contracts/cps_fact.tz index d26e57715..445ceca44 100644 --- a/src/bin_client/test/contracts/cps_fact.tz +++ b/src/bin_client/test/contracts/cps_fact.tz @@ -11,6 +11,6 @@ code { UNPAIR ; IF_NONE { NIL operation ; PAIR } { DUP ; DIP { PUSH nat 1 ; ADD ; MUL @storage } ; SWAP; - DIP { DIP { SELF; PUSH tez "0" } ; + DIP { DIP { SELF; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; SWAP ; PAIR } } } \ No newline at end of file diff --git a/src/bin_client/test/contracts/create_account.tz b/src/bin_client/test/contracts/create_account.tz index 38c894c8d..816b62257 100644 --- a/src/bin_client/test/contracts/create_account.tz +++ b/src/bin_client/test/contracts/create_account.tz @@ -2,9 +2,9 @@ parameter (or key_hash address) ; storage (option (contract unit)) ; code { CAR; IF_LEFT - { DIP { PUSH tez "100.00" ; PUSH bool False ; NONE key_hash }; + { DIP { PUSH mutez 100000000 ; PUSH bool False ; NONE key_hash }; CREATE_ACCOUNT ; - DIP { RIGHT key_hash ; DIP { SELF ; PUSH tez "0" } ; TRANSFER_TOKENS ; + DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; CONS ; NONE (contract unit) ; SWAP ; PAIR } { SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ; diff --git a/src/bin_client/test/contracts/create_contract.tz b/src/bin_client/test/contracts/create_contract.tz index d9aa97348..c6664c2f2 100644 --- a/src/bin_client/test/contracts/create_contract.tz +++ b/src/bin_client/test/contracts/create_contract.tz @@ -3,16 +3,16 @@ storage unit; code { CAR; IF_LEFT { DIP { PUSH string "dummy"; - PUSH tez "100.00" ; PUSH bool False ; + PUSH mutez 100000000 ; PUSH bool False ; PUSH bool False ; NONE key_hash } ; CREATE_CONTRACT { parameter string ; storage string ; code { CAR ; NIL operation ; PAIR } } ; - DIP { RIGHT key_hash ; DIP { SELF ; PUSH tez "0" } ; TRANSFER_TOKENS ; + DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; CONS ; UNIT ; SWAP ; PAIR } { SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ; CONTRACT string ; IF_SOME {} { FAIL } ; - PUSH tez "0.00" ; PUSH string "abcdefg" ; TRANSFER_TOKENS ; + PUSH mutez 0 ; PUSH string "abcdefg" ; TRANSFER_TOKENS ; NIL operation; SWAP; CONS ; UNIT ; SWAP ; PAIR } }; diff --git a/src/bin_client/test/contracts/default_account.tz b/src/bin_client/test/contracts/default_account.tz index 3a48fc1d9..db9f01156 100644 --- a/src/bin_client/test/contracts/default_account.tz +++ b/src/bin_client/test/contracts/default_account.tz @@ -1,5 +1,5 @@ parameter key_hash; storage unit; code {DIP{UNIT}; CAR; IMPLICIT_ACCOUNT; - PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; + PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR} diff --git a/src/bin_client/test/contracts/fail_amount.tz b/src/bin_client/test/contracts/fail_amount.tz index f4239b19e..95b71c4f0 100644 --- a/src/bin_client/test/contracts/fail_amount.tz +++ b/src/bin_client/test/contracts/fail_amount.tz @@ -2,5 +2,5 @@ parameter unit; storage unit; code { DROP; - AMOUNT; PUSH tez "10"; CMPGT; IF {FAIL} {}; + AMOUNT; PUSH mutez 10000000; CMPGT; IF {FAIL} {}; UNIT; NIL operation; PAIR} diff --git a/src/bin_client/test/contracts/forward.tz b/src/bin_client/test/contracts/forward.tz index c93f3b694..a2ec8edcd 100644 --- a/src/bin_client/test/contracts/forward.tz +++ b/src/bin_client/test/contracts/forward.tz @@ -2,11 +2,11 @@ parameter (or string nat) ; storage (pair - (pair nat (pair tez tez)) # counter from_buyer from_seller + (pair nat (pair mutez mutez)) # counter from_buyer from_seller (pair (pair nat (pair timestamp timestamp)) # Q T Z (pair - (pair tez tez) # K C + (pair mutez mutez) # K C (pair (pair (contract unit) (contract unit)) # B S (contract unit))))) ; # W @@ -40,12 +40,12 @@ code { FAIL } } # (Right _) { # After Z + 24 # if balance is emptied, just fail - BALANCE ; PUSH tez "0" ; IFCMPEQ { FAIL } {} ; + BALANCE ; PUSH mutez 0 ; IFCMPEQ { FAIL } {} ; # test if the required amount is reached DUP ; CDDAAR ; # Q DIP { DUP ; CDDDADR } ; MUL ; # C PUSH nat 2 ; MUL ; - PUSH tez "1.00" ; ADD ; + PUSH mutez 1000000 ; ADD ; BALANCE ; COMPARE ; LT ; # balance < 2 * (Q * C) + 1 IF { # refund the parties CDR ; DUP ; CADAR ; # amount versed by the buyer diff --git a/src/bin_client/test/contracts/hash_consistency_checker.tz b/src/bin_client/test/contracts/hash_consistency_checker.tz index 5d3c611ca..40db8e0d5 100644 --- a/src/bin_client/test/contracts/hash_consistency_checker.tz +++ b/src/bin_client/test/contracts/hash_consistency_checker.tz @@ -1,3 +1,3 @@ -parameter (pair tez (pair timestamp int)) ; +parameter (pair mutez (pair timestamp int)) ; storage string ; code { CAR ; H ; NIL operation ; PAIR } \ No newline at end of file diff --git a/src/bin_client/test/contracts/int_publisher.tz b/src/bin_client/test/contracts/int_publisher.tz index 4b2a3e16a..01820468a 100644 --- a/src/bin_client/test/contracts/int_publisher.tz +++ b/src/bin_client/test/contracts/int_publisher.tz @@ -2,7 +2,7 @@ parameter (option (pair signature int)); storage (pair key int); code {DUP; DUP; CAR; - IF_NONE {PUSH tez "1.00"; # Fee pattern from July 26 + IF_NONE {PUSH mutez 1000000; # Fee pattern from July 26 AMOUNT; CMPLE; IF {FAIL} {}; # Provide the data CDR; DIP {CDDR}} diff --git a/src/bin_client/test/contracts/king_of_tez.tz b/src/bin_client/test/contracts/king_of_tez.tz index 796325f30..033ead7f1 100644 --- a/src/bin_client/test/contracts/king_of_tez.tz +++ b/src/bin_client/test/contracts/king_of_tez.tz @@ -1,9 +1,9 @@ parameter key_hash; -storage (pair timestamp (pair tez key_hash)); +storage (pair timestamp (pair mutez key_hash)); code { DUP; CDAR; # If the time is more than 2 weeks, any amount makes you king NOW; CMPGT; - # User becomes king of tez + # User becomes king of mutez IF { CAR; AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR; NIL operation } # Check balance to see if user has paid enough to become the new king diff --git a/src/bin_client/test/contracts/list_of_transactions.tz b/src/bin_client/test/contracts/list_of_transactions.tz index 039ff7596..412112aad 100644 --- a/src/bin_client/test/contracts/list_of_transactions.tz +++ b/src/bin_client/test/contracts/list_of_transactions.tz @@ -2,7 +2,7 @@ parameter unit; storage (list (contract unit)); code { CDR; DUP; DIP {NIL operation}; PUSH bool True; # Setup loop - LOOP {IF_CONS { PUSH tez "1.00"; UNIT; TRANSFER_TOKENS; # Make transfer + LOOP {IF_CONS { PUSH mutez 1000000; UNIT; TRANSFER_TOKENS; # Make transfer SWAP; DIP {CONS}; PUSH bool True} # Setup for next round of loop { NIL (contract unit); PUSH bool False}}; # Data to satisfy types and end loop DROP; PAIR}; # Calling convention diff --git a/src/bin_client/test/contracts/lockup.tz b/src/bin_client/test/contracts/lockup.tz index 5fffa36ec..a68a8628f 100644 --- a/src/bin_client/test/contracts/lockup.tz +++ b/src/bin_client/test/contracts/lockup.tz @@ -1,5 +1,5 @@ parameter unit; -storage (pair timestamp (pair tez (contract unit))); +storage (pair timestamp (pair mutez (contract unit))); code { CDR; # Ignore the parameter DUP; # Duplicate the storage CAR; # Get the timestamp diff --git a/src/bin_client/test/contracts/map_caddaadr.tz b/src/bin_client/test/contracts/map_caddaadr.tz index b0b436795..4b6dccce9 100644 --- a/src/bin_client/test/contracts/map_caddaadr.tz +++ b/src/bin_client/test/contracts/map_caddaadr.tz @@ -1,4 +1,4 @@ parameter unit; -storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); -code { MAP_CDADDAADR { PUSH tez "1.00" ; ADD } ; +storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat); +code { MAP_CDADDAADR { PUSH mutez 1000000 ; ADD } ; NIL operation ; SWAP; SET_CAR }; diff --git a/src/bin_client/test/contracts/originator.tz b/src/bin_client/test/contracts/originator.tz index f7a87fa53..c454e230d 100644 --- a/src/bin_client/test/contracts/originator.tz +++ b/src/bin_client/test/contracts/originator.tz @@ -4,7 +4,7 @@ code { DUP ; CAR ; PUSH nat 0 ; CMPNEQ ; DIP { DUP ; CAR ; DIP { CDR ; NIL operation } } ; LOOP - { PUSH tez "5.00" ; + { PUSH mutez 5000000 ; PUSH bool True ; # delegatable NONE key_hash ; # delegate PUSH key_hash "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager diff --git a/src/bin_client/test/contracts/reentrancy.tz b/src/bin_client/test/contracts/reentrancy.tz index 5d9ec49c1..2e5d92060 100644 --- a/src/bin_client/test/contracts/reentrancy.tz +++ b/src/bin_client/test/contracts/reentrancy.tz @@ -1,7 +1,7 @@ parameter unit; storage (pair (contract unit) (contract unit)); -code { CDR; DUP; CAR; PUSH tez "5.00"; UNIT; +code { CDR; DUP; CAR; PUSH mutez 5000000; UNIT; TRANSFER_TOKENS; DIP {DUP; CDR; - PUSH tez "5.00"; UNIT; TRANSFER_TOKENS}; + PUSH mutez 5000000; UNIT; TRANSFER_TOKENS}; DIIP{NIL operation};DIP{CONS};CONS;PAIR}; diff --git a/src/bin_client/test/contracts/reservoir.tz b/src/bin_client/test/contracts/reservoir.tz index c5dd37550..d357e0acb 100644 --- a/src/bin_client/test/contracts/reservoir.tz +++ b/src/bin_client/test/contracts/reservoir.tz @@ -1,7 +1,7 @@ parameter unit ; storage (pair - (pair (timestamp @T) (tez @N)) + (pair (timestamp @T) (mutez @N)) (pair (contract @A unit) (contract @B unit))) ; code { CDR ; DUP ; CAAR ; # T diff --git a/src/bin_client/test/contracts/scrutable_reservoir.tz b/src/bin_client/test/contracts/scrutable_reservoir.tz index d6aa88979..2a82d4b33 100644 --- a/src/bin_client/test/contracts/scrutable_reservoir.tz +++ b/src/bin_client/test/contracts/scrutable_reservoir.tz @@ -5,7 +5,7 @@ storage (pair timestamp # T (pair - (pair tez tez) # P N + (pair mutez mutez) # P N (pair (contract unit) # X (pair (contract unit) (contract unit)))))) ; # A B @@ -18,8 +18,8 @@ code NOW ; COMPARE ; LT ; IF { # Before timeout - # We compute ((1 + P) + N) tez for keeping the contract alive - PUSH tez "1.00" ; + # We compute ((1 + P) + N) mutez for keeping the contract alive + PUSH mutez 1000000 ; DIP { DUP ; CDDDAAR } ; ADD ; # P DIP { DUP ; CDDDADR } ; ADD ; # N # We compare to the cumulated amount @@ -45,17 +45,17 @@ code # We update the global CDDR ; PUSH string "timeout" ; PAIR ; # We try to transfer the fee to the broker - PUSH tez "1.00" ; BALANCE ; SUB ; # available + PUSH mutez 1000000 ; BALANCE ; SUB ; # available DIP { DUP ; CDDAAR } ; # P COMPARE ; LT ; # available < P - IF { PUSH tez "1.00" ; BALANCE ; SUB ; # available + IF { PUSH mutez 1000000 ; BALANCE ; SUB ; # available DIP { DUP ; CDDDAR } ; # X UNIT ; TRANSFER_TOKENS } { DUP ; CDDAAR ; # P DIP { DUP ; CDDDAR } ; # X UNIT ; TRANSFER_TOKENS } ; # We transfer the rest to B - DIP { PUSH tez "1.00" ; BALANCE ; SUB ; # available + DIP { PUSH mutez 1000000 ; BALANCE ; SUB ; # available DIP { DUP ; CDDDDDR } ; # B UNIT ; TRANSFER_TOKENS } ; NIL operation ; SWAP ; CONS ; SWAP ; CONS ; diff --git a/src/bin_client/test/contracts/set_caddaadr.tz b/src/bin_client/test/contracts/set_caddaadr.tz index 39878a962..db967edb2 100644 --- a/src/bin_client/test/contracts/set_caddaadr.tz +++ b/src/bin_client/test/contracts/set_caddaadr.tz @@ -1,5 +1,5 @@ -parameter tez; -storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); +parameter mutez; +storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat); code { DUP ; CAR ; SWAP ; CDR ; SET_CADDAADR @annot ; NIL operation ; PAIR }; diff --git a/src/bin_client/test/contracts/spawn_identities.tz b/src/bin_client/test/contracts/spawn_identities.tz index 717c7c374..91b062aff 100644 --- a/src/bin_client/test/contracts/spawn_identities.tz +++ b/src/bin_client/test/contracts/spawn_identities.tz @@ -8,7 +8,7 @@ code { DUP; IF { PUSH bool False} # End the loop { PUSH nat 1; SWAP; SUB; ABS; # Subtract 1. The ABS is to make it back into a nat PUSH string "init"; # Storage type - PUSH tez "5.00"; # Strating balance + PUSH mutez 5000000; # Strating balance PUSH bool False; DUP; # Not spendable or delegatable NONE key_hash; PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5"; diff --git a/src/bin_client/test/contracts/take_my_money.tz b/src/bin_client/test/contracts/take_my_money.tz index 86cd1624b..bb502d041 100644 --- a/src/bin_client/test/contracts/take_my_money.tz +++ b/src/bin_client/test/contracts/take_my_money.tz @@ -2,7 +2,7 @@ parameter key_hash; storage unit; code { CAR; IMPLICIT_ACCOUNT; # Create an account for the recipient of the funds DIP{UNIT}; # Push a value of the storage type below the contract - PUSH tez "1.00"; # The person can have a ꜩ + PUSH mutez 1000000; # The person can have a ꜩ UNIT; # Push the contract's argument type TRANSFER_TOKENS; # Run the transfer NIL operation; SWAP; CONS; diff --git a/src/bin_client/test/contracts/tez_add_sub.tz b/src/bin_client/test/contracts/tez_add_sub.tz index ad8bae659..39eba1d16 100644 --- a/src/bin_client/test/contracts/tez_add_sub.tz +++ b/src/bin_client/test/contracts/tez_add_sub.tz @@ -1,5 +1,5 @@ -parameter (pair tez tez); -storage (option (pair tez tez)); +parameter (pair mutez mutez); +storage (option (pair mutez mutez)); code {CAR; DUP; DUP; CAR; DIP{CDR}; ADD; DIP{DUP; CAR; DIP{CDR}; SUB}; PAIR; SOME; NIL operation; PAIR}; diff --git a/src/bin_client/test/contracts/transfer_amount.tz b/src/bin_client/test/contracts/transfer_amount.tz index 8da204e83..973c64f04 100644 --- a/src/bin_client/test/contracts/transfer_amount.tz +++ b/src/bin_client/test/contracts/transfer_amount.tz @@ -1,3 +1,3 @@ parameter unit; -storage tez; +storage mutez; code { DROP; AMOUNT; NIL operation; PAIR }; diff --git a/src/bin_client/test/contracts/transfer_to.tz b/src/bin_client/test/contracts/transfer_to.tz index bb8445bfe..599b4dae1 100644 --- a/src/bin_client/test/contracts/transfer_to.tz +++ b/src/bin_client/test/contracts/transfer_to.tz @@ -1,5 +1,5 @@ parameter (contract unit); storage unit; -code { CAR; DIP{UNIT}; PUSH tez "100.00"; UNIT; +code { CAR; DIP{UNIT}; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR}; diff --git a/src/bin_client/test/test_contracts.sh b/src/bin_client/test/test_contracts.sh index 0019eb5e4..595bc1b38 100755 --- a/src/bin_client/test/test_contracts.sh +++ b/src/bin_client/test/test_contracts.sh @@ -213,16 +213,16 @@ assert_storage $contract_dir/exec_concat.tz '"?"' '"test"' '"test_abc"' assert_storage $contract_dir/steps_to_quota.tz 111 Unit 399992 # Get the current balance of the contract -assert_storage $contract_dir/balance.tz '"111"' Unit '"4,000,000"' +assert_storage $contract_dir/balance.tz '111' Unit '4000000000000' # Test comparisons on tez { EQ ; GT ; LT ; GE ; LE } -assert_storage $contract_dir/compare.tz '{}' '(Pair "1.00" "2.00")' '{ False ; False ; True ; False ; True }' -assert_storage $contract_dir/compare.tz '{}' '(Pair "2.00" "1.00")' '{ False ; True ; False ; True ; False }' -assert_storage $contract_dir/compare.tz '{}' '(Pair "2.37" "2.37")' '{ True ; False ; False ; True ; True }' +assert_storage $contract_dir/compare.tz '{}' '(Pair 1000000 2000000)' '{ False ; False ; True ; False ; True }' +assert_storage $contract_dir/compare.tz '{}' '(Pair 2000000 1000000)' '{ False ; True ; False ; True ; False }' +assert_storage $contract_dir/compare.tz '{}' '(Pair 2370000 2370000)' '{ True ; False ; False ; True ; True }' # Test addition and subtraction on tez -assert_storage $contract_dir/tez_add_sub.tz None '(Pair "2" "1")' '(Some (Pair "3" "1"))' -assert_storage $contract_dir/tez_add_sub.tz None '(Pair "2.31" "1.01")' '(Some (Pair "3.32" "1.3"))' +assert_storage $contract_dir/tez_add_sub.tz None '(Pair 2000000 1000000)' '(Some (Pair 3000000 1000000))' +assert_storage $contract_dir/tez_add_sub.tz None '(Pair 2310000 1010000)' '(Some (Pair 3320000 1300000))' # Test get first element of list assert_storage $contract_dir/first.tz '111' '{ 1 ; 2 ; 3 ; 4 }' '1' @@ -303,14 +303,14 @@ assert_storage $contract_dir/set_cdr.tz '(Pair "hello" 500)' '3' '(Pair "hello" assert_storage $contract_dir/set_cdr.tz '(Pair "hello" 7)' '100' '(Pair "hello" 100)' assert_storage $contract_dir/set_caddaadr.tz \ -'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 "0") 4) 5))) 6)' \ -'"3"' \ -'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 "3") 4) 5))) 6)' +'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 0) 4) 5))) 6)' \ +'3000000' \ +'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 3000000) 4) 5))) 6)' assert_storage $contract_dir/map_caddaadr.tz \ -'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 "0") 4) 5))) 6)' \ +'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 0) 4) 5))) 6)' \ 'Unit' \ -'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 "1") 4) 5))) 6)' +'(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 1000000) 4) 5))) 6)' # Did the given key sign the string? (key is bootstrap1) assert_success $client run program $contract_dir/check_signature.tz \ @@ -343,7 +343,7 @@ assert_storage_contains store_input '"abcdefg"' bake_after $client transfer 100 from bootstrap1 to store_input -arg '"xyz"' assert_storage_contains store_input '"xyz"' -init_with_transfer $contract_dir/transfer_amount.tz $key1 '"0"' "100" bootstrap1 +init_with_transfer $contract_dir/transfer_amount.tz $key1 '0' "100" bootstrap1 bake_after $client transfer 500 from bootstrap1 to transfer_amount -arg Unit assert_storage_contains transfer_amount 500 @@ -443,14 +443,14 @@ assert_fails $client typecheck data '{ "A" ; "C" ; "B" }' against type '(set str assert_fails $client typecheck data '{ "A" ; "B" ; "B" }' against type '(set string)' # Test hash consistency between Michelson and the CLI -hash_result=`$client hash data '(Pair "22220.00" (Pair "2017-12-13T04:49:00Z" 034))' \ - of type '(pair tez (pair timestamp int))' | grep expr` +hash_result=`$client hash data '(Pair 22220000000 (Pair "2017-12-13T04:49:00Z" 034))' \ + of type '(pair mutez (pair timestamp int))' | grep expr` assert_storage $contract_dir/hash_consistency_checker.tz '"?"' \ - '(Pair "22220.00" (Pair "2017-12-13T04:49:00Z" 034))' "$hash_result" + '(Pair 22220000000 (Pair "2017-12-13T04:49:00Z" 034))' "$hash_result" assert_storage $contract_dir/hash_consistency_checker.tz '"?"' \ - '(Pair "22,220" (Pair "2017-12-13T04:49:00+00:00" 34))' "$hash_result" + '(Pair 22220000000 (Pair "2017-12-13T04:49:00+00:00" 34))' "$hash_result" # Test for big maps init_with_transfer $contract_dir/big_map_mem.tz $key1\ diff --git a/src/proto_alpha/lib_protocol/src/alpha_context.mli b/src/proto_alpha/lib_protocol/src/alpha_context.mli index 95a62eb9f..d596189bd 100644 --- a/src/proto_alpha/lib_protocol/src/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/src/alpha_context.mli @@ -261,7 +261,7 @@ module Script : sig | T_set | T_signature | T_string - | T_tez + | T_mutez | T_timestamp | T_unit | T_operation diff --git a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml index 021f652cd..428b7b545 100644 --- a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml +++ b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.ml @@ -113,7 +113,7 @@ type prim = | T_set | T_signature | T_string - | T_tez + | T_mutez | T_timestamp | T_unit | T_operation @@ -238,7 +238,7 @@ let string_of_prim = function | T_set -> "set" | T_signature -> "signature" | T_string -> "string" - | T_tez -> "tez" + | T_mutez -> "mutez" | T_timestamp -> "timestamp" | T_unit -> "unit" | T_operation -> "operation" @@ -344,7 +344,7 @@ let prim_of_string = function | "set" -> ok T_set | "signature" -> ok T_signature | "string" -> ok T_string - | "tez" -> ok T_tez + | "mutez" -> ok T_mutez | "timestamp" -> ok T_timestamp | "unit" -> ok T_unit | "operation" -> ok T_operation @@ -494,7 +494,7 @@ let prim_encoding = ("set", T_set) ; ("signature", T_signature) ; ("string", T_string) ; - ("tez", T_tez) ; + ("mutez", T_mutez) ; ("timestamp", T_timestamp) ; ("unit", T_unit) ; ("operation", T_operation) ; diff --git a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.mli b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.mli index b982921ab..c1b16740a 100644 --- a/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.mli +++ b/src/proto_alpha/lib_protocol/src/michelson_v1_primitives.mli @@ -111,7 +111,7 @@ type prim = | T_set | T_signature | T_string - | T_tez + | T_mutez | T_timestamp | T_unit | T_operation diff --git a/src/proto_alpha/lib_protocol/src/script_interpreter.ml b/src/proto_alpha/lib_protocol/src/script_interpreter.ml index af5c19ca7..fc0979b6a 100644 --- a/src/proto_alpha/lib_protocol/src/script_interpreter.ml +++ b/src/proto_alpha/lib_protocol/src/script_interpreter.ml @@ -517,7 +517,7 @@ let rec interp consume_gaz_comparison descr Compare.Bool.compare Interp_costs.compare_bool a b rest | Compare String_key, Item (a, Item (b, rest)) -> consume_gaz_comparison descr Compare.String.compare Interp_costs.compare_string a b rest - | Compare Tez_key, Item (a, Item (b, rest)) -> + | Compare Mutez_key, Item (a, Item (b, rest)) -> consume_gaz_comparison descr Tez.compare Interp_costs.compare_tez a b rest | Compare Int_key, Item (a, Item (b, rest)) -> consume_gaz_comparison descr Script_int.compare Interp_costs.compare_int a b rest diff --git a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml index f7e595e04..598295284 100644 --- a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml @@ -42,7 +42,7 @@ let comparable_type_size : type t. t comparable_ty -> int = function | Int_key -> 1 | Nat_key -> 1 | String_key -> 1 - | Tez_key -> 1 + | Mutez_key -> 1 | Bool_key -> 1 | Key_hash_key -> 1 | Timestamp_key -> 1 @@ -54,7 +54,7 @@ let rec type_size : type t. t ty -> int = function | Nat_t -> 1 | Signature_t -> 1 | String_t -> 1 - | Tez_t -> 1 + | Mutez_t -> 1 | Key_hash_t -> 1 | Key_t -> 1 | Timestamp_t -> 1 @@ -322,7 +322,7 @@ let namespace = function | T_set | T_signature | T_string - | T_tez + | T_mutez | T_timestamp | T_unit | T_operation @@ -358,7 +358,7 @@ let compare_comparable = fun kind x y -> match kind with | String_key -> Compare.String.compare x y | Bool_key -> Compare.Bool.compare x y - | Tez_key -> Tez.compare x y + | Mutez_key -> Tez.compare x y | Key_hash_key -> Signature.Public_key_hash.compare x y | Int_key -> let res = (Script_int.compare x y) in @@ -495,7 +495,7 @@ let ty_of_comparable_ty | Int_key -> Int_t | Nat_key -> Nat_t | String_key -> String_t - | Tez_key -> Tez_t + | Mutez_key -> Mutez_t | Bool_key -> Bool_t | Key_hash_key -> Key_hash_t | Timestamp_key -> Timestamp_t @@ -506,7 +506,7 @@ let unparse_comparable_ty | Int_key -> Prim (-1, T_int, [], None) | Nat_key -> Prim (-1, T_nat, [], None) | String_key -> Prim (-1, T_string, [], None) - | Tez_key -> Prim (-1, T_tez, [], None) + | Mutez_key -> Prim (-1, T_mutez, [], None) | Bool_key -> Prim (-1, T_bool, [], None) | Key_hash_key -> Prim (-1, T_key_hash, [], None) | Timestamp_key -> Prim (-1, T_timestamp, [], None) @@ -519,7 +519,7 @@ let rec unparse_ty | Int_t -> Prim (-1, T_int, [], annot) | Nat_t -> Prim (-1, T_nat, [], annot) | String_t -> Prim (-1, T_string, [], annot) - | Tez_t -> Prim (-1, T_tez, [], annot) + | Mutez_t -> Prim (-1, T_mutez, [], annot) | Bool_t -> Prim (-1, T_bool, [], annot) | Key_hash_t -> Prim (-1, T_key_hash, [], annot) | Key_t -> Prim (-1, T_key, [], annot) @@ -604,9 +604,9 @@ let rec unparse_data MBytes.to_hex (Data_encoding.Binary.to_bytes_exn Signature.encoding s) in (String (-1, text), gas) - | Tez_t, v -> + | Mutez_t, v -> Gas.consume ctxt Unparse_costs.tez >|? fun gas -> - (String (-1, Tez.to_string v), gas) + (Int (-1, Z.of_int64 (Tez.to_mutez v)), gas) | Key_t, k -> Gas.consume ctxt Unparse_costs.key >|? fun gas -> (String (-1, Signature.Public_key.to_b58check k), gas) @@ -686,7 +686,7 @@ let comparable_ty_eq | Int_key, Int_key -> Ok Eq | Nat_key, Nat_key -> Ok Eq | String_key, String_key -> Ok Eq - | Tez_key, Tez_key -> Ok Eq + | Mutez_key, Mutez_key -> Ok Eq | Bool_key, Bool_key -> Ok Eq | Key_hash_key, Key_hash_key -> Ok Eq | Timestamp_key, Timestamp_key -> Ok Eq @@ -704,7 +704,7 @@ let rec ty_eq | Key_hash_t, Key_hash_t -> Ok Eq | String_t, String_t -> Ok Eq | Signature_t, Signature_t -> Ok Eq - | Tez_t, Tez_t -> Ok Eq + | Mutez_t, Mutez_t -> Ok Eq | Timestamp_t, Timestamp_t -> Ok Eq | Address_t, Address_t -> Ok Eq | Bool_t, Bool_t -> Ok Eq @@ -783,7 +783,7 @@ let merge_comparable_types | Int_key, Int_key -> ta | Nat_key, Nat_key -> ta | String_key, String_key -> ta - | Tez_key, Tez_key -> ta + | Mutez_key, Mutez_key -> ta | Bool_key, Bool_key -> ta | Key_hash_key, Key_hash_key -> ta | Timestamp_key, Timestamp_key -> ta @@ -816,7 +816,7 @@ let merge_types : | Key_hash_t, Key_hash_t -> ok Key_hash_t | String_t, String_t -> ok String_t | Signature_t, Signature_t -> ok Signature_t - | Tez_t, Tez_t -> ok Tez_t + | Mutez_t, Mutez_t -> ok Mutez_t | Timestamp_t, Timestamp_t -> ok Timestamp_t | Address_t, Address_t -> ok Address_t | Bool_t, Bool_t -> ok Bool_t @@ -921,13 +921,13 @@ let rec parse_comparable_ty | Prim (_, T_int, [], _) -> ok (Ex_comparable_ty Int_key) | Prim (_, T_nat, [], _) -> ok (Ex_comparable_ty Nat_key) | Prim (_, T_string, [], _) -> ok (Ex_comparable_ty String_key) - | Prim (_, T_tez, [], _) -> ok (Ex_comparable_ty Tez_key) + | Prim (_, T_mutez, [], _) -> ok (Ex_comparable_ty Mutez_key) | Prim (_, T_bool, [], _) -> ok (Ex_comparable_ty Bool_key) | Prim (_, T_key_hash, [], _) -> ok (Ex_comparable_ty Key_hash_key) | Prim (_, T_timestamp, [], _) -> ok (Ex_comparable_ty Timestamp_key) | Prim (_, T_address, [], _) -> ok (Ex_comparable_ty Address_key) | Prim (loc, (T_int | T_nat - | T_string | T_tez | T_bool + | T_string | T_mutez | T_bool | T_key | T_address | T_timestamp as prim), l, _) -> error (Invalid_arity (loc, prim, 0, List.length l)) | Prim (loc, (T_pair | T_or | T_set | T_map @@ -938,7 +938,7 @@ let rec parse_comparable_ty | expr -> error @@ unexpected expr [] Type_namespace [ T_int ; T_nat ; - T_string ; T_tez ; T_bool ; + T_string ; T_mutez ; T_bool ; T_key ; T_key_hash ; T_timestamp ] and parse_ty @@ -968,8 +968,8 @@ and parse_ty ok (Ex_ty Nat_t, annot) | Prim (_, T_string, [], annot) -> ok (Ex_ty String_t, annot) - | Prim (_, T_tez, [], annot) -> - ok (Ex_ty Tez_t, annot) + | Prim (_, T_mutez, [], annot) -> + ok (Ex_ty Mutez_t, annot) | Prim (_, T_bool, [], annot) -> ok (Ex_ty Bool_t, annot) | Prim (_, T_key, [], annot) -> @@ -1019,7 +1019,7 @@ and parse_ty error (Unexpected_big_map loc) | Prim (loc, (T_unit | T_signature | T_int | T_nat - | T_string | T_tez | T_bool + | T_string | T_mutez | T_bool | T_key | T_key_hash | T_timestamp | T_address as prim), l, _) -> error (Invalid_arity (loc, prim, 0, List.length l)) @@ -1033,7 +1033,7 @@ and parse_ty T_list ; T_option ; T_lambda ; T_unit ; T_signature ; T_contract ; T_int ; T_nat ; T_operation ; - T_string ; T_tez ; T_bool ; + T_string ; T_mutez ; T_bool ; T_key ; T_key_hash ; T_timestamp ] let rec unparse_stack @@ -1128,16 +1128,16 @@ let rec parse_data | Nat_t, expr -> traced (fail (Invalid_kind (location expr, [ Int_kind ], kind expr))) (* Tez amounts *) - | Tez_t, String (_, v) -> + | Mutez_t, Int (_, v) -> Lwt.return (Gas.consume ctxt Typecheck_costs.tez) >>=? fun ctxt -> begin try - match Tez.of_string v with + match Tez.of_mutez (Z.to_int64 v) with | None -> raise Exit | Some tez -> return (tez, ctxt) with _ -> fail @@ error () end - | Tez_t, expr -> + | Mutez_t, expr -> traced (fail (Invalid_kind (location expr, [ String_kind ], kind expr))) (* Timestamps *) | Timestamp_t, (Int (_, v)) -> @@ -1790,21 +1790,21 @@ and parse_instr (Item_t (String_t, rest, instr_annot)) (* currency operations *) | Prim (loc, I_ADD, [], instr_annot), - Item_t (Tez_t, Item_t (Tez_t, rest, _), _) -> + Item_t (Mutez_t, Item_t (Mutez_t, rest, _), _) -> typed ctxt loc Add_tez - (Item_t (Tez_t, rest, instr_annot)) + (Item_t (Mutez_t, rest, instr_annot)) | Prim (loc, I_SUB, [], instr_annot), - Item_t (Tez_t, Item_t (Tez_t, rest, _), _) -> + Item_t (Mutez_t, Item_t (Mutez_t, rest, _), _) -> typed ctxt loc Sub_tez - (Item_t (Tez_t, rest, instr_annot)) + (Item_t (Mutez_t, rest, instr_annot)) | Prim (loc, I_MUL, [], instr_annot), - Item_t (Tez_t, Item_t (Nat_t, rest, _), _) -> + Item_t (Mutez_t, Item_t (Nat_t, rest, _), _) -> typed ctxt loc Mul_teznat - (Item_t (Tez_t, rest, instr_annot)) + (Item_t (Mutez_t, rest, instr_annot)) | Prim (loc, I_MUL, [], instr_annot), - Item_t (Nat_t, Item_t (Tez_t, rest, _), _) -> + Item_t (Nat_t, Item_t (Mutez_t, rest, _), _) -> typed ctxt loc Mul_nattez - (Item_t (Tez_t, rest, instr_annot)) + (Item_t (Mutez_t, rest, instr_annot)) (* boolean operations *) | Prim (loc, I_OR, [], instr_annot), Item_t (Bool_t, Item_t (Bool_t, rest, _), _) -> @@ -1896,13 +1896,13 @@ and parse_instr typed ctxt loc Mul_natnat (Item_t (Nat_t, rest, instr_annot)) | Prim (loc, I_EDIV, [], instr_annot), - Item_t (Tez_t, Item_t (Nat_t, rest, _), _) -> + Item_t (Mutez_t, Item_t (Nat_t, rest, _), _) -> typed ctxt loc Ediv_teznat - (Item_t (Option_t (Pair_t ((Tez_t, None), (Tez_t, None))), rest, instr_annot)) + (Item_t (Option_t (Pair_t ((Mutez_t, None), (Mutez_t, None))), rest, instr_annot)) | Prim (loc, I_EDIV, [], instr_annot), - Item_t (Tez_t, Item_t (Tez_t, rest, _), _) -> + Item_t (Mutez_t, Item_t (Mutez_t, rest, _), _) -> typed ctxt loc Ediv_tez - (Item_t (Option_t (Pair_t ((Nat_t, None), (Tez_t, None))), rest, instr_annot)) + (Item_t (Option_t (Pair_t ((Nat_t, None), (Mutez_t, None))), rest, instr_annot)) | Prim (loc, I_EDIV, [], instr_annot), Item_t (Int_t, Item_t (Int_t, rest, _), _) -> typed ctxt loc Ediv_intint @@ -1969,8 +1969,8 @@ and parse_instr typed ctxt loc (Compare String_key) (Item_t (Int_t, rest, instr_annot)) | Prim (loc, I_COMPARE, [], instr_annot), - Item_t (Tez_t, Item_t (Tez_t, rest, _), _) -> - typed ctxt loc (Compare Tez_key) + Item_t (Mutez_t, Item_t (Mutez_t, rest, _), _) -> + typed ctxt loc (Compare Mutez_key) (Item_t (Int_t, rest, instr_annot)) | Prim (loc, I_COMPARE, [], instr_annot), Item_t (Key_hash_t, Item_t (Key_hash_t, rest, _), _) -> @@ -2030,7 +2030,7 @@ and parse_instr (Item_t (Option_t Key_hash_t, rest, instr_annot)) | Prim (loc, I_TRANSFER_TOKENS, [], instr_annot), Item_t (p, Item_t - (Tez_t, Item_t + (Mutez_t, Item_t (Contract_t cp, rest, _), _), _) -> check_item_ty p cp loc I_TRANSFER_TOKENS 1 4 >>=? fun Eq -> typed ctxt loc Transfer_tokens (Item_t (Operation_t, rest, instr_annot)) @@ -2042,7 +2042,7 @@ and parse_instr (Key_hash_t, Item_t (Option_t Key_hash_t, Item_t (Bool_t, Item_t - (Tez_t, rest, _), _), _), _) -> + (Mutez_t, rest, _), _), _), _) -> typed ctxt loc Create_account (Item_t (Operation_t, Item_t (Address_t, rest, None), instr_annot)) | Prim (loc, I_IMPLICIT_ACCOUNT, [], instr_annot), @@ -2055,7 +2055,7 @@ and parse_instr (Option_t Key_hash_t, Item_t (Bool_t, Item_t (Bool_t, Item_t - (Tez_t, Item_t + (Mutez_t, Item_t (ginit, rest, _), _), _), _), _), _) -> fail_unexpected_annot seq_loc annot >>=? fun () -> let cannonical_code = fst @@ Micheline.extract_locations code in @@ -2087,11 +2087,11 @@ and parse_instr | Prim (loc, I_AMOUNT, [], instr_annot), stack -> typed ctxt loc Amount - (Item_t (Tez_t, stack, instr_annot)) + (Item_t (Mutez_t, stack, instr_annot)) | Prim (loc, I_BALANCE, [], instr_annot), stack -> typed ctxt loc Balance - (Item_t (Tez_t, stack, instr_annot)) + (Item_t (Mutez_t, stack, instr_annot)) | Prim (loc, I_HASH_KEY, [], instr_annot), Item_t (Key_t, rest, _) -> typed ctxt loc Hash_key diff --git a/src/proto_alpha/lib_protocol/src/script_typed_ir.ml b/src/proto_alpha/lib_protocol/src/script_typed_ir.ml index 30306b3aa..14fa207a6 100644 --- a/src/proto_alpha/lib_protocol/src/script_typed_ir.ml +++ b/src/proto_alpha/lib_protocol/src/script_typed_ir.ml @@ -17,7 +17,7 @@ type 'ty comparable_ty = | Int_key : (z num) comparable_ty | Nat_key : (n num) comparable_ty | String_key : string comparable_ty - | Tez_key : Tez.t comparable_ty + | Mutez_key : Tez.t comparable_ty | Bool_key : bool comparable_ty | Key_hash_key : public_key_hash comparable_ty | Timestamp_key : Script_timestamp.t comparable_ty @@ -68,7 +68,7 @@ and 'ty ty = | Nat_t : n num ty | Signature_t : signature ty | String_t : string ty - | Tez_t : Tez.t ty + | Mutez_t : Tez.t ty | Key_hash_t : public_key_hash ty | Key_t : public_key ty | Timestamp_t : Script_timestamp.t ty diff --git a/src/proto_alpha/lib_protocol/test/contracts/accounts.tz b/src/proto_alpha/lib_protocol/test/contracts/accounts.tz index f6ca5350b..2496225d9 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/accounts.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/accounts.tz @@ -1,11 +1,11 @@ # This is a very simple accounts system. # (Left key) initializes or deposits into an account -# (Right key (pair tez (signed tez))) withdraws tez amount to a +# (Right key (pair mutez (signed mutez))) withdraws mutez amount to a # IMPLICIT_ACCOUNT created from the key if the balance is available # and the key is correctly signed -parameter (or key_hash (pair key (pair tez signature))); +parameter (or key_hash (pair key (pair mutez signature))); # Maps the key to the balance they have stored -storage (map key_hash tez); +storage (map key_hash mutez); code { DUP; CAR; # Deposit into account IF_LEFT { DUP; DIIP{ CDR; DUP }; @@ -30,8 +30,8 @@ code { DUP; CAR; IF { FAIL } { SUB; DIP{ DUP; DIP{ SWAP }}; DUP; # Delete account if balance is 0 - PUSH tez "0.00"; CMPEQ; - IF { DROP; NONE tez } + PUSH mutez 0; CMPEQ; + IF { DROP; NONE mutez } # Otherwise update storage with new balance { SOME }; SWAP; CAR; HASH_KEY; UPDATE; diff --git a/src/proto_alpha/lib_protocol/test/contracts/at_least.tz b/src/proto_alpha/lib_protocol/test/contracts/at_least.tz index 8fb126cbe..6c6d2968c 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/at_least.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/at_least.tz @@ -1,5 +1,5 @@ parameter unit; -storage tez; # How much you have to send me +storage mutez; # How much you have to send me code {CDR; DUP; # Get the amount required (once for comparison, once to save back in storage) AMOUNT; CMPLT; # Check to make sure no one is wasting my time IF {FAIL} # Reject the person diff --git a/src/proto_alpha/lib_protocol/test/contracts/auction.tz b/src/proto_alpha/lib_protocol/test/contracts/auction.tz index 48f477394..af8aedfb7 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/auction.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/auction.tz @@ -1,5 +1,5 @@ parameter key_hash; -storage (pair timestamp (pair tez key_hash)); +storage (pair timestamp (pair mutez key_hash)); code { DUP; CDAR; DUP; NOW; CMPGT; IF {FAIL} {}; SWAP; # Check if auction has ended DUP; CAR; DIP{CDDR}; AMOUNT; PAIR; SWAP; DIP{SWAP; PAIR}; # Setup replacement storage DUP; CAR; AMOUNT; CMPLE; IF {FAIL} {}; # Check to make sure that the new amount is greater diff --git a/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz b/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz index b2ebfc266..aeb3ec7fe 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz @@ -1,6 +1,6 @@ parameter unit; storage (pair timestamp (pair (contract unit) (contract unit))); code { CDR; DUP; CAR; NOW; CMPLT; IF {FAIL} {}; - DUP; CDAR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; SWAP; - DUP; CDDR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; DIP {SWAP} ; + DUP; CDAR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; SWAP; + DUP; CDDR; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; DIP {SWAP} ; NIL operation ; SWAP ; CONS ; SWAP ; CONS ; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/balance.tz b/src/proto_alpha/lib_protocol/test/contracts/balance.tz index 98568476e..0a9bfc614 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/balance.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/balance.tz @@ -1,3 +1,3 @@ parameter unit; -storage tez; +storage mutez; code {DROP; BALANCE; NIL operation; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/compare.tz b/src/proto_alpha/lib_protocol/test/contracts/compare.tz index f31561c51..698ef3e69 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/compare.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/compare.tz @@ -1,4 +1,4 @@ -parameter (pair tez tez); +parameter (pair mutez mutez); storage (list bool); code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/cps_fact.tz b/src/proto_alpha/lib_protocol/test/contracts/cps_fact.tz index d26e57715..445ceca44 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/cps_fact.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/cps_fact.tz @@ -11,6 +11,6 @@ code { UNPAIR ; IF_NONE { NIL operation ; PAIR } { DUP ; DIP { PUSH nat 1 ; ADD ; MUL @storage } ; SWAP; - DIP { DIP { SELF; PUSH tez "0" } ; + DIP { DIP { SELF; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; SWAP ; PAIR } } } \ No newline at end of file diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_account.tz b/src/proto_alpha/lib_protocol/test/contracts/create_account.tz index 38c894c8d..816b62257 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/create_account.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/create_account.tz @@ -2,9 +2,9 @@ parameter (or key_hash address) ; storage (option (contract unit)) ; code { CAR; IF_LEFT - { DIP { PUSH tez "100.00" ; PUSH bool False ; NONE key_hash }; + { DIP { PUSH mutez 100000000 ; PUSH bool False ; NONE key_hash }; CREATE_ACCOUNT ; - DIP { RIGHT key_hash ; DIP { SELF ; PUSH tez "0" } ; TRANSFER_TOKENS ; + DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; CONS ; NONE (contract unit) ; SWAP ; PAIR } { SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ; diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz b/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz index d9aa97348..c6664c2f2 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz @@ -3,16 +3,16 @@ storage unit; code { CAR; IF_LEFT { DIP { PUSH string "dummy"; - PUSH tez "100.00" ; PUSH bool False ; + PUSH mutez 100000000 ; PUSH bool False ; PUSH bool False ; NONE key_hash } ; CREATE_CONTRACT { parameter string ; storage string ; code { CAR ; NIL operation ; PAIR } } ; - DIP { RIGHT key_hash ; DIP { SELF ; PUSH tez "0" } ; TRANSFER_TOKENS ; + DIP { RIGHT key_hash ; DIP { SELF ; PUSH mutez 0 } ; TRANSFER_TOKENS ; NIL operation ; SWAP ; CONS } ; CONS ; UNIT ; SWAP ; PAIR } { SELF ; ADDRESS ; SOURCE ; IFCMPNEQ { FAIL } {} ; CONTRACT string ; IF_SOME {} { FAIL } ; - PUSH tez "0.00" ; PUSH string "abcdefg" ; TRANSFER_TOKENS ; + PUSH mutez 0 ; PUSH string "abcdefg" ; TRANSFER_TOKENS ; NIL operation; SWAP; CONS ; UNIT ; SWAP ; PAIR } }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/default_account.tz b/src/proto_alpha/lib_protocol/test/contracts/default_account.tz index 3a48fc1d9..db9f01156 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/default_account.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/default_account.tz @@ -1,5 +1,5 @@ parameter key_hash; storage unit; code {DIP{UNIT}; CAR; IMPLICIT_ACCOUNT; - PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; + PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz b/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz index f4239b19e..95b71c4f0 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz @@ -2,5 +2,5 @@ parameter unit; storage unit; code { DROP; - AMOUNT; PUSH tez "10"; CMPGT; IF {FAIL} {}; + AMOUNT; PUSH mutez 10000000; CMPGT; IF {FAIL} {}; UNIT; NIL operation; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz b/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz index 5d3c611ca..40db8e0d5 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz @@ -1,3 +1,3 @@ -parameter (pair tez (pair timestamp int)) ; +parameter (pair mutez (pair timestamp int)) ; storage string ; code { CAR ; H ; NIL operation ; PAIR } \ No newline at end of file diff --git a/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz b/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz index 4b2a3e16a..01820468a 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz @@ -2,7 +2,7 @@ parameter (option (pair signature int)); storage (pair key int); code {DUP; DUP; CAR; - IF_NONE {PUSH tez "1.00"; # Fee pattern from July 26 + IF_NONE {PUSH mutez 1000000; # Fee pattern from July 26 AMOUNT; CMPLE; IF {FAIL} {}; # Provide the data CDR; DIP {CDDR}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz b/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz index 796325f30..033ead7f1 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz @@ -1,9 +1,9 @@ parameter key_hash; -storage (pair timestamp (pair tez key_hash)); +storage (pair timestamp (pair mutez key_hash)); code { DUP; CDAR; # If the time is more than 2 weeks, any amount makes you king NOW; CMPGT; - # User becomes king of tez + # User becomes king of mutez IF { CAR; AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR; NIL operation } # Check balance to see if user has paid enough to become the new king diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz b/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz index 039ff7596..412112aad 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz @@ -2,7 +2,7 @@ parameter unit; storage (list (contract unit)); code { CDR; DUP; DIP {NIL operation}; PUSH bool True; # Setup loop - LOOP {IF_CONS { PUSH tez "1.00"; UNIT; TRANSFER_TOKENS; # Make transfer + LOOP {IF_CONS { PUSH mutez 1000000; UNIT; TRANSFER_TOKENS; # Make transfer SWAP; DIP {CONS}; PUSH bool True} # Setup for next round of loop { NIL (contract unit); PUSH bool False}}; # Data to satisfy types and end loop DROP; PAIR}; # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/lockup.tz b/src/proto_alpha/lib_protocol/test/contracts/lockup.tz index 5fffa36ec..a68a8628f 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/lockup.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/lockup.tz @@ -1,5 +1,5 @@ parameter unit; -storage (pair timestamp (pair tez (contract unit))); +storage (pair timestamp (pair mutez (contract unit))); code { CDR; # Ignore the parameter DUP; # Duplicate the storage CAR; # Get the timestamp diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz b/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz index b0b436795..4b6dccce9 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz @@ -1,4 +1,4 @@ parameter unit; -storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); -code { MAP_CDADDAADR { PUSH tez "1.00" ; ADD } ; +storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat); +code { MAP_CDADDAADR { PUSH mutez 1000000 ; ADD } ; NIL operation ; SWAP; SET_CAR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/originator.tz b/src/proto_alpha/lib_protocol/test/contracts/originator.tz index f7a87fa53..c454e230d 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/originator.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/originator.tz @@ -4,7 +4,7 @@ code { DUP ; CAR ; PUSH nat 0 ; CMPNEQ ; DIP { DUP ; CAR ; DIP { CDR ; NIL operation } } ; LOOP - { PUSH tez "5.00" ; + { PUSH mutez 5000000 ; PUSH bool True ; # delegatable NONE key_hash ; # delegate PUSH key_hash "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager diff --git a/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz b/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz index 5d9ec49c1..2e5d92060 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz @@ -1,7 +1,7 @@ parameter unit; storage (pair (contract unit) (contract unit)); -code { CDR; DUP; CAR; PUSH tez "5.00"; UNIT; +code { CDR; DUP; CAR; PUSH mutez 5000000; UNIT; TRANSFER_TOKENS; DIP {DUP; CDR; - PUSH tez "5.00"; UNIT; TRANSFER_TOKENS}; + PUSH mutez 5000000; UNIT; TRANSFER_TOKENS}; DIIP{NIL operation};DIP{CONS};CONS;PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz b/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz index 39878a962..db967edb2 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz @@ -1,5 +1,5 @@ -parameter tez; -storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); +parameter mutez; +storage (pair (pair nat (pair nat (pair (pair (pair nat mutez) nat) nat))) nat); code { DUP ; CAR ; SWAP ; CDR ; SET_CADDAADR @annot ; NIL operation ; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz b/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz index 717c7c374..91b062aff 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz @@ -8,7 +8,7 @@ code { DUP; IF { PUSH bool False} # End the loop { PUSH nat 1; SWAP; SUB; ABS; # Subtract 1. The ABS is to make it back into a nat PUSH string "init"; # Storage type - PUSH tez "5.00"; # Strating balance + PUSH mutez 5000000; # Strating balance PUSH bool False; DUP; # Not spendable or delegatable NONE key_hash; PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5"; diff --git a/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz b/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz index 86cd1624b..bb502d041 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz @@ -2,7 +2,7 @@ parameter key_hash; storage unit; code { CAR; IMPLICIT_ACCOUNT; # Create an account for the recipient of the funds DIP{UNIT}; # Push a value of the storage type below the contract - PUSH tez "1.00"; # The person can have a ꜩ + PUSH mutez 1000000; # The person can have a ꜩ UNIT; # Push the contract's argument type TRANSFER_TOKENS; # Run the transfer NIL operation; SWAP; CONS; diff --git a/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz b/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz index ad8bae659..39eba1d16 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz @@ -1,5 +1,5 @@ -parameter (pair tez tez); -storage (option (pair tez tez)); +parameter (pair mutez mutez); +storage (option (pair mutez mutez)); code {CAR; DUP; DUP; CAR; DIP{CDR}; ADD; DIP{DUP; CAR; DIP{CDR}; SUB}; PAIR; SOME; NIL operation; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz b/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz index 8da204e83..973c64f04 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz @@ -1,3 +1,3 @@ parameter unit; -storage tez; +storage mutez; code { DROP; AMOUNT; NIL operation; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz b/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz index bb8445bfe..599b4dae1 100644 --- a/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz +++ b/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz @@ -1,5 +1,5 @@ parameter (contract unit); storage unit; -code { CAR; DIP{UNIT}; PUSH tez "100.00"; UNIT; +code { CAR; DIP{UNIT}; PUSH mutez 100000000; UNIT; TRANSFER_TOKENS; NIL operation; SWAP; CONS; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/test_michelson.ml b/src/proto_alpha/lib_protocol/test/test_michelson.ml index bfec2e4d0..0fc6c846e 100644 --- a/src/proto_alpha/lib_protocol/test/test_michelson.ml +++ b/src/proto_alpha/lib_protocol/test/test_michelson.ml @@ -313,18 +313,18 @@ let test_example () = let bootstrap_0 = List.nth Account.bootstrap_accounts 0 in get_balance_res bootstrap_0 sb >>=?? fun _balance -> - let amount = Proto_alpha.Alpha_context.Tez.to_string @@ Cast.cents_of_int Script.init_amount in + let amount = string_of_int (Script.init_amount * 10000) in (* Get the current balance of the contract *) - test_output ~location: __LOC__ "balance" "\"111\"" "Unit" ("\"" ^ amount ^ "\"") >>=? fun _ -> + test_output ~location: __LOC__ "balance" "111000000" "Unit" amount >>=? fun _ -> (* Test comparisons on tez { EQ ; GT ; LT ; GE ; LE } *) - test_output ~location: __LOC__ "compare" "{}" "(Pair \"1.00\" \"2.00\")" "{ False ; False ; True ; False ; True }" >>=? fun _ -> - test_output ~location: __LOC__ "compare" "{}" "(Pair \"2.00\" \"1.00\")" "{ False ; True ; False ; True ; False }" >>=? fun _ -> - test_output ~location: __LOC__ "compare" "{}" "(Pair \"2.37\" \"2.37\")" "{ True ; False ; False ; True ; True }" >>=? fun _ -> + test_output ~location: __LOC__ "compare" "{}" "(Pair 1000000 2000000)" "{ False ; False ; True ; False ; True }" >>=? fun _ -> + test_output ~location: __LOC__ "compare" "{}" "(Pair 2000000 1000000)" "{ False ; True ; False ; True ; False }" >>=? fun _ -> + test_output ~location: __LOC__ "compare" "{}" "(Pair 2370000 2370000)" "{ True ; False ; False ; True ; True }" >>=? fun _ -> (* Test addition and subtraction on tez *) - test_output ~location: __LOC__ "tez_add_sub" "None" "(Pair \"2\" \"1\")" "(Some (Pair \"3\" \"1\"))" >>=? fun _ -> - test_output ~location: __LOC__ "tez_add_sub" "None" "(Pair \"2.31\" \"1.01\")" "(Some (Pair \"3.32\" \"1.3\"))" >>=? fun _ -> + test_output ~location: __LOC__ "tez_add_sub" "None" "(Pair 2000000 1000000)" "(Some (Pair 3000000 1000000))" >>=? fun _ -> + test_output ~location: __LOC__ "tez_add_sub" "None" "(Pair 2310000 1010000)" "(Some (Pair 3320000 1300000))" >>=? fun _ -> (* Test get first element of list *) test_output ~location: __LOC__ "first" "111" "{ 1 ; 2 ; 3 ; 4 }" "1" >>=? fun _ -> @@ -404,9 +404,9 @@ let test_example () = test_output ~location: __LOC__ "set_cdr" "(Pair \"hello\" 500)" "3" "(Pair \"hello\" 3)" >>=? fun _ -> test_output ~location: __LOC__ "set_cdr" "(Pair \"hello\" 7)" "100" "(Pair \"hello\" 100)" >>=? fun _ -> - test_storage ~location: __LOC__ "set_caddaadr" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 \"0\") 4) 5))) 6)" "\"3\"" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 \"3\") 4) 5))) 6)" >>=? fun _ -> + test_storage ~location: __LOC__ "set_caddaadr" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 0) 4) 5))) 6)" "3000000" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 3000000) 4) 5))) 6)" >>=? fun _ -> - test_storage ~location: __LOC__ "map_caddaadr" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 \"0\") 4) 5))) 6)" "Unit" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 \"1\") 4) 5))) 6)" >>=? fun _ -> + test_storage ~location: __LOC__ "map_caddaadr" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 0) 4) 5))) 6)" "Unit" "(Pair (Pair 1 (Pair 2 (Pair (Pair (Pair 3 1000000) 4) 5))) 6)" >>=? fun _ -> (* Did the given key sign the string? (key is bootstrap1) *) test_success ~location: __LOC__ "check_signature" "(Pair \"1f19f8f37e80d96797b019f30d23ede6a26a0f698220f942103a3401f047623746e51a9c6e77e269b5df9593994ab96b001aae0f73728a2259187cb640b61e01\" \"hello\")" "\"edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav\"" >>=? fun _ ->