-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Hi,
thanks for exthereum/abi. When using it I've noticed that calls to functions with arguments of dynamic types are not properly encoded.
ABI.encode("foo(bytes)", [<<1>>]) |> Base.encode16(case: :lower)
outputs
"30c8d1da00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000"
The correct output is:
"30c8d1da000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000"
The missing part is:
0000000000000000000000000000000000000000000000000000000000000020
which is a head part of encoded bytes and should be put right behind encoded function signature.
https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#use-of-dynamic-types