Add creation of fate calldata

This commit is contained in:
Thomas Arts 2019-06-11 14:27:49 +02:00
parent 29b5ee3e68
commit 242700e084
2 changed files with 25 additions and 2 deletions

View File

@ -2,12 +2,12 @@
%%% @copyright (C) 2017, Aeternity Anstalt
%%% @doc
%%% Encode and decode data and function calls according to
%%% Sophia-AEVM-ABI.
%%% Sophia-AEVM-ABI
%%% @end
%%% Created : 25 Jan 2018
%%%
%%%-------------------------------------------------------------------
-module(aeb_abi).
-module(aeb_aevm_abi).
-define(HASH_SIZE, 32).
-export([ create_calldata/4

23
src/aeb_fate_abi.erl Normal file
View File

@ -0,0 +1,23 @@
%%%-------------------------------------------------------------------
%%% @copyright (C) 2019, Aeternity Anstalt
%%% @doc
%%% Encode and decode data and function calls according to
%%% Sophia-FATE-ABI
%%% @end
%%% Created : 11 Jun 2019
%%%
%%%-------------------------------------------------------------------
-module(aeb_fate_abi).
-export([ create_calldata/2 ]).
%%%===================================================================
%%% API
%%%===================================================================
-spec create_calldata(list(), [term()]) -> {ok, binary()}.
create_calldata(FunName, Args) ->
FunctionId = aeb_fate_code:symbol_identifier(list_to_binary(FunName)),
{ok, aeb_fate_encoding:serialize(
aeb_fate_data:make_tuple({FunctionId,
aeb_fate_data:make_tuple(list_to_tuple(Args))}))}.