Proto: transfer_funds is now transfer_tokens.
This commit is contained in:
parent
d2d78dc8d6
commit
e262a334dc
@ -253,7 +253,7 @@ let commands () =
|
||||
return ()) ;
|
||||
command
|
||||
~group: "context"
|
||||
~desc: "transfer funds"
|
||||
~desc: "transfer tokens"
|
||||
~args: [ fee_arg ; arg_arg ; force_arg ]
|
||||
(prefixes [ "transfer" ]
|
||||
@@ tez_param
|
||||
|
@ -463,7 +463,7 @@ let rec interp
|
||||
| Manager, Item ((_, _, contract), rest) ->
|
||||
Contract.get_manager ctxt contract >>=? fun manager ->
|
||||
return (Item (manager, rest), qta - 1, ctxt)
|
||||
| Transfer_funds (storage_type, loc),
|
||||
| Transfer_tokens (storage_type, loc),
|
||||
Item (p, Item (amount, Item ((tp, Void_t, destination), Item (sto, Empty)))) -> begin
|
||||
Contract.unconditional_spend ctxt source amount >>=? fun ctxt ->
|
||||
Contract.credit ctxt destination amount >>=? fun ctxt ->
|
||||
@ -493,7 +493,7 @@ let rec interp
|
||||
parse_untagged_data ctxt storage_type storage >>=? fun sto ->
|
||||
return (Item ((), Item (sto, Empty)), qta - 1, ctxt))
|
||||
end
|
||||
| Transfer_funds (storage_type, loc),
|
||||
| Transfer_tokens (storage_type, loc),
|
||||
Item (p, Item (amount, Item ((tp, tr, destination), Item (sto, Empty)))) -> begin
|
||||
Contract.unconditional_spend ctxt source amount >>=? fun ctxt ->
|
||||
Contract.credit ctxt destination amount >>=? fun ctxt ->
|
||||
|
@ -1076,13 +1076,13 @@ and parse_instr
|
||||
(* protocol *)
|
||||
| Prim (_, "manager", []), Item_t (Contract_t _, rest) ->
|
||||
return (Typed (Manager, Item_t (Key_t, rest)))
|
||||
| Prim (loc, "transfer_funds", []),
|
||||
| Prim (loc, "transfer_tokens", []),
|
||||
Item_t (p, Item_t (Tez_t, Item_t (Contract_t (cp, cr), Item_t (storage, Empty_t)))) ->
|
||||
check_item_ty p cp loc 1 >>=? fun (Eq _) ->
|
||||
begin match storage_type with
|
||||
| Some storage_type ->
|
||||
check_item_ty storage storage_type loc 3 >>=? fun (Eq _) ->
|
||||
return (Typed (Transfer_funds (storage, loc), Item_t (cr, Item_t (storage, Empty_t))))
|
||||
return (Typed (Transfer_tokens (storage, loc), Item_t (cr, Item_t (storage, Empty_t))))
|
||||
| None ->
|
||||
fail (Transfer_in_lambda loc)
|
||||
end
|
||||
@ -1128,7 +1128,7 @@ and parse_instr
|
||||
| "abs" | "neg" | "lsl" | "lsr"
|
||||
| "compare" | "eq" | "neq"
|
||||
| "lt" | "gt" | "le" | "ge"
|
||||
| "manager" | "transfer_funds" | "create_account"
|
||||
| "manager" | "transfer_tokens" | "create_account"
|
||||
| "create_contract" | "now" | "amount" | "balance"
|
||||
| "check_signature" | "h" | "steps_to_quota"
|
||||
as name), (_ :: _ as l)), _ ->
|
||||
@ -1162,7 +1162,7 @@ and parse_instr
|
||||
fail (Bad_stack (loc, 6, Stack_ty stack_ty))
|
||||
| Prim (loc, "create_account", []), _ ->
|
||||
fail (Bad_stack (loc, 4, Stack_ty stack_ty))
|
||||
| Prim (loc, "transfer_funds", []), _ ->
|
||||
| Prim (loc, "transfer_tokens", []), _ ->
|
||||
fail (Bad_stack (loc, 3, Stack_ty stack_ty))
|
||||
| Prim (loc, ("drop" | "dup" | "car" | "cdr" | "some" | "h" | "dip"
|
||||
| "if_none" | "left" | "right" | "if_left" | "if"
|
||||
|
@ -296,7 +296,7 @@ and ('bef, 'aft) instr =
|
||||
(* protocol *)
|
||||
| Manager :
|
||||
(('arg, 'ret) typed_contract * 'rest, public_key_hash * 'rest) instr
|
||||
| Transfer_funds : 'sto ty * Script.location ->
|
||||
| Transfer_tokens : 'sto ty * Script.location ->
|
||||
('arg * (Tez.t * (('arg, 'ret) typed_contract * ('sto * end_of_stack))), 'ret * ('sto * end_of_stack)) instr
|
||||
| Create_account :
|
||||
(public_key_hash * (public_key_hash option * (bool * (Tez.t * 'rest))),
|
||||
|
@ -296,7 +296,7 @@ and ('bef, 'aft) instr =
|
||||
(* protocol *)
|
||||
| Manager :
|
||||
(('arg, 'ret) typed_contract * 'rest, public_key_hash * 'rest) instr
|
||||
| Transfer_funds : 'sto ty * Script.location ->
|
||||
| Transfer_tokens : 'sto ty * Script.location ->
|
||||
('arg * (Tez.t * (('arg, 'ret) typed_contract * ('sto * end_of_stack))), 'ret * ('sto * end_of_stack)) instr
|
||||
| Create_account :
|
||||
(public_key_hash * (public_key_hash option * (bool * (Tez.t * 'rest))),
|
||||
|
@ -243,7 +243,7 @@ module Context = struct
|
||||
|
||||
let spendable custom_root =
|
||||
RPC.service
|
||||
~description: "Tells if the contract funds can be spent by the manager."
|
||||
~description: "Tells if the contract tokens can be spent by the manager."
|
||||
~input: empty
|
||||
~output: (wrap_tzerror bool)
|
||||
RPC.Path.(custom_root / "context" / "contracts" /: Contract.arg / "spendable")
|
||||
|
Loading…
Reference in New Issue
Block a user