Skip to content
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

Write Settlements to DB from Action #185

Merged
merged 14 commits into from
Apr 3, 2023
Merged

Write Settlements to DB from Action #185

merged 14 commits into from
Apr 3, 2023

Conversation

bh2smith
Copy link
Contributor

@bh2smith bh2smith commented Feb 9, 2023

Part of #177

Now that our action parses event data from transaction receipts (#182) - the next logical step is to insert these records to the DB.

In future iterations it will be necessary to maintain records of all processed settlements because some batches will not have any internalized and this is the only way we can tell if the batch was not accidentally forgotten.

The primary changes here are separated into different commits

  • generate type-bindings for DB schema
  • introduce insert method for settlement event
  • Creates DB in CI Runs Flyaway migration and runs unit test for insertion method.

Test Plan

There are local unit tests introduced here, but this has also been running on Tenderly actions now for over a month.

bh2smith and others added 8 commits March 27, 2023 15:30
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).
@socket-security
Copy link

socket-security bot commented Mar 27, 2023

New dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

➕ Added Package Capability Access +/- Transitive Count Publisher
@databases/pg-schema-cli@4.3.1 environment +89 forbeslindesay
@databases/pg-test@3.1.2 environment +20 forbeslindesay
@databases/pg-typed@4.4.0 None +38 forbeslindesay
@databases/pg@5.4.1 filesystem, environment +36 forbeslindesay
⬆️ Updated Package Version Diff Capability Access +/- Transitive Count Publisher
@tenderly/actions@0.1.1 0.1.0...0.1.1 None +0/-0 gagi-tenderly
@cowprotocol/contracts@1.4.0 1.3.2...1.4.0 network +2/-2 cowprotocol_dev
ethers@6.2.2 6.0.3...6.2.2 network, filesystem +1/-1 ricmoo
jest@29.5.0 29.4.1...29.5.0 None +53/-88 simenb
@types/jest@29.5.0 29.4.0...29.5.0 None +14/-17 types

@bh2smith bh2smith marked this pull request as ready for review March 27, 2023 15:15
@bh2smith bh2smith requested review from a team and fedgiac March 27, 2023 15:15
Base automatically changed from action-models to slippage-v2 March 28, 2023 11:29
@bh2smith bh2smith merged commit 546f885 into slippage-v2 Apr 3, 2023
@bh2smith bh2smith deleted the action-to-db branch April 3, 2023 19:34
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2023
@bh2smith
Copy link
Contributor Author

bh2smith commented Apr 3, 2023

*Note that this was open for almost a month without proper review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants