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 (