add a function to fetch (param,storage) in a contract's lambda
This commit is contained in:
parent
385961503f
commit
8edeb27321
@ -17,3 +17,15 @@ let rec map_expression : mapper -> michelson -> michelson result = fun f e ->
|
|||||||
ok @@ Seq (l , lst')
|
ok @@ Seq (l , lst')
|
||||||
)
|
)
|
||||||
| x -> ok x
|
| x -> ok x
|
||||||
|
|
||||||
|
open Memory_proto_alpha.Protocol.Script_ir_translator
|
||||||
|
(* fetches lambda first and second parameter (parameter,storage) *)
|
||||||
|
let fetch_lambda_parameters : ex_ty -> (ex_ty * ex_ty) result =
|
||||||
|
let error () = simple_fail "failed to fetch lambda parameters" in
|
||||||
|
function
|
||||||
|
| Ex_ty (Lambda_t (in_ty, _, _)) -> (
|
||||||
|
match in_ty with
|
||||||
|
| Pair_t ((param_ty,_,_),(storage_ty,_,_),_,_) ->
|
||||||
|
ok (Ex_ty param_ty, Ex_ty storage_ty)
|
||||||
|
|_ -> error () )
|
||||||
|
| _ -> error ()
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
open Tezos_micheline.Micheline
|
open Tezos_micheline.Micheline
|
||||||
open Tezos_utils.Michelson
|
open Tezos_utils.Michelson
|
||||||
|
include Helpers
|
||||||
|
|
||||||
(* `arity p` should be `Some n` only if p is (always) an instruction
|
(* `arity p` should be `Some n` only if p is (always) an instruction
|
||||||
which removes n items from the stack and uses them to push 1 item,
|
which removes n items from the stack and uses them to push 1 item,
|
||||||
|
Loading…
Reference in New Issue
Block a user