Merge pull request #50 from aeternity/PT-166602172-calldat-for-fate

Add creation of fate calldata
This commit is contained in:
Thomas Arts 2019-06-11 14:58:40 +02:00 committed by GitHub
commit 7dd9c29cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View File

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