Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Events from Receipts #98

Closed
gakonst opened this issue Nov 19, 2020 · 0 comments · Fixed by #239
Closed

Events from Receipts #98

gakonst opened this issue Nov 19, 2020 · 0 comments · Fixed by #239
Labels
enhancement New feature or request

Comments

@gakonst
Copy link
Owner

gakonst commented Nov 19, 2020

Ideally for the following contract's events:

contract C {
    event X(...);
    event Y(...);
}

The resulting codegen should be

#[derive(EthEvent)]
struct X {
   ...
}

#[derive(EthEvent)]
struct Y {
  ...
}

#[derive(EthEvent)]
enum XY {
       X(X),
       Y(Y),
}

// parse_logs will try to decode each individual log inside the receipt as either X or Y 
let ev: Vec<XY> = ethers_contract::parse_logs(tx_receipt)?;

It should be possible to use the enum as a union type to parse event logs of various types, allowing us to e.g. loop over a transaction's logs. Also, it'd be nice if we had this in a function like all_events (see here for the macro def).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant