Skip to content

Support abi encoding of EVM tuple types #8020

@sisyphusSmiling

Description

@sisyphusSmiling

Problem Definition

Currently, it's not possible to encode calldata from cadence for an EVM tuples. Tuples are often used to encode custom structs defined in solidity contracts. For example

// given some struct S
struct S {
  uint8 x
  uint32 y
}

// and some function foo which takes S as a parameter
function foo(S s) public view returns (uint8) {
  return s.x
}

The function signature would be foo((uint8,uint32)) which is not encodable using existing EVM abi encoding API. Current workarounds require anyone integrating with such a contract to deploy a Solidity proxy/shim accepting the tuple's unpacked args which calls through to the final contract as workaround, increasing developer friction. Unfortunately, this is a common pattern in Uniswap's more recent contracts (example reference).

Proposed Solution

At a high level, support abi encoding tuples which would indirectly support encoding custom structs. I'm not certain this is trivial due to the lack of a tuple type in Cadence.

Definition of Done

Developers can successfully encode tuple calldata and make calls to Solidity functions which accept tuples (and secondarily custom structs) as parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions