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

ABI function calls with output type "string" Decode (MatchError) #91

Open
willjleong opened this issue Sep 25, 2021 · 2 comments
Open

Comments

@willjleong
Copy link

willjleong commented Sep 25, 2021

I'm trying to call an abi's :symbol method in an erc721 smartcontract but get an error whenever I call a method that returns and abi function output with "string" type. Methods that return address or uint256 work fine... Is this an issue with exw3 or ex_abi? I noticed that this repo doesn't test for smart-contracts calls that have return outputs of "string"

GenServer ContractManager terminating
** (MatchError) no match of right hand side value: <<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.5) lib/abi/type_decoder.ex:238: ABI.TypeDecoder.decode_bytes/4
    (ex_abi 0.5.5) lib/abi/type_decoder.ex:333: anonymous fn/3 in ABI.TypeDecoder.decode_type/3
    (elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ex_abi 0.5.5) lib/abi/type_decoder.ex:331: ABI.TypeDecoder.decode_type/3
    (ex_abi 0.5.5) lib/abi/type_decoder.ex:188: 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.5) lib/abi/type_decoder.ex:185: ABI.TypeDecoder.do_decode_raw/2
    (ex_abi 0.5.5) lib/abi/type_decoder.ex:179: ABI.TypeDecoder.decode_raw/2
    (exw3 0.6.0) lib/exw3/abi.ex:52: ExW3.Abi.decode_output/3
    (exw3 0.6.0) lib/exw3/contract.ex:214: ExW3.Contract.eth_call_helper/4
    (exw3 0.6.0) lib/exw3/contract.ex:480: ExW3.Contract.handle_call/3
    (stdlib 3.14.2.1) gen_server.erl:715: :gen_server.try_handle_call/4
    (stdlib 3.14.2.1) gen_server.erl:744: :gen_server.handle_msg/6
    (stdlib 3.14.2.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.639.0>): {:call, {:"0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", :symbol, []}}

This issues is occurring on this line when the output decoded type is "string" https://github.com/hswick/exw3/blob/master/lib/exw3/abi.ex#L49

@willjleong willjleong changed the title ABIs function calls with output type "string" Fail ABI function calls with output type "string" Fail Sep 25, 2021
@willjleong willjleong changed the title ABI function calls with output type "string" Fail ABI function calls with output type "string" Decode (MatchError) Sep 25, 2021
@gregors
Copy link

gregors commented Dec 9, 2021

I'm seeing similar errors. I'm under the impression it's a problem with ex_abi?

@gregors
Copy link

gregors commented Dec 14, 2021

@willjleong I'm curious if my PR fixes your issue - #107

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

2 participants