Where can I find AbiEncoderV2 encoding Tuple algorithm?

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


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)));
  • If I understand the question correctly, then this dude is looking for a client-side (off-chain) implementation in Ruby. – goodvibration Mar 11 '20 at 12:35
  • No, he is going to implement this in Ruby and wants to understand how it works in Solidity. – Mikhail Vladimirov Mar 11 '20 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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