-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add last transfer heuristic for transactions which fail to parse #93
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
base: main
Are you sure you want to change the base?
Conversation
85599bb to
502eade
Compare
502eade to
20439b5
Compare
src/tests/index.test.ts
Outdated
| address: "0x4200000000000000000000000000000000000006", | ||
| }, | ||
| }); | ||
| }); |
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.
Can you add a new line here? 🙏
| }); | |
| }); | |
.env.example
Outdated
| ALCHEMY_API_KEY="your-alchemy-api-key-here" | ||
|
|
||
|
|
||
| # Required: QuickNode API keys for specific chain tests |
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.
nit: proper casing for Quicknode.
| # Required: QuickNode API keys for specific chain tests | |
| # Required: Quicknode API keys for specific chain tests |
|
Thanks for the PR! Appreciate the description, and tying the PR to an issue. |
| // The Issue: FOR SETTLERINTENT TXNS only - The taker address passed into calculateNativeTransfer is not the actual takers address, causing nativeAmountToTaker to be 0 when it shouldn't be | ||
| // Potential Solution: we need to determine if the txn is a settlerIntent txn, if so we | ||
| // can determine the taker from the to address in the last trace call. | ||
| const actualTaker = trace.calls[trace.calls.length-1].to; | ||
| //Scans the execution trace for any internal ETH transfers to the taker's address | ||
| const nativeAmountToTaker = calculateNativeTransfer(trace, { | ||
| recipient: taker, | ||
| recipient: taker, // for Settler Intent txns we should use actualTaker |
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.
@duncancmt In order to solve the failing parse for this Optimism txn, I am thinking of using the solution outlined in the comments of this codeblock. Any feedback before I begin implementation on if this is a valid approach or not?
Problem
The existing parser fails in two example swaps:
0x7eea91c5c715ef4bb1e39ddf4c7832113693e87c18392740353d5ae669406a46Etherscan0xdee6f4fea0250f297ed9663c4ca4479e8a253c62e16faa60759e25832cd1f34fOpScanResolves Issue #94
Solution
Adds fallback logic when primary parsing fails using a last transfer heuristic:
Changes
src/index.ts: Added fallback logic using last transfersrc/tests/index.test.ts: Added tests for the failing txnsTesting
Ensure all tests are passing locally.
Additional Changes
.env.exampleregarding the various enviornment variables needed to successfully run all tests.