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

Support for the "int" type #1

Closed
lucasnar opened this issue Jul 9, 2018 · 0 comments
Closed

Support for the "int" type #1

lucasnar opened this issue Jul 9, 2018 · 0 comments

Comments

@lucasnar
Copy link
Contributor

lucasnar commented Jul 9, 2018

Description

The following code raises an error:

abi = [
  %{
    "constant" => true,
    "inputs" => [%{"name" => "x", "type" => "int256"}],
    "name" => "with_arguments",
    "outputs" => [%{"name" => "", "type" => "bool"}],
    "payable" => false,
    "stateMutability" => "view",
    "type" => "function"
  }
]
selector = abi |> ABI.parse_specification() |> hd
selector |> ABI.encode([42])

Output:

** (RuntimeError) Unsupported encoding type: {:int, 256}
    (abi) lib/abi/type_encoder.ex:215: ABI.TypeEncoder.encode_type/2
    (abi) lib/abi/type_encoder.ex:139: ABI.TypeEncoder.do_encode/3
    (abi) lib/abi/type_encoder.ex:102: ABI.TypeEncoder.encode/2

Expected output:

"7df46666000000000000000000000000000000000000000000000000000000000000002a"

From blockscout/blockscout#363.

@lucasnar lucasnar mentioned this issue Jul 11, 2018
ayrat555 pushed a commit that referenced this issue Jan 14, 2019
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

1 participant