AVIator icon indicating copy to clipboard operation
AVIator copied to clipboard

Struct in event gets flattened

Open nikkolasg opened this issue 2 years ago • 1 comments

Hi,

I use a struct in my solidity contract both as argument of a function and as argument in an event. The function part works fine: ethers creates the equivalent Rust struct and I can give this into the contract method params. The event part though works by flattening somehow the struct,i.e. ethers produces another struct representing the same data, flattened, and this is the one that is given when retrieving events:

Ideally, both would use the same struct.

You can see a very minimal repro here:

  • Here is the simple solidity code: code
  • The params for the function works fine here: code
    • See the struct in Rust
 pub struct Point {
        pub x: ethers::core::types::U256,
        pub y: ethers::core::types::U256,
    }
  • The struct for the event although is different : code
    pub struct NewPointFilter {
        pub x: (ethers::core::types::U256, ethers::core::types::U256),
    }

Thank you !

nikkolasg avatar May 04 '22 15:05 nikkolasg