-
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
Simulate: Transaction via Tenderly #227
Conversation
Introducing transaction log parsing via ethers library with appropriate Contract artifacts. Namely, we introduce dependencies on @cowprotocol/contracts which contain the abi files for GPv2Settlement and iERC20 and suffice for us to decode relevant event data from settlement transactions. For us these are Transfer, Settlement and Trade. 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).
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:
|
e6de2ec
to
812c1e8
Compare
* parse tenderly simulation response * run linter
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.
Left some curiosity questions. LGTM!
|
||
export function isTenderlySimulationResponse( | ||
value: any | ||
): value is TenderlySimulationResponse { |
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.
Out of curiosity: Why isn't this a boolean?
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.
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.
Some context, this is called "type guards" https://www.typescriptlang.org/docs/handbook/advanced-types.html
Introducing an interface for transaction simulation and an implementation (via Tenderly).
We test a successful simulation and another with invalid credentials that returns nothing. We will eventually combine this with the content in #220 so to simulate the full call data provided by the winning solver. From within the tenderly web-action we could access the credentials from the action context like so:
However we use env vars here in out tests (not sure of a better way).