3

Where can I find AbiEncoderV2 encoding Tuple algorithm?

I would like to add Tuples support to a ruby library.

1 Answer 1

3

Basically, a tuple is encoded as if all its members were separate parameters, so the following function returns true:

struct Foo {
  uint x;
  uint y;
  uint z;
}

function foo () public pure returns (bool) {
  return keccak256 (abi.encode (1, 2, 3)) ==
         keccak256 (abi.encode (Foo (1,  2, 3)));
}
2
  • 1
    If I understand the question correctly, then this dude is looking for a client-side (off-chain) implementation in Ruby. Commented Mar 11, 2020 at 12:35
  • No, he is going to implement this in Ruby and wants to understand how it works in Solidity. Commented Mar 11, 2020 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.