From 23353b0e274545aaf8c49521678496ae5859f40a Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 21 Jan 2020 02:23:56 -0600 Subject: [PATCH 1/2] Clarify internal sender/source options --- src/main/run/of_michelson.ml | 2 +- src/test/coase_tests.ml | 8 ++-- src/test/hash_lock_tests.ml | 12 +++--- src/test/id_tests.ml | 24 +++++------ src/test/multisig_v2_tests.ml | 40 +++++++++---------- src/test/replaceable_id_tests.ml | 16 ++++---- .../proto-alpha-utils/x_memory_proto_alpha.ml | 9 +++-- 7 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/main/run/of_michelson.ml b/src/main/run/of_michelson.ml index 4a9b7e1c3..6e8733e0e 100644 --- a/src/main/run/of_michelson.ml +++ b/src/main/run/of_michelson.ml @@ -75,7 +75,7 @@ let make_dry_run_options (opts : dry_run_options) : options result = match Memory_proto_alpha.Protocol.Alpha_context.Timestamp.of_notation st with | Some t -> ok (Some t) | None -> simple_fail ("\""^st^"\" is a bad timestamp notation") in - ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?source:sender ?payer:source () + ok @@ make_options ?predecessor_timestamp:predecessor_timestamp ~amount ?sender ?source () let ex_value_ty_to_michelson (v : ex_typed_value) : Michelson.t result = let (Ex_typed_value (value , ty)) = v in diff --git a/src/test/coase_tests.ml b/src/test/coase_tests.ml index 57e55b495..f335ec45b 100644 --- a/src/test/coase_tests.ml +++ b/src/test/coase_tests.ml @@ -204,8 +204,8 @@ let transfer () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let payer = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in + let source = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in ok () in @@ -234,8 +234,8 @@ let sell () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let payer = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () in + let source = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in ok () in diff --git a/src/test/hash_lock_tests.ml b/src/test/hash_lock_tests.ml index bff1e8219..7bfe77c88 100644 --- a/src/test/hash_lock_tests.ml +++ b/src/test/hash_lock_tests.ml @@ -78,7 +78,7 @@ let commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_eq ~options program "commit" @@ -127,7 +127,7 @@ let reveal_young_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -159,7 +159,7 @@ let reveal_breaks_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -191,7 +191,7 @@ let reveal_wrong_commit () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -223,7 +223,7 @@ let reveal_no_reuse () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_string_failwith ~options program "reveal" @@ -256,7 +256,7 @@ let reveal () = let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~predecessor_timestamp - ~payer:first_contract + ~sender:first_contract () in expect_eq ~options program "reveal" diff --git a/src/test/id_tests.ml b/src/test/id_tests.ml index dfe5be581..db8b78960 100644 --- a/src/test/id_tests.ml +++ b/src/test/id_tests.ml @@ -48,7 +48,7 @@ let buy_id () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -81,7 +81,7 @@ let buy_id_sender_addr () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -115,7 +115,7 @@ let buy_id_wrong_amount () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) () in let param = e_pair owner_website (e_some (e_address new_addr)) in @@ -134,7 +134,7 @@ let update_details_owner () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -175,7 +175,7 @@ let update_details_controller () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -217,7 +217,7 @@ let update_details_nonexistent () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -284,7 +284,7 @@ let update_details_unchanged () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -316,7 +316,7 @@ let update_owner () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -355,7 +355,7 @@ let update_owner_nonexistent () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -386,7 +386,7 @@ let update_owner_wrong_addr () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero) () in @@ -416,7 +416,7 @@ let skip () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) () in let new_website = e_bytes_string "ligolang.org" in @@ -450,7 +450,7 @@ let skip_wrong_amount () = in let new_addr = first_owner in let options = Proto_alpha_utils.Memory_proto_alpha.make_options - ~payer:first_contract + ~sender:first_contract ~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) () in let new_website = e_bytes_string "ligolang.org" in diff --git a/src/test/multisig_v2_tests.ml b/src/test/multisig_v2_tests.ml index e21736586..0ed619c1d 100644 --- a/src/test/multisig_v2_tests.ml +++ b/src/test/multisig_v2_tests.ml @@ -73,8 +73,8 @@ let wrong_addr () = id_counter_list = [1,0 ; 2,0] ; msg_store_list = [] } in - let source = contract 3 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Unauthorized address" in expect_string_failwith ~options program "main" @@ -89,8 +89,8 @@ let message_size_exceeded () = id_counter_list = [1,0] ; msg_store_list = [] } in - let source = contract 1 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Message size exceed maximum limit" in expect_string_failwith ~options program "main" @@ -107,8 +107,8 @@ let maximum_number_of_proposal () = id_counter_list = [1,1] ; msg_store_list = [(bytes1, e_set [e_address@@ addr 1])] } in - let source = contract 1 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = let exp_failwith = "Maximum number of proposal reached" in expect_string_failwith ~options program "main" @@ -126,8 +126,8 @@ let send_already_accounted () = msg_store_list = [(bytes, e_set [e_address@@ addr 1])] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair (send_param empty_message) init_storage) (e_pair empty_op_list init_storage) @@ -147,8 +147,8 @@ let send_never_accounted () = msg_store_list = [(bytes, e_set [e_address@@ addr 1])] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair (send_param empty_message) init_storage) (e_pair empty_op_list final_storage) @@ -168,8 +168,8 @@ let withdraw_already_accounted_one () = id_counter_list = [1,0 ; 2,0] ; msg_store_list = [] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -189,8 +189,8 @@ let withdraw_already_accounted_two () = id_counter_list = [1,0 ; 2,1] ; msg_store_list = [(bytes, e_set [e_address@@ addr 2])] } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -212,8 +212,8 @@ let counters_reset () = id_counter_list = [1,0 ; 2,0 ; 3,0] ; msg_store_list = [] } in let options = - let source = contract 3 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list final_storage) @@ -227,8 +227,8 @@ let withdraw_never_accounted () = msg_store_list = [] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list init_storage) @@ -243,8 +243,8 @@ let succeeded_storing () = msg_store_list = [(bytes, e_typed_set [] t_address)] ; } in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let%bind () = expect_eq_n_trace_aux ~options [1;2] program "main" (fun th -> let init_storage = storage (init_storage th) in diff --git a/src/test/replaceable_id_tests.ml b/src/test/replaceable_id_tests.ml index 6bf09e95a..54d7d1a64 100644 --- a/src/test/replaceable_id_tests.ml +++ b/src/test/replaceable_id_tests.ml @@ -44,8 +44,8 @@ let change_addr_success () = let init_storage = storage 1 in let param = entry_change_addr 2 in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list (storage 2)) @@ -54,8 +54,8 @@ let change_addr_fail () = let init_storage = storage 1 in let param = entry_change_addr 2 in let options = - let source = contract 3 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 3 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let exp_failwith = "Unauthorized sender" in expect_string_failwith ~options program "main" (e_pair param init_storage) exp_failwith @@ -65,8 +65,8 @@ let pass_message_success () = let init_storage = storage 1 in let param = entry_pass_message in let options = - let source = contract 1 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 1 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in expect_eq ~options program "main" (e_pair param init_storage) (e_pair empty_op_list init_storage) @@ -75,8 +75,8 @@ let pass_message_fail () = let init_storage = storage 1 in let param = entry_pass_message in let options = - let source = contract 2 in - Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in + let sender = contract 2 in + Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in let exp_failwith = "Unauthorized sender" in expect_string_failwith ~options program "main" (e_pair param init_storage) exp_failwith diff --git a/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml b/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml index c613c86a4..a8f5aa468 100644 --- a/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml +++ b/vendors/ligo-utils/proto-alpha-utils/x_memory_proto_alpha.ml @@ -1067,9 +1067,9 @@ type options = { let make_options ?(tezos_context = dummy_environment.tezos_context) ?(predecessor_timestamp = dummy_environment.tezos_context.predecessor_timestamp) - ?(source = (List.nth dummy_environment.identities 0).implicit_contract) + ?(sender = (List.nth dummy_environment.identities 0).implicit_contract) ?(self = (List.nth dummy_environment.identities 0).implicit_contract) - ?(payer = (List.nth dummy_environment.identities 1).implicit_contract) + ?(source = (List.nth dummy_environment.identities 1).implicit_contract) ?(amount = Alpha_context.Tez.one) ?(chain_id = Environment.Chain_id.zero) () @@ -1077,9 +1077,10 @@ let make_options let tezos_context = { tezos_context with predecessor_timestamp } in { tezos_context ; - source ; + (* yep *) + source = sender ; + payer = source ; self ; - payer ; amount ; chain_id ; } From 4b9e175063de95fcb6c6c42be58420224413f471 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Tue, 21 Jan 2020 02:24:16 -0600 Subject: [PATCH 2/2] Examples: don't use SOURCE --- src/bin/expect_tests/contract_tests.ml | 10 +++++----- src/test/coase_tests.ml | 20 ++++++++++---------- src/test/contracts/coase.ligo | 8 ++++---- src/test/contracts/get_contract.ligo | 4 ++-- src/test/contracts/vote.mligo | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index c1ec32c6e..bacbfc8e2 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -125,7 +125,7 @@ let%expect_test _ = CDR ; DIP { DIP 7 { DUP } ; DIG 7 ; - SOURCE ; + SENDER ; PAIR ; SOME ; DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ; @@ -162,7 +162,7 @@ let%expect_test _ = IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; - SOURCE ; + SENDER ; SWAP ; COMPARE ; NEQ ; @@ -207,7 +207,7 @@ let%expect_test _ = CAR ; DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ; MUL ; - SOURCE ; + SENDER ; CONTRACT unit ; IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ; DIP { DUP } ; @@ -249,7 +249,7 @@ let%expect_test _ = IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ; DUP ; CAR ; - SOURCE ; + SENDER ; SWAP ; COMPARE ; NEQ ; @@ -1008,7 +1008,7 @@ let%expect_test _ = DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CDR ; CDR } ; PAIR } ; PAIR ; - DIP { DIP { DUP } ; SWAP ; CDR ; CDR ; PUSH bool True ; SOURCE ; UPDATE } ; + DIP { DIP { DUP } ; SWAP ; CDR ; CDR ; PUSH bool True ; SENDER ; UPDATE } ; PAIR ; NIL operation ; PAIR ; diff --git a/src/test/coase_tests.ml b/src/test/coase_tests.ml index f335ec45b..be36603c7 100644 --- a/src/test/coase_tests.ml +++ b/src/test/coase_tests.ml @@ -90,11 +90,11 @@ let (first_owner , first_contract) = let kt = id.implicit_contract in Protocol.Alpha_context.Contract.to_b58check kt , kt -let second_owner = +let (second_owner , second_contract) = let open Proto_alpha_utils.Memory_proto_alpha in let id = List.nth dummy_environment.identities 1 in let kt = id.implicit_contract in - Protocol.Alpha_context.Contract.to_b58check kt + Protocol.Alpha_context.Contract.to_b58check kt , kt let basic a b cards next_id = let card_patterns = List.map card_pattern_ez [ @@ -127,13 +127,13 @@ let buy () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in let%bind () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in trace_strong (simple_error "could buy without money") @@ Assert.assert_fail @@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in @@ -166,13 +166,13 @@ let dispatch_buy () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in expect_eq_n_pos_small ~options program "main" make_input make_expected in let%bind () = let%bind amount = trace_option (simple_error "getting amount for run") @@ Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount () in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender:second_contract () in trace_strong (simple_error "could buy without money") @@ Assert.assert_fail @@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in @@ -204,8 +204,8 @@ let transfer () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let source = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in + let sender = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender () in expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in ok () in @@ -234,8 +234,8 @@ let sell () = in let%bind () = let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in - let source = first_contract in - let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~source () in + let sender = first_contract in + let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~sender () in expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in ok () in diff --git a/src/test/contracts/coase.ligo b/src/test/contracts/coase.ligo index fd870b7a8..5f5b00644 100644 --- a/src/test/contracts/coase.ligo +++ b/src/test/contracts/coase.ligo @@ -48,7 +48,7 @@ function transfer_single (const action : action_transfer_single; const s : storage) : return is block { const cards : cards = s.cards; const card : card = get_force (action.card_to_transfer, cards); - if card.card_owner =/= source then + if card.card_owner =/= sender then failwith ("This card doesn't belong to you") else skip; card.card_owner := action.destination; @@ -61,7 +61,7 @@ function sell_single (const action : action_sell_single; const s : storage) : return is block { const card : card = get_force (action.card_to_sell, s.cards); - if card.card_owner =/= source + if card.card_owner =/= sender then failwith ("This card doesn't belong to you") else skip; const card_pattern : card_pattern = @@ -74,7 +74,7 @@ function sell_single (const action : action_sell_single; remove action.card_to_sell from map cards; s.cards := cards; const price : tez = card_pattern.coefficient * card_pattern.quantity; - const receiver : contract (unit) = get_contract (source); + const receiver : contract (unit) = get_contract (sender); const op : operation = transaction (unit, price, receiver); const operations : list (operation) = list [op] } with (operations, s) @@ -98,7 +98,7 @@ function buy_single (const action : action_buy_single; // Add card const cards : cards = s.cards; cards[s.next_id] := record [ - card_owner = source; + card_owner = sender; card_pattern = action.card_to_buy ]; s.cards := cards; diff --git a/src/test/contracts/get_contract.ligo b/src/test/contracts/get_contract.ligo index cb203c840..8ace2277d 100644 --- a/src/test/contracts/get_contract.ligo +++ b/src/test/contracts/get_contract.ligo @@ -3,7 +3,7 @@ type return is list (operation) * storage function cb (const s : storage) : return is block { - const c : contract (unit) = get_contract (source) + const c : contract(unit) = get_contract(sender) } with (list [transaction(unit, 0mutez, c)], s) @@ -11,7 +11,7 @@ function cb (const s : storage) : return is function cbo (const s : unit) : return is block { const c : contract (unit) = - case (get_contract_opt (source) : option (contract (unit))) of + case (get_contract_opt(sender) : option(contract(unit))) of Some (c) -> c | None -> (failwith ("contract not found") : contract (unit)) end diff --git a/src/test/contracts/vote.mligo b/src/test/contracts/vote.mligo index 414b72300..a32f54fa4 100644 --- a/src/test/contracts/vote.mligo +++ b/src/test/contracts/vote.mligo @@ -35,7 +35,7 @@ let init (init_params_s : init_action * storage) = let vote (ps : string * storage) = let now = Current.time in (* let _ = assert (now >= ps.1.beginning_time && ps.1.finish_time > now) in *) - let addr = Current.source in + let addr = Current.sender in (* let _ = assert (not Set.mem addr ps.1.voters) in *) let x = Map.find ps.0 ps.1.candidates in (