Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with ABI.TypeDecoder #85

Open
ilyadruzh opened this issue Jul 2, 2021 · 2 comments
Open

Problem with ABI.TypeDecoder #85

ilyadruzh opened this issue Jul 2, 2021 · 2 comments

Comments

@ilyadruzh
Copy link

Hi!

I have a problem with ExW3.Contract.call method and ABI.TypeDecoder.decode_type.

Solidity function:
function get_DFA(uint dfaID) public returns (DFA memory) { DFA storage dfa = dfa_pool[dfaID]; return dfa; }

Elixir function:

def sc_call(sc_abi_path, sc_address, sc_name, sc_method, sc_method_args \\ []) do
    ExW3.Contract.start_link()
    sc_abi = ExW3.Abi.load_abi(sc_abi_path)
    ExW3.Contract.register(String.to_atom(sc_name), abi: sc_abi)
    ExW3.Contract.at(String.to_atom(sc_name), sc_address)
    ExW3.Contract.call(String.to_atom(sc_name), String.to_atom(sc_method), sc_method_args)
end

When I call this method from ElixirApp, I get a error

ElixirApp.Utils.Ethereum.sc_call("data/DFAPool.abi", "0x39Df1178CCBeC6d48A81969b6f67f13F3B4CC6E3", "DFAPool", "get_DFA", [1])

00:35:02.056 [error] GenServer ContractManager terminating
** (FunctionClauseError) no function clause matching in ABI.TypeDecoder.decode_type/2
(ex_abi 0.5.3) lib/abi/type_decoder.ex:244: ABI.TypeDecoder.decode_type(:tuple, <<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>)
(ex_abi 0.5.3) lib/abi/type_decoder.ex:270: anonymous fn/3 in ABI.TypeDecoder.decode_type/2
(elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_abi 0.5.3) lib/abi/type_decoder.ex:265: ABI.TypeDecoder.decode_type/2
(ex_abi 0.5.3) lib/abi/type_decoder.ex:189: anonymous fn/3 in ABI.TypeDecoder.do_decode_raw/2
(elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_abi 0.5.3) lib/abi/type_decoder.ex:184: ABI.TypeDecoder.do_decode_raw/2
(ex_abi 0.5.3) lib/abi/type_decoder.ex:178: ABI.TypeDecoder.decode_raw/2
Last message (from #PID<0.255.0>): {:call, {:DFAPool, :get_DFA, [1]}}

I don't understand what's happened.

@rupurt
Copy link
Collaborator

rupurt commented Jul 2, 2021

This looks similar to a bug I fixed in ex_abi poanetwork/ex_abi#61. Can you upgrade to ex_abi v0.5.5 and lmk if it fixes your problem?

@somoza
Copy link

somoza commented Jan 18, 2022

How are you encoding the Base 16?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants