2018-01-16 01:09:25 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2018-02-05 22:23:18 +04:00
|
|
|
open Proto_alpha
|
|
|
|
open Error_monad
|
|
|
|
open Tezos_context
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
let init_amount = 20000
|
|
|
|
|
|
|
|
let execute_code_pred
|
|
|
|
?tc (pred : Helpers_block.result) (script : Script.t) (argument : Script.expr) =
|
|
|
|
let op = List.nth Helpers_account.bootstrap_accounts 0 in
|
|
|
|
let tc = Option.unopt ~default:pred.tezos_context tc in
|
|
|
|
Helpers_apply.script_origination_pred ~tc ~pred (script, op, init_amount)
|
|
|
|
>>=? fun ((dst, _), tc) ->
|
|
|
|
let dst = List.hd dst in
|
|
|
|
let ctxt = Helpers_cast.ctxt_of_tc tc in
|
|
|
|
Helpers_operation.transaction_full op dst Tez.zero ctxt
|
|
|
|
>>=? fun dummy_protop ->
|
|
|
|
let op_header = Helpers_block.get_op_header_res pred in
|
|
|
|
let apply_op = Helpers_operation.apply_of_proto
|
|
|
|
(Some op) op_header dummy_protop in
|
|
|
|
let dummy_nonce = Contract.initial_origination_nonce apply_op.hash in
|
|
|
|
let amount = Tez.zero in
|
|
|
|
let gaz = Gas.of_int (Tezos_context.Constants.max_gas tc) in
|
|
|
|
let return = Script_interpreter.execute
|
|
|
|
dummy_nonce op.contract dst
|
|
|
|
tc script amount argument gaz in
|
|
|
|
return
|
|
|
|
|
|
|
|
|