add a function to fetch (param,storage) in a contract's lambda

This commit is contained in:
Lesenechal Remi 2019-12-04 02:06:41 +01:00
parent 385961503f
commit 8edeb27321
2 changed files with 13 additions and 0 deletions

View File

@ -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 ()

View File

@ -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,