Adjusting a few calls.

This commit is contained in:
2026-02-12 17:44:56 +09:00
parent 3838a7e3c5
commit 6c172c4783
3 changed files with 41 additions and 17 deletions
+10 -9
View File
@@ -16,8 +16,8 @@
-license("GPL-3.0-or-later").
% Contract call and serialization interface functions
-export([prepare_contract/1,
prepare_aaci/1,
-export([prepare_from_file/1,
prepare/1,
erlang_to_fate/2,
fate_to_erlang/2,
erlang_args_to_fate/2,
@@ -33,21 +33,22 @@
%%% ACI/AACI
-spec prepare_contract(File) -> {ok, AACI} | {error, Reason}
when File :: file:filename(),
-spec prepare_from_file(Path) -> {ok, AACI} | {error, Reason}
when Path :: file:filename(),
AACI :: aaci(),
Reason :: term().
%% @doc
%% Compile a contract and extract the function spec meta for use in future formation
%% of calldata
prepare_contract(File) ->
case so_compiler:file(File, [{aci, json}]) of
{ok, #{aci := ACI}} -> {ok, prepare_aaci(ACI)};
prepare_from_file(Path) ->
case so_compiler:file(Path, [{aci, json}]) of
{ok, #{aci := ACI}} -> {ok, prepare(ACI)};
Error -> Error
end.
prepare_aaci(ACI) ->
prepare(ACI) ->
% We want to take the types represented by the ACI, things like N1.T(N2.T),
% and dereference them down to concrete types like
% {tuple, [integer, string]}. Our type dereferencing algorithms
@@ -1009,7 +1010,7 @@ coerce_hash_test() ->
aaci_from_string(String) ->
case so_compiler:from_string(String, [{aci, json}]) of
{ok, #{aci := ACI}} -> {ok, prepare_aaci(ACI)};
{ok, #{aci := ACI}} -> {ok, prepare(ACI)};
Error -> Error
end.