Merge branch 'feature/dont-use-source' into 'dev'
Examples: don't use SOURCE See merge request ligolang/ligo!444
This commit is contained in:
commit
f405f03740
@ -125,7 +125,7 @@ let%expect_test _ =
|
|||||||
CDR ;
|
CDR ;
|
||||||
DIP { DIP 7 { DUP } ;
|
DIP { DIP 7 { DUP } ;
|
||||||
DIG 7 ;
|
DIG 7 ;
|
||||||
SOURCE ;
|
SENDER ;
|
||||||
PAIR ;
|
PAIR ;
|
||||||
SOME ;
|
SOME ;
|
||||||
DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ;
|
DIP { DIP { DUP } ; SWAP ; CAR ; CDR } } ;
|
||||||
@ -162,7 +162,7 @@ let%expect_test _ =
|
|||||||
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
|
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
|
||||||
DUP ;
|
DUP ;
|
||||||
CAR ;
|
CAR ;
|
||||||
SOURCE ;
|
SENDER ;
|
||||||
SWAP ;
|
SWAP ;
|
||||||
COMPARE ;
|
COMPARE ;
|
||||||
NEQ ;
|
NEQ ;
|
||||||
@ -207,7 +207,7 @@ let%expect_test _ =
|
|||||||
CAR ;
|
CAR ;
|
||||||
DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ;
|
DIP { DIP 2 { DUP } ; DIG 2 ; CDR } ;
|
||||||
MUL ;
|
MUL ;
|
||||||
SOURCE ;
|
SENDER ;
|
||||||
CONTRACT unit ;
|
CONTRACT unit ;
|
||||||
IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ;
|
IF_NONE { PUSH string "bad address for get_contract" ; FAILWITH } {} ;
|
||||||
DIP { DUP } ;
|
DIP { DUP } ;
|
||||||
@ -249,7 +249,7 @@ let%expect_test _ =
|
|||||||
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
|
IF_NONE { PUSH string "MAP FIND" ; FAILWITH } {} ;
|
||||||
DUP ;
|
DUP ;
|
||||||
CAR ;
|
CAR ;
|
||||||
SOURCE ;
|
SENDER ;
|
||||||
SWAP ;
|
SWAP ;
|
||||||
COMPARE ;
|
COMPARE ;
|
||||||
NEQ ;
|
NEQ ;
|
||||||
@ -1008,7 +1008,7 @@ let%expect_test _ =
|
|||||||
DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CDR ; CDR } ;
|
DIP { DIP { DUP } ; SWAP ; CDR ; CAR ; CDR ; CDR } ;
|
||||||
PAIR } ;
|
PAIR } ;
|
||||||
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 ;
|
PAIR ;
|
||||||
NIL operation ;
|
NIL operation ;
|
||||||
PAIR ;
|
PAIR ;
|
||||||
|
@ -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
|
match Memory_proto_alpha.Protocol.Alpha_context.Timestamp.of_notation st with
|
||||||
| Some t -> ok (Some t)
|
| Some t -> ok (Some t)
|
||||||
| None -> simple_fail ("\""^st^"\" is a bad timestamp notation") in
|
| 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_value_ty_to_michelson (v : ex_typed_value) : Michelson.t result =
|
||||||
let (Ex_typed_value (value , ty)) = v in
|
let (Ex_typed_value (value , ty)) = v in
|
||||||
|
@ -90,11 +90,11 @@ let (first_owner , first_contract) =
|
|||||||
let kt = id.implicit_contract in
|
let kt = id.implicit_contract in
|
||||||
Protocol.Alpha_context.Contract.to_b58check kt , kt
|
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 open Proto_alpha_utils.Memory_proto_alpha in
|
||||||
let id = List.nth dummy_environment.identities 1 in
|
let id = List.nth dummy_environment.identities 1 in
|
||||||
let kt = id.implicit_contract 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 basic a b cards next_id =
|
||||||
let card_patterns = List.map card_pattern_ez [
|
let card_patterns = List.map card_pattern_ez [
|
||||||
@ -127,13 +127,13 @@ let buy () =
|
|||||||
let%bind amount =
|
let%bind amount =
|
||||||
trace_option (simple_error "getting amount for run") @@
|
trace_option (simple_error "getting amount for run") @@
|
||||||
Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in
|
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
|
expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let%bind amount =
|
let%bind amount =
|
||||||
trace_option (simple_error "getting amount for run") @@
|
trace_option (simple_error "getting amount for run") @@
|
||||||
Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in
|
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") @@
|
trace_strong (simple_error "could buy without money") @@
|
||||||
Assert.assert_fail
|
Assert.assert_fail
|
||||||
@@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in
|
@@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in
|
||||||
@ -166,13 +166,13 @@ let dispatch_buy () =
|
|||||||
let%bind amount =
|
let%bind amount =
|
||||||
trace_option (simple_error "getting amount for run") @@
|
trace_option (simple_error "getting amount for run") @@
|
||||||
Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 10000000000 in
|
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
|
expect_eq_n_pos_small ~options program "main" make_input make_expected in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let%bind amount =
|
let%bind amount =
|
||||||
trace_option (simple_error "getting amount for run") @@
|
trace_option (simple_error "getting amount for run") @@
|
||||||
Memory_proto_alpha.Protocol.Alpha_context.Tez.of_mutez @@ Int64.of_int 0 in
|
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") @@
|
trace_strong (simple_error "could buy without money") @@
|
||||||
Assert.assert_fail
|
Assert.assert_fail
|
||||||
@@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in
|
@@ expect_eq_n_pos_small ~options program "buy_single" make_input make_expected in
|
||||||
@ -204,8 +204,8 @@ let transfer () =
|
|||||||
in
|
in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
||||||
let payer = first_contract in
|
let sender = first_contract in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () 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
|
expect_eq_n_strict_pos_small ~options program "transfer_single" make_input make_expected in
|
||||||
ok ()
|
ok ()
|
||||||
in
|
in
|
||||||
@ -234,8 +234,8 @@ let sell () =
|
|||||||
in
|
in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
let amount = Memory_proto_alpha.Protocol.Alpha_context.Tez.zero in
|
||||||
let payer = first_contract in
|
let sender = first_contract in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~amount ~payer () 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
|
expect_n_strict_pos_small ~options program "sell_single" make_input make_expecter in
|
||||||
ok ()
|
ok ()
|
||||||
in
|
in
|
||||||
|
@ -48,7 +48,7 @@ function transfer_single (const action : action_transfer_single;
|
|||||||
const s : storage) : return is block {
|
const s : storage) : return is block {
|
||||||
const cards : cards = s.cards;
|
const cards : cards = s.cards;
|
||||||
const card : card = get_force (action.card_to_transfer, 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")
|
failwith ("This card doesn't belong to you")
|
||||||
else skip;
|
else skip;
|
||||||
card.card_owner := action.destination;
|
card.card_owner := action.destination;
|
||||||
@ -61,7 +61,7 @@ function sell_single (const action : action_sell_single;
|
|||||||
const s : storage) : return is
|
const s : storage) : return is
|
||||||
block {
|
block {
|
||||||
const card : card = get_force (action.card_to_sell, s.cards);
|
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")
|
then failwith ("This card doesn't belong to you")
|
||||||
else skip;
|
else skip;
|
||||||
const card_pattern : card_pattern =
|
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;
|
remove action.card_to_sell from map cards;
|
||||||
s.cards := cards;
|
s.cards := cards;
|
||||||
const price : tez = card_pattern.coefficient * card_pattern.quantity;
|
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 op : operation = transaction (unit, price, receiver);
|
||||||
const operations : list (operation) = list [op]
|
const operations : list (operation) = list [op]
|
||||||
} with (operations, s)
|
} with (operations, s)
|
||||||
@ -98,7 +98,7 @@ function buy_single (const action : action_buy_single;
|
|||||||
// Add card
|
// Add card
|
||||||
const cards : cards = s.cards;
|
const cards : cards = s.cards;
|
||||||
cards[s.next_id] := record [
|
cards[s.next_id] := record [
|
||||||
card_owner = source;
|
card_owner = sender;
|
||||||
card_pattern = action.card_to_buy
|
card_pattern = action.card_to_buy
|
||||||
];
|
];
|
||||||
s.cards := cards;
|
s.cards := cards;
|
||||||
|
@ -3,7 +3,7 @@ type return is list (operation) * storage
|
|||||||
|
|
||||||
function cb (const s : storage) : return is
|
function cb (const s : storage) : return is
|
||||||
block {
|
block {
|
||||||
const c : contract (unit) = get_contract (source)
|
const c : contract(unit) = get_contract(sender)
|
||||||
}
|
}
|
||||||
with (list [transaction(unit, 0mutez, c)], s)
|
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
|
function cbo (const s : unit) : return is
|
||||||
block {
|
block {
|
||||||
const c : contract (unit) =
|
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
|
Some (c) -> c
|
||||||
| None -> (failwith ("contract not found") : contract (unit))
|
| None -> (failwith ("contract not found") : contract (unit))
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ let init (init_params_s : init_action * storage) =
|
|||||||
let vote (ps : string * storage) =
|
let vote (ps : string * storage) =
|
||||||
let now = Current.time in
|
let now = Current.time in
|
||||||
(* let _ = assert (now >= ps.1.beginning_time && ps.1.finish_time > now) 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 _ = assert (not Set.mem addr ps.1.voters) in *)
|
||||||
let x = Map.find ps.0 ps.1.candidates in
|
let x = Map.find ps.0 ps.1.candidates in
|
||||||
(
|
(
|
||||||
|
@ -78,7 +78,7 @@ let commit () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_eq ~options program "commit"
|
expect_eq ~options program "commit"
|
||||||
@ -127,7 +127,7 @@ let reveal_young_commit () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_string_failwith ~options program "reveal"
|
expect_string_failwith ~options program "reveal"
|
||||||
@ -159,7 +159,7 @@ let reveal_breaks_commit () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_string_failwith ~options program "reveal"
|
expect_string_failwith ~options program "reveal"
|
||||||
@ -191,7 +191,7 @@ let reveal_wrong_commit () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_string_failwith ~options program "reveal"
|
expect_string_failwith ~options program "reveal"
|
||||||
@ -223,7 +223,7 @@ let reveal_no_reuse () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_string_failwith ~options program "reveal"
|
expect_string_failwith ~options program "reveal"
|
||||||
@ -256,7 +256,7 @@ let reveal () =
|
|||||||
let options =
|
let options =
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options
|
Proto_alpha_utils.Memory_proto_alpha.make_options
|
||||||
~predecessor_timestamp
|
~predecessor_timestamp
|
||||||
~payer:first_contract
|
~sender:first_contract
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
expect_eq ~options program "reveal"
|
expect_eq ~options program "reveal"
|
||||||
|
@ -48,7 +48,7 @@ let buy_id () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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) ()
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||||
in
|
in
|
||||||
let new_website = e_bytes_string "ligolang.org" in
|
let new_website = e_bytes_string "ligolang.org" in
|
||||||
@ -81,7 +81,7 @@ let buy_id_sender_addr () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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) ()
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||||
in
|
in
|
||||||
let new_website = e_bytes_string "ligolang.org" in
|
let new_website = e_bytes_string "ligolang.org" in
|
||||||
@ -115,7 +115,7 @@ let buy_id_wrong_amount () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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) ()
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) ()
|
||||||
in
|
in
|
||||||
let param = e_pair owner_website (e_some (e_address new_addr)) in
|
let param = e_pair owner_website (e_some (e_address new_addr)) in
|
||||||
@ -134,7 +134,7 @@ let update_details_owner () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -175,7 +175,7 @@ let update_details_controller () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -217,7 +217,7 @@ let update_details_nonexistent () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -284,7 +284,7 @@ let update_details_unchanged () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -316,7 +316,7 @@ let update_owner () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -355,7 +355,7 @@ let update_owner_nonexistent () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -386,7 +386,7 @@ let update_owner_wrong_addr () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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)
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.zero)
|
||||||
()
|
()
|
||||||
in
|
in
|
||||||
@ -416,7 +416,7 @@ let skip () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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) ()
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.one) ()
|
||||||
in
|
in
|
||||||
let new_website = e_bytes_string "ligolang.org" in
|
let new_website = e_bytes_string "ligolang.org" in
|
||||||
@ -450,7 +450,7 @@ let skip_wrong_amount () =
|
|||||||
in
|
in
|
||||||
let new_addr = first_owner in
|
let new_addr = first_owner in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options
|
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) ()
|
~amount:(Memory_proto_alpha.Protocol.Alpha_context.Tez.fifty_cents) ()
|
||||||
in
|
in
|
||||||
let new_website = e_bytes_string "ligolang.org" in
|
let new_website = e_bytes_string "ligolang.org" in
|
||||||
|
@ -73,8 +73,8 @@ let wrong_addr () =
|
|||||||
id_counter_list = [1,0 ; 2,0] ;
|
id_counter_list = [1,0 ; 2,0] ;
|
||||||
msg_store_list = []
|
msg_store_list = []
|
||||||
} in
|
} in
|
||||||
let source = contract 3 in
|
let sender = contract 3 in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let exp_failwith = "Unauthorized address" in
|
let exp_failwith = "Unauthorized address" in
|
||||||
expect_string_failwith ~options program "main"
|
expect_string_failwith ~options program "main"
|
||||||
@ -89,8 +89,8 @@ let message_size_exceeded () =
|
|||||||
id_counter_list = [1,0] ;
|
id_counter_list = [1,0] ;
|
||||||
msg_store_list = []
|
msg_store_list = []
|
||||||
} in
|
} in
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let exp_failwith = "Message size exceed maximum limit" in
|
let exp_failwith = "Message size exceed maximum limit" in
|
||||||
expect_string_failwith ~options program "main"
|
expect_string_failwith ~options program "main"
|
||||||
@ -107,8 +107,8 @@ let maximum_number_of_proposal () =
|
|||||||
id_counter_list = [1,1] ;
|
id_counter_list = [1,1] ;
|
||||||
msg_store_list = [(bytes1, e_set [e_address@@ addr 1])]
|
msg_store_list = [(bytes1, e_set [e_address@@ addr 1])]
|
||||||
} in
|
} in
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
let options = Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let%bind () =
|
let%bind () =
|
||||||
let exp_failwith = "Maximum number of proposal reached" in
|
let exp_failwith = "Maximum number of proposal reached" in
|
||||||
expect_string_failwith ~options program "main"
|
expect_string_failwith ~options program "main"
|
||||||
@ -126,8 +126,8 @@ let send_already_accounted () =
|
|||||||
msg_store_list = [(bytes, e_set [e_address@@ addr 1])]
|
msg_store_list = [(bytes, e_set [e_address@@ addr 1])]
|
||||||
} in
|
} in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair (send_param empty_message) init_storage) (e_pair empty_op_list init_storage)
|
(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])] ;
|
msg_store_list = [(bytes, e_set [e_address@@ addr 1])] ;
|
||||||
} in
|
} in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair (send_param empty_message) init_storage) (e_pair empty_op_list final_storage)
|
(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] ;
|
id_counter_list = [1,0 ; 2,0] ;
|
||||||
msg_store_list = [] } in
|
msg_store_list = [] } in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
(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] ;
|
id_counter_list = [1,0 ; 2,1] ;
|
||||||
msg_store_list = [(bytes, e_set [e_address@@ addr 2])] } in
|
msg_store_list = [(bytes, e_set [e_address@@ addr 2])] } in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
(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] ;
|
id_counter_list = [1,0 ; 2,0 ; 3,0] ;
|
||||||
msg_store_list = [] } in
|
msg_store_list = [] } in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 3 in
|
let sender = contract 3 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
(e_pair param init_storage) (e_pair empty_op_list final_storage)
|
||||||
|
|
||||||
@ -227,8 +227,8 @@ let withdraw_never_accounted () =
|
|||||||
msg_store_list = [] ;
|
msg_store_list = [] ;
|
||||||
} in
|
} in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list init_storage)
|
(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)] ;
|
msg_store_list = [(bytes, e_typed_set [] t_address)] ;
|
||||||
} in
|
} in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let%bind () = expect_eq_n_trace_aux ~options [1;2] program "main"
|
let%bind () = expect_eq_n_trace_aux ~options [1;2] program "main"
|
||||||
(fun th ->
|
(fun th ->
|
||||||
let init_storage = storage (init_storage th) in
|
let init_storage = storage (init_storage th) in
|
||||||
|
@ -44,8 +44,8 @@ let change_addr_success () =
|
|||||||
let init_storage = storage 1 in
|
let init_storage = storage 1 in
|
||||||
let param = entry_change_addr 2 in
|
let param = entry_change_addr 2 in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list (storage 2))
|
(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 init_storage = storage 1 in
|
||||||
let param = entry_change_addr 2 in
|
let param = entry_change_addr 2 in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 3 in
|
let sender = contract 3 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let exp_failwith = "Unauthorized sender" in
|
let exp_failwith = "Unauthorized sender" in
|
||||||
expect_string_failwith ~options program "main"
|
expect_string_failwith ~options program "main"
|
||||||
(e_pair param init_storage) exp_failwith
|
(e_pair param init_storage) exp_failwith
|
||||||
@ -65,8 +65,8 @@ let pass_message_success () =
|
|||||||
let init_storage = storage 1 in
|
let init_storage = storage 1 in
|
||||||
let param = entry_pass_message in
|
let param = entry_pass_message in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 1 in
|
let sender = contract 1 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
expect_eq ~options program "main"
|
expect_eq ~options program "main"
|
||||||
(e_pair param init_storage) (e_pair empty_op_list init_storage)
|
(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 init_storage = storage 1 in
|
||||||
let param = entry_pass_message in
|
let param = entry_pass_message in
|
||||||
let options =
|
let options =
|
||||||
let source = contract 2 in
|
let sender = contract 2 in
|
||||||
Proto_alpha_utils.Memory_proto_alpha.make_options ~source () in
|
Proto_alpha_utils.Memory_proto_alpha.make_options ~sender () in
|
||||||
let exp_failwith = "Unauthorized sender" in
|
let exp_failwith = "Unauthorized sender" in
|
||||||
expect_string_failwith ~options program "main"
|
expect_string_failwith ~options program "main"
|
||||||
(e_pair param init_storage) exp_failwith
|
(e_pair param init_storage) exp_failwith
|
||||||
|
@ -1067,9 +1067,9 @@ type options = {
|
|||||||
let make_options
|
let make_options
|
||||||
?(tezos_context = dummy_environment.tezos_context)
|
?(tezos_context = dummy_environment.tezos_context)
|
||||||
?(predecessor_timestamp = dummy_environment.tezos_context.predecessor_timestamp)
|
?(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)
|
?(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)
|
?(amount = Alpha_context.Tez.one)
|
||||||
?(chain_id = Environment.Chain_id.zero)
|
?(chain_id = Environment.Chain_id.zero)
|
||||||
()
|
()
|
||||||
@ -1077,9 +1077,10 @@ let make_options
|
|||||||
let tezos_context = { tezos_context with predecessor_timestamp } in
|
let tezos_context = { tezos_context with predecessor_timestamp } in
|
||||||
{
|
{
|
||||||
tezos_context ;
|
tezos_context ;
|
||||||
source ;
|
(* yep *)
|
||||||
|
source = sender ;
|
||||||
|
payer = source ;
|
||||||
self ;
|
self ;
|
||||||
payer ;
|
|
||||||
amount ;
|
amount ;
|
||||||
chain_id ;
|
chain_id ;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user