-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse event logs with ethers.js #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the changes! There are two comments I think are important before merging, otherwise it looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but take it with a grain of salt as I have no previous ts knowledge/experience.
Co-authored-by: Leandro Boscariol <[email protected]>
Co-authored-by: Federico Giacon <[email protected]>
b994fba
to
92fd657
Compare
New dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No new dependency issues detected in pull request Bot CommandsTo ignore an alert, reply with a comment starting with Pull request alert summary
📊 Modified Dependency Overview:
|
As suggested in #182 (comment) (from PR #182) we introduce transaction log parsing via ethers library with appropriate Contract artifacts. Namely, we introduce dependencies on
@cowprotocol/contracts
which contain the abi files forGPv2Settlement
andiERC20
and suffice for us to decode relevant event data from settlement transactions. For us these areTransfer
,Settlement
andTrade
.We construct Event types out of each which only keep the parts that matter for our purposes (namely TradeEvent having
owner
as the only relevant field).Unit Tests are more-or-less the same (except we had to change test addresses to checksum addresses) and we also had to add some non-trivial
data
to our mockTradeEventLog
since ethers expects to be able to parse even the irrelevant, to us, fields of a Trade.Note that this also allowed us to remove a utility method that was previously used to manually decode raw transaction data.
Test Plan
Existing Tests