diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index c247597..f8fe59f 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -443,8 +443,13 @@ global_env() -> {"sha256", Fun1(A, Hash)}, {"blake2b", Fun1(A, Hash)}]) }, - %% Strings - StringScope = #scope + %% Authentication + AuthScope = #scope + { funs = MkDefs( + [{"tx_hash", Option(Hash)}]) }, + + %% Strings + StringScope = #scope { funs = MkDefs( [{"length", Fun1(String, Int)}, {"concat", Fun([String, String], String)}, @@ -452,8 +457,8 @@ global_env() -> {"sha256", Fun1(String, Hash)}, {"blake2b", Fun1(String, Hash)}]) }, - %% Bits - BitsScope = #scope + %% Bits + BitsScope = #scope { funs = MkDefs( [{"set", Fun([Bits, Int], Bits)}, {"clear", Fun([Bits, Int], Bits)}, @@ -465,9 +470,9 @@ global_env() -> {"none", Bits}, {"all", Bits}]) }, - %% Conversion - IntScope = #scope{ funs = MkDefs([{"to_str", Fun1(Int, String)}]) }, - AddressScope = #scope{ funs = MkDefs([{"to_str", Fun1(Address, String)}]) }, + %% Conversion + IntScope = #scope{ funs = MkDefs([{"to_str", Fun1(Int, String)}]) }, + AddressScope = #scope{ funs = MkDefs([{"to_str", Fun1(Address, String)}]) }, #env{ scopes = #{ [] => TopScope @@ -477,6 +482,7 @@ global_env() -> , ["Oracle"] => OracleScope , ["AENS"] => AENSScope , ["Map"] => MapScope + , ["Auth"] => AuthScope , ["Crypto"] => CryptoScope , ["String"] => StringScope , ["Bits"] => BitsScope diff --git a/src/aeso_ast_to_icode.erl b/src/aeso_ast_to_icode.erl index a7fbbb3..56a71ac 100644 --- a/src/aeso_ast_to_icode.erl +++ b/src/aeso_ast_to_icode.erl @@ -182,6 +182,11 @@ ast_body(?id_app("abort", [String], _, _), Icode) -> #funcall{ function = #var_ref{ name = {builtin, abort} }, args = [ast_body(String, Icode)] }; +%% Authentication +ast_body({qid, _, ["Auth", "tx_hash"]}, _Icode) -> + prim_call(?PRIM_CALL_AUTH_TX_HASH, #integer{value = 0}, + [], [], aeso_icode:option_typerep(word)); + %% Oracles ast_body(?qid_app(["Oracle", "register"], Args, _, ?oracle_t(QType, RType)), Icode) -> {Sign, [Acct, QFee, TTL]} = get_signature_arg(Args),