Compare commits

...

562 Commits

Author SHA1 Message Date
Gui Heise
c93e216647 Fix length check for child transfers 2021-12-15 14:35:29 -05:00
Gui Heise
af01b4e8b5 Value to Runtime error 2021-12-15 14:03:51 -05:00
Gui Heise
42b82be386 Add exception to transfers not found 2021-12-15 13:54:51 -05:00
Gui Heise
c090624f4c move none check 2021-12-15 11:06:22 -05:00
Gui Heise
23635892a6 Add check for reverted orders 2021-12-13 21:07:24 -05:00
Luke Van Seters
f07c497b33 Merge pull request #157 from flashbots/fix-head-punks
Change migrations head for punks
2021-12-13 14:34:23 -05:00
Luke Van Seters
1534fb6165 Change migrations head for punks 2021-12-13 13:19:11 -05:00
Gui Heise
88adfd8625 Merge pull request #154 from flashbots/add-liquidation-addresses
Add liquidation addresses
2021-12-13 11:00:26 -05:00
Gui Heise
d736b38845 Add coinbase names for addresses 2021-12-08 15:09:06 -05:00
Gui Heise
00c73b228d Add supported token addresses 2021-12-07 15:53:45 -05:00
Gui Heise
5341c904ec Add top received liquidation addresses to prices 2021-12-07 15:13:08 -05:00
Robert Miller
9ffa9d2df9 Merge pull request #149 from flashbots/punk_accept_bids_database
feat: punk accept bids database
2021-12-06 16:41:47 -05:00
Robert Miller
4e91e52a92 style: formatting 2021-12-06 16:36:05 -05:00
Robert Miller
0ad3906989 style: formatting 2021-12-06 16:33:35 -05:00
Robert Miller
27f43ea29c Merge branch 'main' into punk_accept_bids_database 2021-12-06 16:31:24 -05:00
Robert Miller
8d48cea315 Merge pull request #147 from flashbots/punk-database-work
feat: punk_snipe database entry
2021-12-06 16:16:31 -05:00
Robert Miller
01c4024017 style: formatting 2021-12-06 16:13:47 -05:00
Robert Miller
044a233141 Merge branch 'main' into punk-database-work 2021-12-06 16:07:13 -05:00
Robert Miller
34dc54ee6f Merge pull request #148 from flashbots/punk_bid_database
feat: add punk bid database
2021-12-06 16:05:47 -05:00
Gui Heise
d938182833 Merge pull request #153 from flashbots/double-arb-bug
Fix arbitrage swap double entry bug
2021-12-06 15:21:43 -05:00
Gui Heise
d2a1814774 skip start swap 2021-12-06 15:18:32 -05:00
Gui Heise
be19c42275 add start and end route check 2021-12-06 11:52:41 -05:00
Robert Miller
8ee803d229 Merge branch 'punk-database-work' of https://github.com/flashbots/mev-inspect-py into punk-database-work 2021-12-04 20:33:13 -05:00
Robert Miller
478f9bafa5 style: formatting 2021-12-04 20:32:54 -05:00
Robert Miller
9f08275698 style: formatting 2021-12-04 20:32:29 -05:00
Robert Miller
622cf9319e style: formatting 2021-12-04 20:31:46 -05:00
Luke Van Seters
11744deaa9 Merge pull request #151 from sketsdever/bancor
Bancor classifier
2021-12-03 11:05:44 -05:00
Shea Ketsdever
37e6900f46 Rename create_swap functions 2021-12-02 21:08:45 -05:00
Taarush Vemulapalli
1fb65bacc1 Compound backfilling/removed network calls (#125)
* Removes `collateral_token_address` from both aave/comp for consistency
2021-12-02 11:19:32 -08:00
Shea Ketsdever
4fdd628ce3 Merge 2021-12-01 18:10:05 -05:00
Luke Van Seters
912239fc2e Merge pull request #150 from flashbots/fix-timestamp-writing
Fix timestamp writing in blocks
2021-11-30 12:57:20 -05:00
Luke Van Seters
ed94e71715 Fix timestamp writing in blocks 2021-11-30 12:54:07 -05:00
Luke Van Seters
f7e4bdaed2 Merge pull request #142 from flashbots/prices-kube
Add cron job to fetch prices
2021-11-29 12:09:29 -05:00
Shea Ketsdever
7d7f78bfb1 Fix int<>timestamp bug 2021-11-28 16:02:41 -08:00
Shea Ketsdever
cd01298ba6 Bancor classifier 2021-11-28 14:51:24 -08:00
Robert Miller
c1ba63ef81 style: formatting 2021-11-26 21:34:16 -05:00
Robert Miller
e1e678bbc2 style: formatting 2021-11-26 21:33:47 -05:00
Robert Miller
c619c20878 bug: add a missing parentheses 2021-11-26 21:29:53 -05:00
Robert Miller
3088055606 bug: add a missing parentheses 2021-11-26 21:29:20 -05:00
Luke Van Seters
018fb8c73b Run hourly 2021-11-26 21:07:06 -05:00
Luke Van Seters
9a076a6b4c Don't run prices by default 2021-11-26 21:07:06 -05:00
Luke Van Seters
391314b9d6 Limit successful history instead of ttl 2021-11-26 21:07:06 -05:00
Luke Van Seters
c83577b04c Remove restart 2021-11-26 21:07:06 -05:00
Luke Van Seters
34aca861cc Use poetry directly instead of entrypoint script 2021-11-26 21:07:06 -05:00
Luke Van Seters
a8c1728e35 Save progress 2021-11-26 21:07:06 -05:00
Luke Van Seters
26caaa04e1 Merge pull request #134 from flashbots/prices
Add support for fetching prices from coinbase and storing
2021-11-26 21:06:48 -05:00
Luke Van Seters
4f34316afb COINBASE_TOKEN_NAMES => COINBASE_TOKEN_NAME_BY_ADDRESS 2021-11-26 21:03:57 -05:00
Robert Miller
868094696a Merge branch 'main' into punk_accept_bids_database 2021-11-26 19:07:42 -05:00
Robert Miller
90f822a15f Merge branch 'main' into punk_bid_database 2021-11-26 19:07:16 -05:00
Robert Miller
56f0bbb855 Merge branch 'main' into punk-database-work 2021-11-26 19:02:10 -05:00
Gui Heise
4304776af6 Merge pull request #143 from flashbots/0x-v2
Add support for 0x orderbook
2021-11-26 18:14:41 -05:00
Robert Miller
07aa6e3089 feat: add punk_bid_acceptances database 2021-11-26 15:42:36 -05:00
Robert Miller
71c549b6f3 feat: add punk_bids database 2021-11-26 15:33:07 -05:00
Robert Miller
7bfe77a18f bug: fix punk_snipe alembic file 2021-11-26 15:22:45 -05:00
Robert Miller
947e5921c7 feat: add alembic for punk snipes 2021-11-26 15:10:37 -05:00
Robert Miller
8144d406b3 Merge pull request #138 from flashbots/cryptopunks-classifer 2021-11-26 12:00:35 -05:00
Luke Van Seters
2dc2c89b0b Merge pull request #146 from flashbots/block-timestamp-timestamp
Convert block_timestmap from numeric to timestamp
2021-11-26 11:18:30 -05:00
Luke Van Seters
051ef74eb7 Convert block_timestmap from numeric to timestamp 2021-11-26 11:02:02 -05:00
Robert Miller
2cc7ac4a20 feat: initial files for punk database 2021-11-25 21:05:42 -05:00
Robert Miller
b4097baa68 feat: remove unused punk_snipe import 2021-11-25 19:35:22 -05:00
Robert Miller
7638c97e88 =feat: change punk snipe to only check against the highest bid per punk 2021-11-25 19:32:30 -05:00
Robert Miller
bb3ace07a1 =move punk classifiers out of classifer.py 2021-11-25 16:48:48 -05:00
Robert Miller
976ac9ea77 style: change punk_bid.amount to price 2021-11-25 16:04:52 -05:00
Robert Miller
3314056c88 revert change to mev 2021-11-25 12:23:46 -05:00
Gui Heise
44e357344e Remove test assertion 2021-11-24 13:54:39 -05:00
Gui Heise
9f860c118e Remove validation step 2021-11-24 12:23:32 -05:00
Gui Heise
8a555ea442 Move helpers into 0x file 2021-11-24 12:14:40 -05:00
Gui Heise
7656c0d76c Remove children swaps 2021-11-23 14:34:26 -05:00
Gui Heise
c334441e95 Add assertion and move constants up 2021-11-23 11:28:15 -05:00
Gui Heise
d7872db45c Restructure classifier 2021-11-23 11:15:03 -05:00
Gui Heise
d75e9b76ab Add constants and exceptions 2021-11-23 10:38:02 -05:00
Gui Heise
4c643a2d9f Add tests for 0x swaps 2021-11-23 09:32:18 -05:00
Gui Heise
2d62ca25d6 Add function signatures 2021-11-22 19:06:58 -05:00
Gui Heise
e29c4fad72 Add support for any taker 2021-11-22 15:09:20 -05:00
Gui Heise
2f1a9bc751 Add helper for token_in_amount 2021-11-22 12:35:23 -05:00
Gui Heise
f650d3e87f Make protocol zero_ex 2021-11-22 12:23:14 -05:00
Gui Heise
32aa3246bf Remove debugger 2021-11-22 12:23:14 -05:00
Gui Heise
dbe40249b5 Add Rfq/Limit distinction 2021-11-22 12:23:14 -05:00
Gui Heise
cf71272c10 Add 0x swap classifier 2021-11-22 12:23:14 -05:00
Gui Heise
8428dd9908 Merge pull request #141 from flashbots/classifier-helpers
Add classifier helpers
2021-11-22 12:22:38 -05:00
Gui Heise
89c2ed3a84 Remove func 2021-11-22 12:16:39 -05:00
Gui Heise
784922fa07 Rename to helpers, add func 2021-11-22 12:07:30 -05:00
Gui Heise
9bf7a2675c Merge pull request #140 from flashbots/swapmodel
Add contract_address to SwapModel
2021-11-22 11:28:26 -05:00
Gui Heise
dc02564862 Add contract_address 2021-11-22 10:55:00 -05:00
Gui Heise
4f2c65e535 Merge pull request #137 from flashbots/swap-contract-address
Swap contract address
2021-11-21 22:14:17 -05:00
Gui Heise
94269cad33 Merge pull request #139 from flashbots/mev-bash
Change shell directory
2021-11-20 10:24:23 -05:00
Gui Heise
d2e1c588c4 Change shell directory 2021-11-19 19:21:46 -05:00
Robert Miller
377137d9c8 feat: add support for punk snipes 2021-11-19 17:18:29 -06:00
Robert Miller
f31430da30 bug: update uint to uin256 2021-11-19 17:17:34 -06:00
Gui Heise
12a82e918b Add contract_address in arbs 2021-11-19 11:03:06 -05:00
Gui Heise
45c9980a79 Add contract_address to tests 2021-11-19 11:00:14 -05:00
Gui Heise
8c699ed7cc Alter schema 2021-11-19 10:59:08 -05:00
Gui Heise
a9859a0b12 Add database migration 2021-11-19 10:58:35 -05:00
Gui Heise
07e1680301 Merge pull request #130 from flashbots/swaps-classifiers
Implement swap classifiers
2021-11-19 09:58:39 -05:00
Luke Van Seters
bf4570c8a3 Merge pull request #136 from flashbots/transfers-trace-address-array
Change transfers trace_address to ARRAY
2021-11-19 08:43:59 -05:00
Luke Van Seters
5f9bd3a274 Change transfers trace address to ARRAY 2021-11-19 08:42:08 -05:00
Luke Van Seters
ec860c7357 Merge pull request #135 from flashbots/prices-table-2
Add prices table
2021-11-18 17:33:27 -05:00
Luke Van Seters
f5233a17fd Rename to prices table 2021-11-18 13:56:07 -05:00
Luke Van Seters
7d50d3d674 Rename to prices table 2021-11-18 13:55:38 -05:00
Luke Van Seters
023205c25b Print => logger 2021-11-18 13:47:59 -05:00
Luke Van Seters
d499983f32 Remove fetch-latest for now 2021-11-18 13:45:25 -05:00
Luke Van Seters
5b59427d4f Write prices. Ignore duplicates 2021-11-18 13:43:21 -05:00
Gui Heise
386eccaeb7 Remove abstract method 2021-11-18 12:58:45 -05:00
Gui Heise
ca0014533a Add getter method for Uni recipient address 2021-11-18 12:52:48 -05:00
Gui Heise
c5621e0676 space 2021-11-18 12:23:09 -05:00
Gui Heise
1e1241cbf5 Remove Uni none checks and bash change 2021-11-18 12:22:13 -05:00
Luke Van Seters
bed8520bc8 Write prices on fetch-all 2021-11-18 11:55:42 -05:00
Luke Van Seters
5a3dbca425 Create usd_prices table 2021-11-18 11:55:03 -05:00
Luke Van Seters
2dc14218bf Add support for fetching all supported prices 2021-11-18 11:43:59 -05:00
Luke Van Seters
053c29cf20 Add placeholder for price commands 2021-11-18 11:43:59 -05:00
Gui Heise
6e25031623 Rename utils.py to swaps.py 2021-11-18 11:38:09 -05:00
Luke Van Seters
5756cb15a5 Merge pull request #128 from elopio/typo/clasifier
Fix typo: clasifier
2021-11-18 11:34:25 -05:00
Luke Van Seters
36101c36db Merge pull request #132 from flashbots/timestamp-support
Add support for writing timestamps in mev-inspect
2021-11-18 10:39:15 -05:00
Luke Van Seters
d7238c0e83 Merge pull request #131 from flashbots/add-block-timestamps-table
Add block timestamps table
2021-11-18 10:39:10 -05:00
Luke Van Seters
0d4cbc76b6 Merge pull request #129 from flashbots/fix-logging-base
Only set base logging from entry points
2021-11-18 10:39:05 -05:00
Robert Miller
1de1570939 feat: change to "punk bid acceptance" and get punk bid acceptances 2021-11-17 21:51:56 -05:00
Luke Van Seters
d2437055d9 Fix tests 2021-11-17 15:19:48 -05:00
Luke Van Seters
5aa8776b0d Don't attempt to create block if timestamp is null 2021-11-17 15:14:24 -05:00
Luke Van Seters
a2dc8908df Save block during inspection 2021-11-17 15:11:26 -05:00
Luke Van Seters
ad45abbe9c Add crud for blocks 2021-11-17 15:07:04 -05:00
Luke Van Seters
460f449127 Add block timestamps table 2021-11-17 14:37:57 -05:00
Luke Van Seters
caf645e923 Fetch timestamp when creating blocks 2021-11-17 13:28:48 -05:00
Gui Heise
ff9337eb4b Fix UniV3 Classifier 2021-11-17 10:19:10 -05:00
Gui Heise
94c5691f01 Move swap logic into classifiers 2021-11-17 07:37:25 -05:00
Robert Miller
96d2171daa style: improve schema naming bcuz imagine complained 2021-11-16 19:57:58 -05:00
Robert Miller
0d6215f82e wip feat: getting punk bids / accepts 2021-11-15 21:08:28 -05:00
Robert Miller
5766abb9fe feat: add punk classifiers 2021-11-15 21:08:07 -05:00
Robert Miller
c5ab2be4e3 add punk classifications 2021-11-15 21:07:38 -05:00
Luke Van Seters
f705a85b5c Only set base logging from entrypoints 2021-11-15 16:00:18 -05:00
Gui Heise
f43df8ffa4 Fix circular imports 2021-11-15 13:28:34 -05:00
Gui Heise
29cd82cd0b Parse swap logic inside uniswap classifier 2021-11-15 11:00:39 -05:00
Luke Van Seters
dec628b7a9 Merge pull request #124 from flashbots/listener-healthcheck
Ping healthcheck URL on each inspect in listener
2021-11-12 19:02:42 -05:00
Luke Van Seters
ec49c03484 Merge pull request #123 from flashbots/listener-async
Support asyncio in listener
2021-11-12 19:02:33 -05:00
Luke Van Seters
d34356bffb Merge pull request #118 from flashbots/classified-traces-block-index
Change classified_traces and miner_payments primary keys to begin with block number
2021-11-12 19:02:24 -05:00
Luke Van Seters
e144e377fd Merge pull request #117 from flashbots/swap-block-index
Reindex swaps by block number
2021-11-12 14:58:43 -05:00
Leo Arias
cfeaaae046 Fix typo: clasifier 2021-11-11 17:55:12 +00:00
Gui Heise
5d03c1fbfa Add classifier specs to init 2021-11-11 10:39:24 -05:00
Robert Miller
af2aab4940 add cryptopunks trace classifier 2021-11-10 20:14:42 -05:00
Luke Van Seters
63e81b22e6 Ping healthcheck url on each successful block inspect 2021-11-09 18:21:51 -05:00
Luke Van Seters
7b60488f76 Support async for listener 2021-11-09 11:51:43 -05:00
Luke Van Seters
e0d6919039 Pass DB session into the inspector 2021-11-09 10:49:08 -05:00
Luke Van Seters
c94b2523c1 Merge pull request #121 from flashbots/listener-fix
Fix mev listener
2021-11-09 09:25:05 -05:00
Luke Van Seters
91ff886ecf Fix listener command 2021-11-08 12:09:19 -05:00
Luke Van Seters
fd1deae50d Merge pull request #119 from flashbots/add-pokt-readme
Add Pokt recommendation to the README
2021-11-04 12:44:45 -04:00
Luke Van Seters
6c4409be75 free => hosted 2021-11-03 16:21:39 -04:00
Luke Van Seters
66a4089790 Add pokt recommendation to the readme 2021-11-03 16:20:38 -04:00
Luke Van Seters
45a536cd15 Change miner payments and transfers tables to begin with block number 2021-11-03 12:47:56 -04:00
Luke Van Seters
674565f789 Change classified traces primary key to include block number 2021-11-02 18:40:43 -04:00
Luke Van Seters
c38d77504e Reindex swaps by block number 2021-11-02 17:29:45 -04:00
Luke Van Seters
b5a9bed2d4 Merge pull request #116 from flashbots/cache-field-remove
Remove unused cache field
2021-11-02 15:59:13 -04:00
Luke Van Seters
d4a0541391 Add mev exec to execute a command on the inspect pod 2021-11-02 14:31:47 -04:00
Luke Van Seters
e9d71f62bf Remove unused cache field 2021-11-02 14:27:07 -04:00
Luke Van Seters
c436c6480e Merge pull request #109 from carlomazzaferro/asyncio-backfilling
asyncio-based backfilling
2021-11-01 12:04:43 -04:00
carlomazzaferro
0cb62e4c55 Merge remote-tracking branch 'upstream/main' into asyncio-backfilling 2021-10-30 00:16:20 +01:00
carlomazzaferro
a6bf834e76 address PR comments 2021-10-30 00:15:23 +01:00
Gui Heise
a1b001b2cf Merge pull request #114 from flashbots/ETHTransferLiquidations
Add support for ETH-Transfer liquidations
2021-10-28 15:51:01 +01:00
Gui Heise
c6c0cb5511 Remove optional 2021-10-28 15:48:20 +01:00
carlomazzaferro
36111abf69 Use inspector class -- remove global Semaphore and improve error handling 2021-10-28 11:33:33 +01:00
carlomazzaferro
f6719cdfc8 merge commit 2021-10-28 11:15:51 +01:00
carlomazzaferro
c3475bbd8f Use inspector class -- remove global Semaphore and improve error handling 2021-10-28 11:04:24 +01:00
Gui Heise
e25448a9f4 Eth constant 2021-10-28 00:31:39 +01:00
Gui Heise
1ee62bc96b Remove unused elif 2021-10-28 00:20:28 +01:00
Gui Heise
6e9d9b943a Fix transfer conditional 2021-10-28 00:16:39 +01:00
Gui Heise
cf0926fef0 Add ETH_ADDRESS and check against it 2021-10-28 00:15:57 +01:00
Gui Heise
a93f4abf95 Fix tests 2021-10-27 23:55:07 +01:00
Gui Heise
c4dac40bad Delete 2021-10-27 23:53:16 +01:00
Gui Heise
afc4eb4289 Delete 2021-10-27 23:52:38 +01:00
Gui Heise
c0f4da04d8 Test 2021-10-27 23:47:08 +01:00
Luke Van Seters
3521567884 Merge pull request #111 from flashbots/backfill-template-env-2
Add trace DB environment variables to the backfill helm chart
2021-10-27 15:36:33 -04:00
Luke Van Seters
afce3ce9ba Merge pull request #108 from flashbots/backfill-cleanup
Move traces to `traces.py` files
2021-10-27 15:36:16 -04:00
Gui Heise
06615bec95 Merge pull request #113 from flashbots/fetch-block
Add fetch-block command
2021-10-27 18:01:27 +01:00
Gui Heise
a8fbacb7f0 Add block json 2021-10-27 17:27:32 +01:00
Luke Van Seters
30df035d12 Merge pull request #110 from flashbots/readme-mev-2
Update README to use `./mev` commands
2021-10-27 11:21:37 -04:00
Gui Heise
6834dba8fa Add mev command 2021-10-27 15:53:44 +01:00
Gui Heise
f57d8e5be5 Add fetch-block command 2021-10-27 15:47:59 +01:00
Luke Van Seters
132b79ee91 Merge pull request #78 from emlazzarin/arb-fix-4
Adjust arbitrage calculation logic
2021-10-26 12:19:50 -04:00
Gui Heise
7bb65a336e Fix ETH transfer liquidations 2021-10-26 14:09:35 +01:00
Gui Heise
8822ebcf55 ETH transfer WIP 2021-10-25 15:34:46 +01:00
sragss
e29d8bb310 Merge branch 'main' into arb-fix-4 2021-10-22 14:01:08 -07:00
carlomazzaferro
e15eef49c1 async based middleware, better logging and async requests 2021-10-22 13:58:00 +01:00
Gui Heise
ceebea30e3 Add ETH transfer logic 2021-10-22 12:37:06 +01:00
Luke Van Seters
58ab655d89 Specify trace DB credentials in the backfill helm chart 2021-10-21 16:24:43 -04:00
Luke Van Seters
576fe04eb0 Update README.md 2021-10-21 15:54:45 -04:00
Luke Van Seters
18c42a872f Add support for tailing listener logs and inspecting many from the mev command 2021-10-21 15:54:11 -04:00
Luke Van Seters
5897781db8 Update README to add a backfill section 2021-10-21 15:47:24 -04:00
Luke Van Seters
619ed51e49 Update README to use ./mev commands 2021-10-21 15:36:01 -04:00
Luke Van Seters
f523935a79 Merge pull request #100 from elopio/readme
Prettify the README
2021-10-21 15:32:05 -04:00
carlomazzaferro
4f20c540e6 asyncio-based concurrent backfilling 2021-10-20 17:12:21 +01:00
Luke Van Seters
4894f57f13 Add back transaction hash in classified traces 2021-10-19 18:11:33 -04:00
Luke Van Seters
8c6f984b0a transaction hash is optional 2021-10-19 18:01:31 -04:00
Luke Van Seters
d38e027bfa Remove duplicate fields on classified trace 2021-10-19 13:21:39 -04:00
Luke Van Seters
01a27f84c0 Rename classified_traces file to traces. Move Trace to traces 2021-10-19 13:20:01 -04:00
Leo Arias
60f1a651bb Apply review feedback 2021-10-19 16:47:53 +00:00
Leo Arias
ad4acfa043 Add maintainers 2021-10-19 16:37:42 +00:00
Leo Arias
a4c21b765d Fix the issues link 2021-10-19 16:34:14 +00:00
Leo Arias
c36e2445af Link the badge to discord 2021-10-19 16:34:14 +00:00
Leo Arias
53a1afd5f7 Improve format 2021-10-19 16:34:14 +00:00
Leo Arias
f3687c9102 Fix typo 2021-10-19 16:32:39 +00:00
Leo Arias
8e42bede10 Prettify the README. 2021-10-19 16:32:39 +00:00
Luke Van Seters
a5e4a2d1d4 Merge pull request #106 from flashbots/traces-db-access
Use the trace DB for cached blocks
2021-10-18 13:06:54 -04:00
Luke Van Seters
4ae59b8e28 Back to original 2021-10-18 12:58:57 -04:00
Sam Ragsdale
d952287b2d Adjust arbitrage path creation to not depend on pool_address, adjust tests accordingly 2021-10-18 09:29:58 -07:00
Luke Van Seters
063b8764a8 Write classified traces 2021-10-18 12:01:26 -04:00
Luke Van Seters
68232f4161 Fetch all of the block from the DB if possible 2021-10-18 11:33:14 -04:00
Luke Van Seters
a786b74f4a Update listener 2021-10-18 10:47:41 -04:00
Luke Van Seters
dbc7c5d4ae Add credentials to tiltfile. Find traces using traces db 2021-10-18 10:47:41 -04:00
Luke Van Seters
ee5a4905e6 Weave trace db through to fetch 2021-10-18 10:47:41 -04:00
Luke Van Seters
1993f0a14d Add trace DB session 2021-10-18 10:47:41 -04:00
Luke Van Seters
2935df284d Add optional environment variables for TRACE_DB_* 2021-10-18 10:47:41 -04:00
Luke Van Seters
db1b31c0dc Merge pull request #103 from flashbots/backfill-main
Add support for parallelized backfills
2021-10-18 10:46:57 -04:00
Luke Van Seters
03e42ee007 Merge pull request #105 from flashbots/faster-inspect
Small adjustments to speed up inspection
2021-10-18 10:46:35 -04:00
Luke Van Seters
f3b85dc1df Run black 2021-10-16 21:44:07 -04:00
Luke Van Seters
e22d947c1f Bring back black 2021-10-16 19:51:11 -04:00
Luke Van Seters
7f017777d6 Add some small optimizations. Skip compound liquidations for now 2021-10-16 19:50:54 -04:00
Luke Van Seters
8d9f860346 Add some small optimizations. Skip compound liquidations for now 2021-10-16 19:49:38 -04:00
Luke Van Seters
3934004ed4 Turn off black. not working 2021-10-16 19:48:31 -04:00
Taarush Vemulapalli
90afc1b905 Support for Cream markets + tests (#104)
* Support for Cream markets + test

* fixes for WETH/underlying_markets

* has_liquidations helper
2021-10-16 10:13:39 -07:00
Gui Heise
c6c45b4ab0 Merge pull request #89 from flashbots/aTokens
Add received_token_address to liquidations
2021-10-15 11:49:14 -04:00
Gui Heise
1354de8d4a Remove print statement 2021-10-15 10:11:45 -04:00
Gui Heise
54b0e93b10 Edit payback function type hint 2021-10-15 10:09:44 -04:00
Luke Van Seters
a9263d6008 Merge pull request #102 from flashbots/helm-2
Migrate our kube to helm
2021-10-14 17:42:24 -04:00
Luke Van Seters
af75fbc35a Add backfill scripts 2021-10-14 17:41:57 -04:00
Gui Heise
b06b3bc733 Fix classifier 2021-10-14 17:23:55 -04:00
Luke Van Seters
1818aafbd7 Make job names random 2021-10-14 17:04:32 -04:00
Gui Heise
e11f5b6741 Resolve merge conflicts 2021-10-14 16:47:09 -04:00
Luke Van Seters
2de620ea4e Add a chart for backfill jobs 2021-10-14 16:16:35 -04:00
Luke Van Seters
9e41f316cb Add replica count back. Remove tag from image 2021-10-13 18:13:46 -04:00
Luke Van Seters
1d3543c982 Update README for new helm name 2021-10-13 17:25:11 -04:00
Luke Van Seters
24951891ca Merge pull request #101 from flashbots/mev-backfill
Add `mev` command for easy inspect use
2021-10-13 17:24:07 -04:00
Luke Van Seters
369e956db6 Remove old app.yaml 2021-10-13 17:23:38 -04:00
Luke Van Seters
8f8dd11af3 Remove chartg 2021-10-13 17:20:10 -04:00
Luke Van Seters
3c40faf310 Move to helm charts 2021-10-13 17:08:54 -04:00
Luke Van Seters
2e921f2685 Add db command. Update Tiltfile / app to store DB host in secrets 2021-10-13 14:55:53 -04:00
Luke Van Seters
0ddb0104af Add some echos. Add backfill 2021-10-13 14:21:30 -04:00
Luke Van Seters
7d66bce9ee Add mev script 2021-10-13 14:14:10 -04:00
Luke Van Seters
561f8c3450 new script who dis 2021-10-13 14:07:50 -04:00
Gui Heise
588b41333d Add Aave transfer classifiers 2021-10-13 12:57:14 -04:00
Gui Heise
7d9d9af120 aToken test 2021-10-13 12:01:39 -04:00
Gui Heise
cf7836896b Aave transfers 2021-10-13 12:01:39 -04:00
Gui Heise
fc5ccc9b9b Aave transfers 2021-10-13 11:58:37 -04:00
Gui Heise
f5b4e87c4c Fixed ABI 2021-10-13 11:55:28 -04:00
Gui Heise
1c786357a4 Minor fixes 2021-10-13 11:55:28 -04:00
Gui Heise
a75bc69366 aTokens classifer spec 2021-10-13 11:55:28 -04:00
Gui Heise
d422b88bba aTokens ABI 2021-10-13 11:55:28 -04:00
Gui Heise
a1bdb3b9b8 Remove test 2021-10-13 11:55:28 -04:00
Gui Heise
003106194f Removed broken test 2021-10-13 11:55:28 -04:00
Gui Heise
a704ab2fe3 aToken blocks 2021-10-13 11:55:28 -04:00
Gui Heise
4c889f813c Payback function output order 2021-10-13 11:53:47 -04:00
Gui Heise
4c203da24e Adjust payback function name and migratiop drop to column 2021-10-13 11:53:47 -04:00
Gui Heise
ccd17c5585 Adjust liquidator payback logic 2021-10-13 11:53:47 -04:00
Gui Heise
b997d0fbd1 Remove nullable 2021-10-13 11:53:47 -04:00
Gui Heise
aa5a72b189 Add received_token_address to liquidation object 2021-10-13 11:53:47 -04:00
Gui Heise
f84d192053 Adjust migration to add column 2021-10-13 11:53:47 -04:00
Gui Heise
45b1790f75 Add migration 2021-10-13 11:53:47 -04:00
Gui Heise
a38b9d2ce2 Change return type 2021-10-13 11:53:47 -04:00
Gui Heise
dbcb26d2ca Add aToken lookup logic 2021-10-13 11:53:47 -04:00
Luke Van Seters
e785dd0b25 Merge pull request #96 from flashbots/eth-transfers-eeee
Remove ETH / ERC20 transfer distinction
2021-10-13 10:24:36 -04:00
Taarush Vemulapalli
ed83b49091 Compound
* compound v2 + tests
2021-10-13 07:19:52 -07:00
Gui Heise
9758005a80 aToken test 2021-10-13 01:07:31 -04:00
Gui Heise
b2de07407c Aave transfers 2021-10-13 00:53:14 -04:00
Gui Heise
5e111dd5b2 Aave transfers 2021-10-13 00:38:05 -04:00
Luke Van Seters
2a852746fe Only get eth transfer if only transfering eth 2021-10-12 20:17:50 -04:00
Luke Van Seters
3950a9c809 Handle ETH transfers in swaps 2021-10-12 20:13:59 -04:00
Luke Van Seters
6de8f494c4 get => build 2021-10-12 20:13:59 -04:00
Luke Van Seters
9df6dfdf5b Build => get 2021-10-12 20:13:59 -04:00
Luke Van Seters
378f5b248e Remove ETH / ERC20 transfer distinction 2021-10-12 20:13:59 -04:00
Gui Heise
e5506c1bf6 Fixed ABI 2021-10-12 17:11:05 -04:00
Gui Heise
c68f2c87e3 Minor fixes 2021-10-12 16:42:35 -04:00
Gui Heise
d2a91775de aTokens classifer spec 2021-10-12 14:19:07 -04:00
Gui Heise
afd65aaac0 aTokens ABI 2021-10-12 14:06:11 -04:00
Gui Heise
e77fa51db0 Remove test 2021-10-12 13:37:49 -04:00
Gui Heise
fd5cbce43e Removed broken test 2021-10-12 13:35:37 -04:00
Gui Heise
025d5b9d2b aToken blocks 2021-10-12 13:34:08 -04:00
Robert Miller
f7fbd97a50 Merge pull request #99 from flashbots/curve-swaps-2
Add support for Curve swaps
2021-10-12 13:26:19 -04:00
Luke Van Seters
e3b360ec39 Fix swap tests 2021-10-12 12:23:47 -04:00
Luke Van Seters
547b51df92 Add swap support for curve 2021-10-12 12:19:24 -04:00
Luke Van Seters
0c4f605229 Write protocol for swaps 2021-10-12 12:19:09 -04:00
Luke Van Seters
1c1b80721c Merge pull request #94 from elopio/issue/tuple
decode: collapse tuples
2021-10-12 08:19:34 -07:00
Luke Van Seters
ed463ad979 Merge pull request #98 from flashbots/lag-block-listener
Lag the block listener 5 blocks
2021-10-12 08:18:59 -07:00
Luke Van Seters
d76bb52016 Lag the block listener 5 blocks 2021-10-11 16:00:58 -07:00
Luke Van Seters
b5f625112e Merge pull request #97 from flashbots/pre-commit-pr-fix
Add --all-files to pre-commit GH action
2021-10-11 15:53:10 -07:00
Luke Van Seters
b8ff6f0e8b run --all-files 2021-10-11 15:48:36 -07:00
Luke Van Seters
2377222750 Add --all-files to pre-commit GH aciton 2021-10-11 15:45:55 -07:00
Leo Arias
ba73f58396 Run precommit 2021-10-11 17:51:38 +00:00
Leo Arias
a67769cea3 Run precommit 2021-10-11 17:31:23 +00:00
Leo Arias
4e5ad64929 decode: collapse tuples 2021-10-11 01:49:37 +00:00
Luke Van Seters
b6fc27b3f6 rename get_transfers => get_erc20_transfers 2021-10-08 12:24:43 -04:00
Luke Van Seters
afcff7c845 Merge pull request #92 from flashbots/swaps-classifier
Use SwapClassifier for decoding Swap objects
2021-10-08 11:47:27 -04:00
Luke Van Seters
a1fd035de8 Update tests 2021-10-08 11:37:12 -04:00
Luke Van Seters
3039f3eed2 Use SwapClassifier for Swap objects 2021-10-08 11:37:12 -04:00
Luke Van Seters
8c6d7ab889 Merge pull request #90 from flashbots/specs-v2
Group classifying a trace as a `transfer` with the logic to decode a `Transfer` object
2021-10-08 11:36:39 -04:00
Luke Van Seters
e3eb858ed9 Fail at runtime if not implemented 2021-10-06 16:43:04 -04:00
Luke Van Seters
058cbeed94 Fix tests for decoded call trace 2021-10-06 16:00:17 -04:00
Luke Van Seters
f1379cc0a0 Switch to class instead of instance 2021-10-06 15:56:28 -04:00
Luke Van Seters
02c9c1cddc Add transfer parsing to transfer classifiers 2021-10-06 15:28:50 -04:00
Luke Van Seters
86ee26dd1a Make Classifier a union 2021-10-06 15:14:24 -04:00
Luke Van Seters
d57a2d021d Add specific classifiers for each type 2021-10-06 15:12:44 -04:00
Luke Van Seters
621a2798c8 No burn 2021-10-06 14:55:00 -04:00
Luke Van Seters
d2c397f212 Change classifications => classifiers 2021-10-06 14:53:38 -04:00
Gui Heise
f8f8c488d7 Payback function output order 2021-10-06 13:33:43 -04:00
Gui Heise
67c31883c3 Adjust payback function name and migratiop drop to column 2021-10-06 02:19:13 -04:00
Gui Heise
d7be215bb9 Adjust liquidator payback logic 2021-10-05 16:27:50 -04:00
Luke Van Seters
8a94eeaf39 Add .envrc to gitignore 2021-10-05 12:43:43 -04:00
Gui Heise
5274619081 Remove nullable 2021-10-05 12:29:23 -04:00
Gui Heise
ad19ce913f Add received_token_address to liquidation object 2021-10-05 12:23:06 -04:00
Luke Van Seters
3c761d85f8 Merge pull request #88 from elopio/typos/readme
Fix typos in README
2021-10-05 10:22:49 -04:00
Leo Arias
e75a2919cd Fix typos in README 2021-10-05 04:38:48 +00:00
Gui Heise
66e36a6407 Adjust migration to add column 2021-10-04 18:59:58 -04:00
Gui Heise
fa20c2e650 Add migration 2021-10-04 16:21:06 -04:00
Gui Heise
4ac4b2c601 Change return type 2021-10-04 15:40:40 -04:00
Gui Heise
6bd1e1905b Add aToken lookup logic 2021-10-04 09:25:25 -04:00
Gui Heise
7dbbd9f545 Merge pull request #86 from flashbots/liquidation-models
Add liquidation models
2021-10-01 18:06:13 -04:00
Gui Heise
77b17cab94 Make trace address a primary key 2021-10-01 17:59:11 -04:00
Luke Van Seters
f9c3431854 Merge pull request #84 from flashbots/aave-db
Add database migration for liquidations
2021-10-01 13:01:09 -04:00
Robert Miller
4834d068f6 Merge pull request #74 from flashbots/aave-v0
Add AAVE liquidations to inspect_block
2021-09-30 13:58:37 -04:00
Gui Heise
eb720dee16 Remove print 2021-09-30 11:48:05 -04:00
Gui Heise
4dbcb59b4d Add trace address to liquidations 2021-09-30 11:48:05 -04:00
Gui Heise
1560ee9a99 Add liquidations model/crud 2021-09-30 11:48:05 -04:00
Gui Heise
cac1b13ac7 Database migration for liquidations 2021-09-30 11:46:55 -04:00
Gui Heise
cc41cbe1ef Update liquidation_test.py 2021-09-30 11:09:27 -04:00
Gui Heise
d54ab01046 Update inspect_block.py 2021-09-30 11:05:32 -04:00
Gui Heise
a86fa44717 Update aave_liquidations.py 2021-09-30 11:04:10 -04:00
Luke Van Seters
e6f5ece46f Update README.md 2021-09-29 12:40:49 -04:00
Gui Heise
7dbf4a9e0e Database migration for liquidations 2021-09-29 10:24:46 -04:00
Gui Heise
eb9edc914e Names 2021-09-29 09:43:06 -04:00
Gui Heise
f48d373cf3 Function naming 2021-09-29 09:43:06 -04:00
Gui Heise
d348490ce5 index 2021-09-29 09:43:06 -04:00
Gui Heise
35f12ed4a8 Naming 2021-09-29 09:43:06 -04:00
Gui Heise
3047d207cc Add assertion function 2021-09-29 09:43:06 -04:00
Gui Heise
db6feab697 Removed dir 2021-09-29 09:43:06 -04:00
Gui Heise
54fb7713a0 Change tests from unittest to pytest 2021-09-29 09:43:06 -04:00
Gui Heise
e135830b5d Multiple liquidations tests 2021-09-29 09:43:06 -04:00
Gui Heise
07763e0e3c Load blocks from cache in tests 2021-09-29 09:43:06 -04:00
Luke Van Seters
a3bcc7e3bb Add tests 2021-09-29 09:43:06 -04:00
Gui Heise
356735dc5f Export order and function updates 2021-09-29 09:43:06 -04:00
Gui Heise
536c01c7f9 Remove comments and prints 2021-09-29 09:43:06 -04:00
Gui Heise
0382618724 Add transfers and simplify children 2021-09-29 09:43:06 -04:00
Gui Heise
0288c339d1 Remove liquidation data 2021-09-29 09:43:06 -04:00
Gui Heise
887d8c0a6a Function for child liquidation check 2021-09-29 09:43:06 -04:00
Gui Heise
052e1f6c8d Parent liquidations type 2021-09-29 09:43:06 -04:00
Gui Heise
882af3e42f Remove .remove() and add unique parent trace check 2021-09-29 09:43:06 -04:00
Gui Heise
bdcaaa9bf7 Turned received amount logic to function 2021-09-29 09:43:06 -04:00
Gui Heise
36e90f295f Updated find_liquidator_payback to bool 2021-09-29 09:43:06 -04:00
Gui Heise
e57f754bfe Cleanup 2021-09-29 09:43:06 -04:00
Gui Heise
5b8072b271 Simplify logic for liquidator payback 2021-09-29 09:43:06 -04:00
Gui Heise
b215a1d9b2 Remove try, update transfer_to keys, add child trace parsing and removal 2021-09-29 09:43:06 -04:00
Gui Heise
8b5d1327a8 Remove unused and try 2021-09-29 09:43:06 -04:00
Gui Heise
aedd6696b4 Cleanup 2021-09-29 09:43:06 -04:00
Gui Heise
8385bb676b Add received amount calculations and update functions 2021-09-29 09:43:06 -04:00
Gui Heise
faa8d09312 Transfer function cleanup 2021-09-29 09:43:05 -04:00
Gui Heise
02959e68da Add collateral amount initial logic using transfer functions 2021-09-29 09:43:05 -04:00
Gui Heise
e7b3bb4ac7 Redefine transfer functions and add liquidator 2021-09-29 09:43:05 -04:00
Gui Heise
0a770511a4 Add event inputs 2021-09-29 09:43:05 -04:00
Gui Heise
2f9dbeae08 Improve legibility 2021-09-29 09:41:59 -04:00
Gui Heise
0cc259220d Simplify liquidation data logic 2021-09-29 09:41:59 -04:00
Gui Heise
5149840a76 Removed junk data / narrow to inspect_block 2021-09-29 09:41:59 -04:00
Gui Heise
ddce8bfb8a Resolve merge conflicts 2021-09-29 09:41:59 -04:00
Gui Heise
d52ad4b74c Add return type and resolving merge conflivt 2021-09-29 09:41:59 -04:00
Gui Heise
8f79843f3f Add types to lists 2021-09-29 09:41:59 -04:00
Gui Heise
bf3ca0f529 Tighten PR 2021-09-29 09:41:59 -04:00
Gui Heise
356e8f6c86 Remove unused logic/ minor fixes 2021-09-29 09:41:59 -04:00
Gui Heise
173d16c2bc Add docstrings to new functions 2021-09-29 09:41:59 -04:00
Gui Heise
2ce4badf65 Assignment of transfer lists 2021-09-29 09:41:59 -04:00
Gui Heise
4bba2f793a Add logic to functions and introduce transfer logic 2021-09-29 09:41:59 -04:00
Gui Heise
a1d06ce114 Remove unused imports, improve variable names 2021-09-29 09:41:59 -04:00
Gui Heise
563935d5b4 Added Aave liquidation to inspect_block 2021-09-29 09:41:59 -04:00
Gui Heise
8f51f4e87c Resolve merge conflicts 2021-09-29 09:41:59 -04:00
Gui Heise
f272f11c81 Add return type and resolving merge conflivt 2021-09-29 09:41:59 -04:00
Gui Heise
8d1242f760 Add types to lists 2021-09-29 09:41:59 -04:00
Gui Heise
e93a78b8ce Tighten PR 2021-09-29 09:41:59 -04:00
Gui Heise
7f93466b35 Remove unused logic/ minor fixes 2021-09-29 09:41:59 -04:00
Gui Heise
fededa9cad Add docstrings to new functions 2021-09-29 09:41:59 -04:00
Gui Heise
7dea90d5c7 Assignment of transfer lists 2021-09-29 09:41:59 -04:00
Gui Heise
c1328e312f Add logic to functions and introduce transfer logic 2021-09-29 09:41:59 -04:00
Gui Heise
82a6c72f6a Remove unused imports, improve variable names 2021-09-29 09:41:59 -04:00
Gui Heise
91428d491c Added Aave liquidation to inspect_block 2021-09-29 09:41:59 -04:00
Luke Van Seters
8f0b295956 Merge pull request #80 from flashbots/log-to-stdout
Log to stdout for the CLI
2021-09-29 09:00:26 -04:00
Luke Van Seters
9f1e6c12fa Merge pull request #82 from wardbradt/patch-1
fix broken link
2021-09-28 22:54:25 -04:00
Ward Bradt
f0526c1012 fix broken link 2021-09-28 22:30:17 -04:00
Luke Van Seters
ebc161aa51 Merge pull request #81 from flashbots/readme-updates
Update README to include helm, setup for kind, and postgres info
2021-09-23 13:42:45 -04:00
Luke Van Seters
f2ce697175 Add instructions on connecting to Postgres 2021-09-23 12:04:27 -04:00
Luke Van Seters
58a7409568 Add Docker to README 2021-09-23 11:47:21 -04:00
Luke Van Seters
e56458c908 Add kubectl to README 2021-09-23 11:46:33 -04:00
Luke Van Seters
3bba682c58 Remove platform from Tiltfile 2021-09-23 11:42:34 -04:00
Luke Van Seters
54cd815514 Update README with install helm and create kind cluster 2021-09-23 11:42:21 -04:00
Luke Van Seters
9c170a3f00 Log to stdout for the CLI 2021-09-22 10:40:06 -04:00
Robert Miller
0f23046733 Merge pull request #76 from flashbots/readme-kube-4
Update README to use Kubernetes setup - Remove docker compose
2021-09-20 17:21:00 -05:00
Robert Miller
e5e4f6ef1b Merge pull request #75 from flashbots/dont-start-run-by-default
Don't start block listener on container start
2021-09-20 17:19:36 -05:00
Luke Van Seters
18e45ee437 Lower weth address 2021-09-20 13:28:16 -04:00
Luke Van Seters
747dc5dfe1 Remove some old config files 2021-09-20 13:25:21 -04:00
Luke Van Seters
576f7dc507 Don't ignore tests. Run tests int he container 2021-09-20 13:22:04 -04:00
Luke Van Seters
86fdeddfaa Not used 2021-09-20 13:21:24 -04:00
Luke Van Seters
00c97ffe72 Better instructions for switching from docker compose 2021-09-20 13:15:18 -04:00
Luke Van Seters
7b036cc620 Add stars 2021-09-20 13:12:35 -04:00
Luke Van Seters
0afc1494f1 Add tests to README 2021-09-20 13:11:13 -04:00
Luke Van Seters
52679cd3cc Update actions to call tests directly 2021-09-20 13:09:14 -04:00
Luke Van Seters
37cf615c75 Update README for more interesting blocks 2021-09-20 13:06:33 -04:00
Luke Van Seters
4d5c8977c1 Remove docker compose and old poetry scripts 2021-09-20 13:04:37 -04:00
Luke Van Seters
036228036d Bold parity 2021-09-20 12:57:28 -04:00
Luke Van Seters
663a97e84f Fix spacing 2021-09-20 12:56:17 -04:00
Luke Van Seters
be9ae86d5c Update README for Kube 2021-09-20 12:54:08 -04:00
Luke Van Seters
5682c2ce4e Break out block listener to a start / stop daemon instead of running on startup 2021-09-20 12:31:27 -04:00
Robert Miller
5756a7c405 Merge pull request #72 from flashbots/write-transfers-2
Write transfers to transfers table on inspect
2021-09-20 10:34:07 -05:00
Robert Miller
1027a3ecbc Merge pull request #73 from emlazzarin/main
Balancer v1 classifier / abis
2021-09-20 10:23:09 -05:00
Luke Van Seters
f5ce06b008 Fix tests 2021-09-20 11:22:38 -04:00
Luke Van Seters
8686166276 Add writing transfers to inspect block 2021-09-20 11:22:37 -04:00
Luke Van Seters
2b7c8532f2 Add crud and models to write transfers to the DB 2021-09-20 11:20:56 -04:00
Luke Van Seters
d37bf8f6e2 Add block number to transfers schema 2021-09-20 11:20:56 -04:00
Robert Miller
f395e9758f Merge pull request #69 from flashbots/tilt-deps-2
Make mev-inspect require that the DB is already up for local dev
2021-09-20 10:19:48 -05:00
Luke Van Seters
516664e6ab Rebase 2021-09-20 11:11:44 -04:00
Robert Miller
3ff4af2970 Merge pull request #71 from flashbots/write-transfers
Add DB migration to create transfers table
2021-09-20 10:08:49 -05:00
Robert Miller
f7ffbfadb1 Merge pull request #66 from flashbots/inspect-listener
Poll for incoming blocks and auto-inspect them
2021-09-20 10:07:31 -05:00
Sam Ragsdale
ed63b6bb38 Balancer v1 classifier / abis 2021-09-17 15:13:21 -07:00
Luke Van Seters
266a66be03 Add DB migration to create transfers table 2021-09-17 09:29:16 -04:00
Luke Van Seters
b8280f8464 Sleep first to get newest block after sleep 2021-09-17 09:20:17 -04:00
Luke Van Seters
a9cbe106ad Use a dedicated table for the last block written. Write new blocks as they come 2021-09-17 09:20:17 -04:00
Luke Van Seters
50d04a0b42 Use last written miner payment block as max written block 2021-09-17 09:20:17 -04:00
Luke Van Seters
e6793ee053 Add configmap for RPC. Print latest block on loop 2021-09-17 09:20:17 -04:00
Luke Van Seters
0db24349fd print => logging 2021-09-17 09:20:17 -04:00
Luke Van Seters
7a53816d74 Add auto-restart of process. Add GracefulKiller 2021-09-17 09:20:17 -04:00
Luke Van Seters
e92c36d30a Move DB session out 2021-09-17 09:20:17 -04:00
Luke Van Seters
66c22682e8 Get empty list default for miner payments 2021-09-17 09:20:17 -04:00
Luke Van Seters
768de19b60 Move inspect block logic into mev_inspect module from script 2021-09-17 09:20:17 -04:00
Luke Van Seters
e365a2c0c0 Move inspect block logic into mev_inspect module from script 2021-09-17 09:20:17 -04:00
Luke Van Seters
4993bbc8e0 Create cache dir if not exists 2021-09-17 09:20:17 -04:00
Luke Van Seters
bff71b01c3 Merge pull request #70 from flashbots/call-trace-db
Add stricter types to trace classifier
2021-09-16 14:55:28 -06:00
Robert Miller
aed8310cb1 Merge pull request #68 from flashbots/add-block-number-index-again
Add an index on block number for miner payments
2021-09-16 12:43:50 -05:00
Robert Miller
c51d907655 Merge pull request #65 from flashbots/backoff-retry
Add middleware to retry with backoff
2021-09-16 12:42:52 -05:00
Gui Heise
1b0e05ec2f syntax 2021-09-16 11:58:36 -04:00
Gui Heise
fbb0ebaffe Syntax fix 2021-09-16 11:57:16 -04:00
Gui Heise
7e7bd5bc07 Removed action and subtraces arguments from helpers 2021-09-16 11:36:35 -04:00
Gui Heise
230a07f47d Simplified serialization 2021-09-16 11:28:18 -04:00
Gui Heise
cc9f3e993d Fixed helpers default attrs 2021-09-16 11:20:28 -04:00
Gui Heise
034b72c463 Updated comments 2021-09-16 11:11:05 -04:00
Gui Heise
71b7c99c17 Added pydantic serialization, naming changes 2021-09-16 11:08:16 -04:00
Gui Heise
170ab07e2f Delete get_helm.sh 2021-09-16 10:18:40 -04:00
Gui Heise
f204620fea Fixed inputs serialization 2021-09-14 14:32:48 -04:00
Luke Van Seters
bf79c7e0be Add an index on block number for miner payments 2021-09-14 12:27:17 -04:00
Luke Van Seters
dd7088912a Add table to track the most recently updated block 2021-09-14 11:57:08 -04:00
Gui Heise
3795336fd8 WIP: Fixed db writing (no inputs) 2021-09-13 16:58:50 -04:00
Robert Miller
5a4308e562 Merge pull request #64 from flashbots/kube2
Add support for running mev-inspect on local kubernetes
2021-09-13 15:29:56 -05:00
Gui Heise
8281d123ab WIP: Fix DB writing 2021-09-13 15:28:51 -04:00
Luke Van Seters
e7d918f514 Add backoff to http retry middleware 2021-09-11 14:35:09 -06:00
Luke Van Seters
b2d2c7dbeb Switch CMD to python loop. Make host an environment variable 2021-09-11 09:50:33 -06:00
Luke Van Seters
23d03b990d Fix indent on liveness probe 2021-09-10 07:40:06 -06:00
Gui Heise
fe6cd4dcdb Added type changes to tests 2021-09-09 14:18:27 -04:00
Luke Van Seters
014b80312c Set secrets via Tiltfile 2021-09-09 09:01:36 -06:00
Luke Van Seters
947d2a0064 Add inspect many blocks 2021-09-09 08:00:53 -06:00
Luke Van Seters
0ae93db617 Fix alembic migrations for kube 2021-09-09 07:52:33 -06:00
Luke Van Seters
144ed63381 Get local postgres working on kube 2021-09-09 07:49:29 -06:00
Luke Van Seters
bc25cf1eba Get container running on kubernetes / tilt 2021-09-03 09:55:21 -04:00
Robert Miller
bed1fd77d7 Merge pull request #62 from flashbots/zero_ex
Rename zerox => zero_ex
2021-09-03 13:26:50 +00:00
Luke Van Seters
36c6734afa zerox => zero_ex 2021-09-03 08:46:45 -04:00
Robert Miller
a77e2d7671 Merge pull request #61 from flashbots/0x-contracts
Add 0x contracts
2021-09-02 23:31:48 +00:00
Luke Van Seters
fbd84fddd0 Move ABIs to the right spot 2021-09-02 18:08:02 -04:00
Luke Van Seters
3e90b94e50 Add UniswapV3 callbacks 2021-09-02 18:06:17 -04:00
Luke Van Seters
2e97193efd Add 0x feature ABIs 2021-09-02 17:46:43 -04:00
Luke Van Seters
f9ecea9d86 Add zerox to classifier specs list. Load all specs from trace classifier 2021-09-02 10:53:38 -04:00
Luke Van Seters
70d0502ac4 Add them to the final list 2021-09-02 10:41:02 -04:00
Luke Van Seters
f5f4e75f7d Add ABIs for 0x 2021-09-02 10:40:22 -04:00
Robert Miller
0f3070a08a Merge pull request #60 from flashbots/miner-db
Write miner payments to the DB
2021-08-31 17:13:32 +00:00
Luke Van Seters
9846b9f16c Add to and from addresses 2021-08-30 20:09:01 -04:00
Luke Van Seters
1aa5c5b465 Write miner payments to the DB in script run 2021-08-30 18:02:36 -04:00
Luke Van Seters
9769498c9d Add crud for miner payments 2021-08-30 13:49:40 -04:00
Luke Van Seters
f5222c1902 Swap => MinerPayment 2021-08-30 13:48:35 -04:00
Luke Van Seters
c22cab0b68 Add miner_payments model 2021-08-30 13:47:37 -04:00
Luke Van Seters
acb68dfcff Add miner_payments table 2021-08-30 13:45:34 -04:00
Robert Miller
acdb463bcc Merge pull request #58 from flashbots/miner-payment
Add miner payments
2021-08-30 12:17:19 +00:00
Luke Van Seters
b0bb2b3dd7 Fix tests 2021-08-27 18:40:56 -04:00
Luke Van Seters
fcdfad7963 Add support for base fee 2021-08-27 18:40:56 -04:00
Luke Van Seters
1aabb12105 Upgrade web3.py 2021-08-27 18:40:56 -04:00
Luke Van Seters
ae2c9886db Pass w3 into create block 2021-08-27 18:40:56 -04:00
Luke Van Seters
9d364b5804 Rename 2021-08-27 18:40:55 -04:00
Luke Van Seters
0e6cd420ec Return to default printing. Add option to print miner payments 2021-08-27 18:40:55 -04:00
Luke Van Seters
a960d5e4cf Add gas payment to miner payments 2021-08-27 18:40:55 -04:00
Luke Van Seters
919bdeb7a2 Use get_traces_by_transaction_hash in swaps too 2021-08-27 18:40:55 -04:00
Luke Van Seters
4a35a07a1c Pass receipts in. Have get_traces_by_transaction_hash return a dict 2021-08-27 18:40:55 -04:00
Luke Van Seters
c48031e190 Update test blocks 2021-08-27 18:40:55 -04:00
Luke Van Seters
e7c1799fd7 Return an iterator of lists instead 2021-08-27 18:40:55 -04:00
Luke Van Seters
f4bba7c885 Run grouped by transaction 2021-08-27 18:40:55 -04:00
Luke Van Seters
0b74331235 Add support for ETH transfers to miner 2021-08-27 18:40:55 -04:00
Luke Van Seters
54ebe78460 Add miner to block data 2021-08-27 18:40:55 -04:00
Luke Van Seters
909ed21a54 Add EthTransfer. Make both derive from Transfer 2021-08-27 18:40:55 -04:00
Luke Van Seters
f35a727b36 Rename Transfer to ERC20Transfer 2021-08-27 18:40:55 -04:00
Robert Miller
bf6d5d2861 Update README.md 2021-08-27 22:13:25 +00:00
Robert Miller
0d10b10338 Merge pull request #57 from flashbots/remove-unused-block-data
Remove unused block data
2021-08-25 17:40:03 -04:00
Robert Miller
c7054aa447 Merge pull request #56 from flashbots/block-receipts
Add an object for block receipts
2021-08-25 17:12:50 -04:00
Luke Van Seters
7af5762f3b Remove unused block data 2021-08-25 11:00:12 -04:00
Gui Heise
2db5794cde Merge pull request #54 from flashbots/docker-compose
Minor fix to poetry
2021-08-23 17:48:45 -04:00
Gui Heise
95862d2f6b Removed docker compose CLI usage 2021-08-23 16:58:56 -04:00
Luke Van Seters
3587d0bd42 Fix tokenflow and tests 2021-08-23 16:17:29 -04:00
Luke Van Seters
98af6aa5f9 Add fields to receipt 2021-08-23 15:50:52 -04:00
Luke Van Seters
af9233c5bc Add placeholder object for receipt 2021-08-23 13:54:51 -04:00
Robert Miller
1c9abd0801 Merge pull request #51 from flashbots/swap-errors
Save errors on swaps in the database
2021-08-23 06:56:21 -07:00
Robert Miller
77f58e342a Merge pull request #53 from flashbots/postgres-ports
Expose Postgres ports locally
2021-08-23 06:55:32 -07:00
Luke Van Seters
ef60c09771 Expose Postgres ports locally 2021-08-23 08:40:25 -04:00
Luke Van Seters
6e4ebbf814 Merge pull request #44 from pmdaly/curve-trace
Curve trace
2021-08-19 12:29:02 -04:00
pmdaly
3306ee2f1b Merge branch 'main' into curve-trace 2021-08-17 08:36:27 -07:00
Patrick Daly
6ceedbf9af aave, erc20, weth moved into separated specs 2021-08-16 23:49:03 -07:00
Patrick Daly
cdf8265de9 no immediate need to get gas / tx, faster block loading w/o 2021-08-16 22:26:09 -07:00
Luke Van Seters
24e682c9d7 Save errors on swaps in the database 2021-08-17 00:01:14 -04:00
Patrick Daly
2da691c686 merged swapUSDN and swapUSDK into a single abi 2021-08-16 17:56:50 -07:00
Robert Miller
d677e0b6ed Merge pull request #50 from flashbots/add-protocol-to-stats
Add protocol to the stats output of inspect block
2021-08-16 16:27:09 -04:00
Robert Miller
a9d8979151 Merge pull request #49 from flashbots/arb-table
Add DB tables for swaps and arbs + write to them
2021-08-16 16:25:52 -04:00
Luke Van Seters
ea41fe04c3 Add protocol to the stats output of inspect block 2021-08-16 15:28:39 -04:00
Patrick Daly
92dbddec2c merging DepositUSDN/K/P into DepositUSD 2021-08-13 14:31:33 -07:00
Patrick Daly
aacaf88ed8 link stable abi should be correctly associated now 2021-08-13 14:20:19 -07:00
Patrick Daly
e4f47c0e42 correcting an import path 2021-08-13 14:14:14 -07:00
Patrick Daly
4e4427b059 changed ordering of the specs to prefer contract level classification 2021-08-13 13:30:39 -07:00
Patrick Daly
0748a5f988 correcting abi filename 2021-08-13 12:51:45 -07:00
Patrick Daly
886813b935 curve meta pool swap abis 2021-08-13 12:51:45 -07:00
Patrick Daly
8ab68606fb curve meta pool deposit abis 2021-08-13 12:51:45 -07:00
Patrick Daly
ca8ce87e5c curve deposit abis added 2021-08-13 12:51:45 -07:00
Patrick Daly
01fdc17b11 curve tokens and swap abi's added 2021-08-13 12:51:45 -07:00
Patrick Daly
cb29c8a9dc flipped the black script 2021-08-13 12:51:45 -07:00
Patrick Daly
b5fb695578 curve specific stable swaps added 2021-08-13 12:51:45 -07:00
Patrick Daly
d4d2fb0359 consolidating classifier related modules 2021-08-13 12:51:41 -07:00
Patrick Daly
8f554d90da liquidity gauge specs added 2021-08-13 12:46:37 -07:00
Patrick Daly
8df633880f meta pool specs added 2021-08-13 12:46:37 -07:00
Patrick Daly
e3728251f8 base pool specs added 2021-08-13 12:46:37 -07:00
Patrick Daly
d34683cf4b base pool specs added 2021-08-13 12:46:19 -07:00
Luke Van Seters
1ee3203231 Merge pull request #46 from flashbots/transfers-and-swaps
Find arbitrages in a block
2021-08-13 13:44:12 -04:00
Luke Van Seters
596ba0c062 Fix tests 2021-08-13 12:48:53 -04:00
Luke Van Seters
388f780f68 Add support for --no-cache 2021-08-13 12:44:51 -04:00
Luke Van Seters
68f5144959 Protect against decode errors 2021-08-13 12:44:51 -04:00
Luke Van Seters
28081de807 Only attempt to write if any arbitrages 2021-08-13 12:44:51 -04:00
Luke Van Seters
6c727fb1f6 Add support for inspecting a range of blocks 2021-08-13 12:44:51 -04:00
Luke Van Seters
c5dc3aa0f9 Add join table for swaps <=> arbitrages. Write to it 2021-08-13 12:44:51 -04:00
Luke Van Seters
002ef76ecc Store trace addresses as arrays 2021-08-13 12:44:51 -04:00
Luke Van Seters
f9b3c82d2d Write arbitrages to the DB 2021-08-13 12:44:51 -04:00
Luke Van Seters
04767d72f1 Write swaps to the DB. Replace existing ones 2021-08-13 12:44:51 -04:00
Luke Van Seters
fa8da08889 Add swap model 2021-08-13 12:44:51 -04:00
Luke Van Seters
3c3868ef6f Add table for swaps 2021-08-13 12:44:51 -04:00
Luke Van Seters
c994e41f34 Add a little more check 2021-08-13 12:40:56 -04:00
Luke Van Seters
eb2530de45 Add test for a real arb 2021-08-13 12:33:38 -04:00
Luke Van Seters
04ce01eb6b Fix typo 2021-08-13 12:12:33 -04:00
Luke Van Seters
96ead6cc92 Rename remove_inner_transfers => remove_child_transfers_of_transfers 2021-08-13 12:10:28 -04:00
Luke Van Seters
3ece6d1829 Add test for three step arb 2021-08-13 12:10:28 -04:00
Luke Van Seters
d2bf2340a1 Add more detail to arbitrage test 2021-08-13 12:10:28 -04:00
Luke Van Seters
0f12b78e1e Add arbitrage test 2021-08-13 12:10:28 -04:00
Luke Van Seters
eab6164c16 Add tests for swaps 2021-08-13 12:10:28 -04:00
Luke Van Seters
c52edaa609 Break out fixtures. Add tests for transfers 2021-08-13 12:10:28 -04:00
Luke Van Seters
7e831faa39 Add more examples for trace tests 2021-08-13 12:10:28 -04:00
Luke Van Seters
f73a34a5ba Add tests for get_child_traces. Add some helpful fixtures 2021-08-13 12:10:28 -04:00
Luke Van Seters
f59b2b2b82 Test is_child_trace_address 2021-08-13 12:10:28 -04:00
Luke Van Seters
ee7659b044 Pass swaps into arbitrage instead of computing inside 2021-08-13 12:10:28 -04:00
Luke Van Seters
08a0784105 Merge swap parsing into a shared function 2021-08-13 12:10:28 -04:00
Luke Van Seters
70514df025 Add printing arbitrage from inspect_block 2021-08-13 12:10:28 -04:00
Luke Van Seters
8a0d16e754 Add Arbitrage + finding arbitrage from swaps 2021-08-13 12:10:28 -04:00
Luke Van Seters
1061bc3db3 Add Swaps + parsing swaps from traces 2021-08-13 12:10:28 -04:00
Luke Van Seters
4c42407faf Add Transfer schema + parse from trace 2021-08-13 12:10:28 -04:00
Luke Van Seters
162443efd8 Remove nested traces 2021-08-13 12:10:28 -04:00
Luke Van Seters
deea9e28ea Add WETH ABI 2021-08-13 12:10:27 -04:00
Luke Van Seters
374b1dd2b8 Skip committing cache 2021-08-13 12:09:43 -04:00
Luke Van Seters
972b4490bb Merge pull request #48 from flashbots/no-pg-admin
Remove PGAdmin
2021-08-12 12:12:23 -04:00
Luke Van Seters
a1fc445c01 Remove PGAdmin for now - its not helpful 2021-08-12 11:51:55 -04:00
Gui Heise
d53acded79 Merge pull request #45 from flashbots/aave-classifier
Aave classifier
2021-08-11 10:54:16 -04:00
Guilherme Peyrelongue Heise
e8c534927c added liquidate classification 2021-08-03 20:08:59 -04:00
Guilherme Peyrelongue Heise
85feee55bc Aave inspector 2021-08-03 20:06:30 -04:00
Luke Van Seters
f903fff3c9 Merge pull request #43 from flashbots/on-duplicate-update-classified-traces
Replace existing traces when inspecting a block
2021-08-03 16:35:54 -04:00
Luke Van Seters
369570affc Add index on block number to make delete quick 2021-07-30 13:40:45 -04:00
Luke Van Seters
0a09fd4efa Delete all traces for a block before writing in the script 2021-07-30 13:36:46 -04:00
322 changed files with 10006 additions and 47371 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
cache

13
.env
View File

@@ -1,13 +0,0 @@
# Postgres
POSTGRES_SERVER=db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=mev_inspect
# PgAdmin
PGADMIN_LISTEN_PORT=5050
PGADMIN_DEFAULT_EMAIL=admin@example.com
PGADMIN_DEFAULT_PASSWORD=password
# SQLAlchemy
SQLALCHEMY_DATABASE_URI=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_SERVER/$POSTGRES_DB

View File

@@ -51,8 +51,8 @@ jobs:
- name: Run precommit
run: |
poetry run pre-commit
poetry run pre-commit run --all-files
- name: Test with pytest
shell: bash
run: poetry run test
run: poetry run pytest --cov=mev_inspect tests

9
.gitignore vendored
View File

@@ -13,3 +13,12 @@ __pycache__
# coverage
htmlcov
.coverage*
# don't commit cache
cache
# k8s
.helm
# env
.envrc

View File

@@ -18,3 +18,4 @@ repos:
- id: 'mypy'
additional_dependencies:
- 'pydantic'
- 'types-requests'

36
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,36 @@
# Contributing guide
Welcome to the Flashbots collective! We just ask you to be nice when you play with us.
## Pre-commit
We use pre-commit to maintain a consistent style, prevent errors, and ensure test coverage.
To set up, install dependencies through `poetry`:
```
poetry install
```
Then install pre-commit hooks with:
```
poetry run pre-commit install
```
## Tests
Run tests with:
```
kubectl exec deploy/mev-inspect-deployment -- poetry run pytest --cov=mev_inspect tests
```
## Send a pull request
- Your proposed changes should be first described and discussed in an issue.
- Open the branch in a personal fork, not in the team repository.
- Every pull request should be small and represent a single change. If the problem is complicated, split it in multiple issues and pull requests.
- Every pull request should be covered by unit tests.
We appreciate you, friend <3.

View File

@@ -6,14 +6,17 @@ RUN pip install -U pip \
ENV PATH="${PATH}:/root/.poetry/bin"
COPY . /app
COPY ./pyproject.toml /app/pyproject.toml
COPY ./poetry.lock /app/poetry.lock
WORKDIR /app/
# poetry uses virtual env by default, turn this off inside container
RUN poetry config virtualenvs.create false && \
poetry install
COPY . /app
# easter eggs 😝
RUN echo "PS1='🕵️:\[\033[1;36m\]\h \[\033[1;34m\]\W\[\033[0;35m\]\[\033[1;36m\]$ \[\033[0m\]'" >> ~/.bashrc
CMD /bin/bash
ENTRYPOINT [ "poetry" ]
CMD [ "run", "python", "loop.py" ]

291
README.md
View File

@@ -1,104 +1,239 @@
# mev-inspect
A [WIP] Ethereum MEV Inspector in Python managed by Poetry
# mev-inspect-py
## Containers
mev-inspect's local setup is built on [Docker Compose](https://docs.docker.com/compose/)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Discord](https://img.shields.io/discord/755466764501909692)](https://discord.gg/7hvTycdNcK)
By default it starts up:
- `mev-insepct` - a container with the code in this repo used for running scripts
- `db` - a postgres database instance
- `pgadmin` - a postgres DB UI for querying and more (avaiable at localhost:5050)
[Maximal extractable value](https://ethereum.org/en/developers/docs/mev/) inspector for Ethereum, to illuminate the [dark forest](https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest/) 🌲💡
## Running locally
Setup [Docker](https://www.docker.com/products/docker-desktop)
Setup [Poetry](https://python-poetry.org/docs/#osx--linux--bashonwindows-install-instructions)
Given a block, mev-inspect finds:
- miner payments (gas + coinbase)
- tokens transfers and profit
- swaps and [arbitrages](https://twitter.com/bertcmiller/status/1427632028263059462)
- ...and more
Data is stored in Postgres for analysis.
## Install
mev-inspect-py is built to run on kubernetes locally and in production.
### Dependencies
- [docker](https://www.docker.com/products/docker-desktop)
- [kind](https://kind.sigs.k8s.io/docs/user/quick-start), or a similar tool for running local Kubernetes clusters
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
- [helm](https://helm.sh/docs/intro/install/)
- [tilt](https://docs.tilt.dev/install.html)
### Set up
Create a new cluster with:
Install dependencies through poetry
```
poetry install
kind create cluster
```
Start the services (optionally as daemon)
```
poetry run start [-d]
```
Set an environment variable `RPC_URL` to an RPC for fetching blocks.
Apply the latest migrations against the local DB:
```
poetry run exec alembic upgrade head
```
mev-inspect-py currently requires a node with support for Erigon traces and receipts (not geth yet 😔).
Run inspect on a block
```
poetry run inspect -b/--block-number 11931270 -r/--rpc 'http://111.11.11.111:8545/'
```
[pokt.network](pokt.network)'s "Ethereum Mainnet Archival with trace calls" is a good hosted option.
To stop the services (if running in the background, otherwise just ctrl+c)
```
poetry run stop
```
Example:
MEV container can be attached via
```
poetry run attach
```
Running additional compose commands are possible through standard `docker
compose ...` calls. Check `docker compose help` for more tools available
## Executing scripts
Any script can be run from the mev-inspect container like
```
poetry run exec <your command here>
```
For example
```
poetry run exec python examples/uniswap_inspect.py -block_number=123 -rpc='111.111.111'
```
### Poetry Scripts
```bash
# code check
poetry run lint # linting via Pylint
poetry run test # testing and code coverage with Pytest
poetry run isort # fixing imports
poetry run mypy # type checking
poetry run black # style guide
poetry run pre-commit run --all-files # runs Black, PyLint and MyPy
# docker management
poetry run start [-d] # starts all services, optionally as a daemon
poetry run stop # shutsdown all services or just ctrl + c if foreground
poetry run build # rebuilds containers
poetry run attach # enters the mev-inspect container in interactive mode
# launches inspection script
poetry run inspect -b/--block-number 11931270 -r/--rpc 'http://111.11.11.111:8545/'
export RPC_URL="http://111.111.111.111:8546"
```
## Rebuilding containers
After changes to the app's Dockerfile, rebuild with
Next, start all services with:
```
poetry run build
tilt up
```
## Using PGAdmin
Press "space" to see a browser of the services starting up.
1. Go to [localhost:5050](localhost:5050)
On first startup, you'll need to apply database migrations with:
2. Login with the PGAdmin username and password in `.env`
```
./mev exec alembic upgrade head
```
3. Add a new engine for mev_inspect with
- host: db
- user / password: see `.env`
## Usage
### Inspect a single block
Inspecting block [12914944](https://twitter.com/mevalphaleak/status/1420416437575901185):
```
./mev inspect 12914944
```
### Inspect many blocks
Inspecting blocks 12914944 to 12914954:
```
./mev inspect-many 12914944 12914954
```
### Inspect all incoming blocks
Start a block listener with:
```
./mev listener start
```
By default, it will pick up wherever you left off.
If running for the first time, listener starts at the latest block.
Tail logs for the listener with:
```
./mev listener tail
```
And stop the listener with:
```
./mev listener stop
```
### Backfilling
For larger backfills, you can inspect many blocks in parallel using kubernetes
To inspect blocks 12914944 to 12915044 divided across 10 worker pods:
```
./mev backfill 12914944 12915044 10
```
You can see worker pods spin up then complete by watching the status of all pods
```
watch kubectl get pods
```
To watch the logs for a given pod, take its pod name using the above, then run:
```
kubectl logs -f pod/mev-inspect-backfill-abcdefg
```
(where `mev-inspect-backfill-abcdefg` is your actual pod name)
### Exploring
All inspect output data is stored in Postgres.
To connect to the local Postgres database for querying, launch a client container with:
```
./mev db
```
When you see the prompt:
```
mev_inspect=#
```
You're ready to query!
Try finding the total number of swaps decoded with UniswapV3Pool:
```
SELECT COUNT(*) FROM swaps WHERE abi_name='UniswapV3Pool';
```
or top 10 arbs by gross profit that took profit in WETH:
```
SELECT *
FROM arbitrages
WHERE profit_token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
ORDER BY profit_amount DESC
LIMIT 10;
```
Postgres tip: Enter `\x` to enter "Explanded display" mode which looks nicer for results with many columns.
## FAQ
### How do I delete / reset my local postgres data?
Stop the system if running:
```
tilt down
```
Delete it with:
```
kubectl delete pvc data-postgresql-postgresql-0
```
Start back up again:
```
tilt up
```
And rerun migrations to create the tables again:
```
./mev exec alembic upgrade head
```
### I was using the docker-compose setup and want to switch to kube, now what?
Re-add the old `docker-compose.yml` file to your mev-inspect-py directory.
A copy can be found [here](https://github.com/flashbots/mev-inspect-py/blob/ef60c097719629a7d2dc56c6e6c9a100fb706f76/docker-compose.yml)
Tear down docker-compose resources:
```
docker compose down
```
Then go through the steps in the current README for kube setup.
### Error from server (AlreadyExists): pods "postgres-client" already exists
This means the postgres client container didn't shut down correctly.
Delete this one with:
```
kubectl delete pod/postgres-client
```
Then start it back up again.
## Maintainers
- [@lukevs](https://github.com/lukevs)
- [@gheise](https://github.com/gheise)
- [@bertmiller](https://github.com/bertmiller)
## Contributing
Pre-commit is used to maintain a consistent style, prevent errors and ensure test coverage.
[Flashbots](https://flashbots.net) is a research and development collective working on mitigating the negative externalities of decentralized economies. We contribute with the larger free software community to illuminate the dark forest.
Install pre-commit with:
```
poetry run pre-commit install
```
You are welcome here <3.
Update README if needed
- If you want to join us, come and say hi in our [Discord chat](https://discord.gg/7hvTycdNcK).
- If you have a question, feedback or a bug report for this project, please [open a new Issue](https://github.com/flashbots/mev-inspect-py/issues).
- If you would like to contribute with code, check the [CONTRIBUTING file](CONTRIBUTING.md).
- We just ask you to be nice.
## Security
If you find a security vulnerability on this project or any other initiative related to Flashbots, please let us know sending an email to security@flashbots.net.
---
Made with by the ⚡🤖 collective.

50
Tiltfile Normal file
View File

@@ -0,0 +1,50 @@
load("ext://helm_remote", "helm_remote")
load("ext://secret", "secret_from_dict")
load("ext://configmap", "configmap_from_dict")
helm_remote("postgresql",
repo_name="bitnami",
repo_url="https://charts.bitnami.com/bitnami",
set=["postgresqlPassword=password", "postgresqlDatabase=mev_inspect"],
)
k8s_yaml(configmap_from_dict("mev-inspect-rpc", inputs = {
"url" : os.environ["RPC_URL"],
}))
k8s_yaml(configmap_from_dict("mev-inspect-listener-healthcheck", inputs = {
"url" : os.getenv("LISTENER_HEALTHCHECK_URL", default=""),
}))
k8s_yaml(secret_from_dict("mev-inspect-db-credentials", inputs = {
"username" : "postgres",
"password": "password",
"host": "postgresql",
}))
# if using https://github.com/taarushv/trace-db
# k8s_yaml(secret_from_dict("trace-db-credentials", inputs = {
# "username" : "username",
# "password": "password",
# "host": "trace-db-postgresql",
# }))
docker_build("mev-inspect-py", ".",
live_update=[
sync(".", "/app"),
run("cd /app && poetry install",
trigger="./pyproject.toml"),
],
)
k8s_yaml(helm('./k8s/mev-inspect', name='mev-inspect'))
k8s_resource(workload="mev-inspect", resource_deps=["postgresql-postgresql"])
# uncomment to enable price monitor
# k8s_yaml(helm('./k8s/mev-inspect-prices', name='mev-inspect-prices'))
# k8s_resource(workload="mev-inspect-prices", resource_deps=["postgresql-postgresql"])
local_resource(
'pg-port-forward',
serve_cmd='kubectl port-forward --namespace default svc/postgresql 5432:5432',
resource_deps=["postgresql-postgresql"]
)

View File

@@ -1,5 +1,3 @@
import os
from logging.config import fileConfig
from sqlalchemy import engine_from_config
@@ -7,10 +5,12 @@ from sqlalchemy import pool
from alembic import context
from mev_inspect.db import get_inspect_database_uri
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
config.set_main_option("sqlalchemy.url", os.environ["SQLALCHEMY_DATABASE_URI"])
config.set_main_option("sqlalchemy.url", get_inspect_database_uri())
# Interpret the config file for Python logging.
# This line sets up loggers basically.

View File

@@ -0,0 +1,55 @@
"""Change miner payments and transfers primary keys to include block number
Revision ID: 04a3bb3740c3
Revises: a10d68643476
Create Date: 2021-11-02 22:42:01.702538
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "04a3bb3740c3"
down_revision = "a10d68643476"
branch_labels = None
depends_on = None
def upgrade():
# transfers
op.execute("ALTER TABLE transfers DROP CONSTRAINT transfers_pkey")
op.create_primary_key(
"transfers_pkey",
"transfers",
["block_number", "transaction_hash", "trace_address"],
)
op.drop_index("ix_transfers_block_number")
# miner_payments
op.execute("ALTER TABLE miner_payments DROP CONSTRAINT miner_payments_pkey")
op.create_primary_key(
"miner_payments_pkey",
"miner_payments",
["block_number", "transaction_hash"],
)
op.drop_index("ix_block_number")
def downgrade():
# transfers
op.execute("ALTER TABLE transfers DROP CONSTRAINT transfers_pkey")
op.create_index("ix_transfers_block_number", "transfers", ["block_number"])
op.create_primary_key(
"transfers_pkey",
"transfers",
["transaction_hash", "trace_address"],
)
# miner_payments
op.execute("ALTER TABLE miner_payments DROP CONSTRAINT miner_payments_pkey")
op.create_index("ix_block_number", "miner_payments", ["block_number"])
op.create_primary_key(
"miner_payments_pkey",
"miner_payments",
["transaction_hash"],
)

View File

@@ -0,0 +1,36 @@
"""Change blocks.timestamp to timestamp
Revision ID: 04b76ab1d2af
Revises: 2c90b2b8a80b
Create Date: 2021-11-26 15:31:21.111693
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "04b76ab1d2af"
down_revision = "0cef835f7b36"
branch_labels = None
depends_on = None
def upgrade():
op.alter_column(
"blocks",
"block_timestamp",
type_=sa.TIMESTAMP,
nullable=False,
postgresql_using="TO_TIMESTAMP(block_timestamp)",
)
def downgrade():
op.alter_column(
"blocks",
"block_timestamp",
type_=sa.Numeric,
nullable=False,
postgresql_using="extract(epoch FROM block_timestamp)",
)

View File

@@ -0,0 +1,35 @@
"""empty message
Revision ID: 070819d86587
Revises: d498bdb0a641
Create Date: 2021-11-26 18:25:13.402822
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "d498bdb0a641"
down_revision = "b9fa1ecc9929"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"punk_snipes",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("from_address", sa.String(256), nullable=False),
sa.Column("punk_index", sa.Numeric, nullable=False),
sa.Column("min_acceptance_price", sa.Numeric, nullable=False),
sa.Column("acceptance_price", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("block_number", "transaction_hash", "trace_address"),
)
def downgrade():
op.drop_table("punk_snipes")

View File

@@ -0,0 +1,36 @@
"""Create miner_payments table
Revision ID: 083978d6e455
Revises: 92f28a2b4f52
Create Date: 2021-08-30 17:42:25.548130
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "083978d6e455"
down_revision = "92f28a2b4f52"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"miner_payments",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(66), primary_key=True),
sa.Column("transaction_index", sa.Numeric, nullable=False),
sa.Column("miner_address", sa.String(256), nullable=False),
sa.Column("coinbase_transfer", sa.Numeric, nullable=False),
sa.Column("base_fee_per_gas", sa.Numeric, nullable=False),
sa.Column("gas_price", sa.Numeric, nullable=False),
sa.Column("gas_price_with_coinbase_transfer", sa.Numeric, nullable=False),
sa.Column("gas_used", sa.Numeric, nullable=False),
)
def downgrade():
op.drop_table("miner_payments")

View File

@@ -0,0 +1,27 @@
"""Rename pool_address to contract_address
Revision ID: 0cef835f7b36
Revises: 5427d62a2cc0
Create Date: 2021-11-19 15:36:15.152622
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "0cef835f7b36"
down_revision = "5427d62a2cc0"
branch_labels = None
depends_on = None
def upgrade():
op.alter_column(
"swaps", "pool_address", nullable=False, new_column_name="contract_address"
)
def downgrade():
op.alter_column(
"swaps", "contract_address", nullable=False, new_column_name="pool_address"
)

View File

@@ -0,0 +1,27 @@
"""Add received_collateral_address to liquidations
Revision ID: 205ce02374b3
Revises: c8363617aa07
Create Date: 2021-10-04 19:52:40.017084
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "205ce02374b3"
down_revision = "c8363617aa07"
branch_labels = None
depends_on = None
def upgrade():
op.add_column(
"liquidations",
sa.Column("received_token_address", sa.String(256), nullable=True),
)
def downgrade():
op.drop_column("liquidations", "received_token_address")

View File

@@ -0,0 +1,39 @@
"""Create swaps table
Revision ID: 2116e2f36a19
Revises: c5da44eb072c
Create Date: 2021-08-05 21:06:33.340456
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "2116e2f36a19"
down_revision = "c5da44eb072c"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"swaps",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("abi_name", sa.String(1024), nullable=False),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("protocol", sa.String(256), nullable=True),
sa.Column("pool_address", sa.String(256), nullable=False),
sa.Column("from_address", sa.String(256), nullable=False),
sa.Column("to_address", sa.String(256), nullable=False),
sa.Column("token_in_address", sa.String(256), nullable=False),
sa.Column("token_in_amount", sa.Numeric, nullable=False),
sa.Column("token_out_address", sa.String(256), nullable=False),
sa.Column("token_out_amount", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("transaction_hash", "trace_address"),
)
def downgrade():
op.drop_table("swaps")

View File

@@ -0,0 +1,29 @@
"""Add blocks table
Revision ID: 2c90b2b8a80b
Revises: 04a3bb3740c3
Create Date: 2021-11-17 18:29:13.065944
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "2c90b2b8a80b"
down_revision = "04a3bb3740c3"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"blocks",
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("block_timestamp", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("block_number"),
)
def downgrade():
op.drop_table("blocks")

View File

@@ -0,0 +1,23 @@
"""Add index on block_number for miner_payments
Revision ID: 320e56b0a99f
Revises: a02f3f2c469f
Create Date: 2021-09-14 11:11:41.559137
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "320e56b0a99f"
down_revision = "a02f3f2c469f"
branch_labels = None
depends_on = None
def upgrade():
op.create_index("ix_block_number", "miner_payments", ["block_number"])
def downgrade():
op.drop_index("ix_block_number", "miner_payments")

View File

@@ -0,0 +1,46 @@
"""Cahnge swap primary key to include block number
Revision ID: 3417f49d97b3
Revises: 205ce02374b3
Create Date: 2021-11-02 20:50:32.854996
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "3417f49d97b3"
down_revision = "205ce02374b3"
branch_labels = None
depends_on = None
def upgrade():
op.execute("ALTER TABLE swaps DROP CONSTRAINT swaps_pkey CASCADE")
op.create_primary_key(
"swaps_pkey",
"swaps",
["block_number", "transaction_hash", "trace_address"],
)
op.create_index(
"arbitrage_swaps_swaps_idx",
"arbitrage_swaps",
["swap_transaction_hash", "swap_trace_address"],
)
def downgrade():
op.drop_index("arbitrage_swaps_swaps_idx")
op.execute("ALTER TABLE swaps DROP CONSTRAINT swaps_pkey CASCADE")
op.create_primary_key(
"swaps_pkey",
"swaps",
["transaction_hash", "trace_address"],
)
op.create_foreign_key(
"arbitrage_swaps_swaps_fkey",
"arbitrage_swaps",
"swaps",
["swap_transaction_hash", "swap_trace_address"],
["transaction_hash", "trace_address"],
)

View File

@@ -0,0 +1,34 @@
"""empty message
Revision ID: 52d75a7e0533
Revises: 7cf0eeb41da0
Create Date: 2021-11-26 20:35:58.954138
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "52d75a7e0533"
down_revision = "7cf0eeb41da0"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"punk_bid_acceptances",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("from_address", sa.String(256), nullable=False),
sa.Column("punk_index", sa.Numeric, nullable=False),
sa.Column("min_price", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("block_number", "transaction_hash", "trace_address"),
)
def downgrade():
op.drop_table("punk_bid_acceptances")

View File

@@ -0,0 +1,47 @@
"""Change transfers trace address to ARRAY
Revision ID: 5427d62a2cc0
Revises: d540242ae368
Create Date: 2021-11-19 13:25:11.252774
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "5427d62a2cc0"
down_revision = "d540242ae368"
branch_labels = None
depends_on = None
def upgrade():
op.drop_constraint("transfers_pkey", "transfers")
op.alter_column(
"transfers",
"trace_address",
type_=sa.ARRAY(sa.Integer),
nullable=False,
postgresql_using="trace_address::int[]",
)
op.create_primary_key(
"transfers_pkey",
"transfers",
["block_number", "transaction_hash", "trace_address"],
)
def downgrade():
op.drop_constraint("transfers_pkey", "transfers")
op.alter_column(
"transfers",
"trace_address",
type_=sa.String(256),
nullable=False,
)
op.create_primary_key(
"transfers_pkey",
"transfers",
["block_number", "transaction_hash", "trace_address"],
)

View File

@@ -0,0 +1,34 @@
"""empty message
Revision ID: 7cf0eeb41da0
Revises: d498bdb0a641
Create Date: 2021-11-26 20:27:28.936516
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "7cf0eeb41da0"
down_revision = "d498bdb0a641"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"punk_bids",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("from_address", sa.String(256), nullable=False),
sa.Column("punk_index", sa.Numeric, nullable=False),
sa.Column("price", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("block_number", "transaction_hash", "trace_address"),
)
def downgrade():
op.drop_table("punk_bids")

View File

@@ -0,0 +1,50 @@
"""Change trace addresses to array types
Revision ID: 7eec417a4f3e
Revises: 9d8c69b3dccb
Create Date: 2021-08-06 15:58:04.556762
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "7eec417a4f3e"
down_revision = "9d8c69b3dccb"
branch_labels = None
depends_on = None
def upgrade():
op.drop_constraint("swaps_pkey", "swaps")
op.drop_column("swaps", "trace_address")
op.add_column("swaps", sa.Column("trace_address", sa.ARRAY(sa.Integer)))
op.create_primary_key("swaps_pkey", "swaps", ["transaction_hash", "trace_address"])
op.drop_constraint("classified_traces_pkey", "classified_traces")
op.drop_column("classified_traces", "trace_address")
op.add_column("classified_traces", sa.Column("trace_address", sa.ARRAY(sa.Integer)))
op.create_primary_key(
"classified_traces_pkey",
"classified_traces",
["transaction_hash", "trace_address"],
)
def downgrade():
op.drop_constraint("swaps_pkey", "swaps")
op.drop_column("swaps", "trace_address")
op.add_column("swaps", sa.Column("trace_address", sa.String))
op.create_primary_key("swaps_pkey", "swaps", ["transaction_hash", "trace_address"])
op.drop_constraint("classified_traces_pkey", "classified_traces")
op.drop_column("classified_traces", "trace_address")
op.add_column("classified_traces", sa.Column("trace_address", sa.String))
op.create_primary_key(
"classified_traces_pkey",
"classified_traces",
["transaction_hash", "trace_address"],
)

View File

@@ -0,0 +1,24 @@
"""Add error column to swaps
Revision ID: 92f28a2b4f52
Revises: 9b8ae51c5d56
Create Date: 2021-08-17 03:46:21.498821
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "92f28a2b4f52"
down_revision = "9b8ae51c5d56"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("swaps", sa.Column("error", sa.String(256), nullable=True))
def downgrade():
op.drop_column("swaps", "error")

View File

@@ -0,0 +1,38 @@
"""Add swap arbitrage join table
Revision ID: 9b8ae51c5d56
Revises: 7eec417a4f3e
Create Date: 2021-08-06 17:06:55.364516
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "9b8ae51c5d56"
down_revision = "7eec417a4f3e"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"arbitrage_swaps",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("arbitrage_id", sa.String(1024), primary_key=True),
sa.Column("swap_transaction_hash", sa.String(66), primary_key=True),
sa.Column("swap_trace_address", sa.ARRAY(sa.Integer), primary_key=True),
sa.ForeignKeyConstraint(
["arbitrage_id"], ["arbitrages.id"], ondelete="CASCADE"
),
sa.ForeignKeyConstraint(
["swap_transaction_hash", "swap_trace_address"],
["swaps.transaction_hash", "swaps.trace_address"],
ondelete="CASCADE",
),
)
def downgrade():
op.drop_table("arbitrage_swaps")

View File

@@ -0,0 +1,35 @@
"""Add arbitrages and swap join table
Revision ID: 9d8c69b3dccb
Revises: 2116e2f36a19
Create Date: 2021-08-05 21:46:35.209199
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "9d8c69b3dccb"
down_revision = "2116e2f36a19"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"arbitrages",
sa.Column("id", sa.String(256), primary_key=True),
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("account_address", sa.String(256), nullable=False),
sa.Column("profit_token_address", sa.String(256), nullable=False),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(256), nullable=False),
sa.Column("start_amount", sa.Numeric, nullable=False),
sa.Column("end_amount", sa.Numeric, nullable=False),
sa.Column("profit_amount", sa.Numeric, nullable=False),
)
def downgrade():
op.drop_table("arbitrages")

View File

@@ -0,0 +1,28 @@
"""Create latest block table
Revision ID: a02f3f2c469f
Revises: d70c08b4db6f
Create Date: 2021-09-13 21:32:27.181344
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "a02f3f2c469f"
down_revision = "d70c08b4db6f"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"latest_block_update",
sa.Column("block_number", sa.Numeric, primary_key=True),
sa.Column("updated_at", sa.TIMESTAMP, server_default=sa.func.now()),
)
def downgrade():
op.drop_table("latest_block_update")

View File

@@ -0,0 +1,35 @@
"""Change classified traces primary key to include block number
Revision ID: a10d68643476
Revises: 3417f49d97b3
Create Date: 2021-11-02 22:03:26.312317
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "a10d68643476"
down_revision = "3417f49d97b3"
branch_labels = None
depends_on = None
def upgrade():
op.execute("ALTER TABLE classified_traces DROP CONSTRAINT classified_traces_pkey")
op.create_primary_key(
"classified_traces_pkey",
"classified_traces",
["block_number", "transaction_hash", "trace_address"],
)
op.drop_index("i_block_number")
def downgrade():
op.execute("ALTER TABLE classified_traces DROP CONSTRAINT classified_traces_pkey")
op.create_index("i_block_number", "classified_traces", ["block_number"])
op.create_primary_key(
"classified_traces_pkey",
"classified_traces",
["transaction_hash", "trace_address"],
)

View File

@@ -0,0 +1,27 @@
"""Remove collateral_token_address column
Revision ID: b9fa1ecc9929
Revises: 04b76ab1d2af
Create Date: 2021-12-01 23:32:40.574108
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "b9fa1ecc9929"
down_revision = "04b76ab1d2af"
branch_labels = None
depends_on = None
def upgrade():
op.drop_column("liquidations", "collateral_token_address")
def downgrade():
op.add_column(
"liquidations",
sa.Column("collateral_token_address", sa.String(256), nullable=False),
)

View File

@@ -0,0 +1,23 @@
"""Add index for classified_traces.block_number
Revision ID: c5da44eb072c
Revises: 0660432b9840
Create Date: 2021-07-30 17:37:27.335475
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "c5da44eb072c"
down_revision = "0660432b9840"
branch_labels = None
depends_on = None
def upgrade():
op.create_index("i_block_number", "classified_traces", ["block_number"])
def downgrade():
op.drop_index("i_block_number", "classified_traces")

View File

@@ -0,0 +1,38 @@
"""Create liquidations table
Revision ID: c8363617aa07
Revises: cd96af55108e
Create Date: 2021-09-29 14:00:06.857103
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "c8363617aa07"
down_revision = "cd96af55108e"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"liquidations",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("liquidated_user", sa.String(256), nullable=False),
sa.Column("liquidator_user", sa.String(256), nullable=False),
sa.Column("collateral_token_address", sa.String(256), nullable=False),
sa.Column("debt_token_address", sa.String(256), nullable=False),
sa.Column("debt_purchase_amount", sa.Numeric, nullable=False),
sa.Column("received_amount", sa.Numeric, nullable=False),
sa.Column("protocol", sa.String(256), nullable=True),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.PrimaryKeyConstraint("transaction_hash", "trace_address"),
)
def downgrade():
op.drop_table("liquidations")

View File

@@ -0,0 +1,39 @@
"""Add transfers table
Revision ID: cd96af55108e
Revises: 5437dc68f4df
Create Date: 2021-09-17 12:44:45.245137
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "cd96af55108e"
down_revision = "320e56b0a99f"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"transfers",
sa.Column("created_at", sa.TIMESTAMP, server_default=sa.func.now()),
sa.Column("block_number", sa.Numeric, nullable=False),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("trace_address", sa.String(256), nullable=False),
sa.Column("protocol", sa.String(256), nullable=True),
sa.Column("from_address", sa.String(256), nullable=False),
sa.Column("to_address", sa.String(256), nullable=False),
sa.Column("token_address", sa.String(256), nullable=False),
sa.Column("amount", sa.Numeric, nullable=False),
sa.Column("error", sa.String(256), nullable=True),
sa.PrimaryKeyConstraint("transaction_hash", "trace_address"),
)
op.create_index("ix_transfers_block_number", "transfers", ["block_number"])
def downgrade():
op.drop_index("ix_transfers_block_number", "transfers")
op.drop_table("transfers")

View File

@@ -0,0 +1,30 @@
"""Create usd_prices table
Revision ID: d540242ae368
Revises: 2c90b2b8a80b
Create Date: 2021-11-18 04:30:06.802857
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "d540242ae368"
down_revision = "2c90b2b8a80b"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"prices",
sa.Column("timestamp", sa.TIMESTAMP),
sa.Column("usd_price", sa.Numeric, nullable=False),
sa.Column("token_address", sa.String(256), nullable=False),
sa.PrimaryKeyConstraint("token_address", "timestamp"),
)
def downgrade():
op.drop_table("prices")

View File

@@ -0,0 +1,32 @@
"""Add to_address and from_address to miner_payments table
Revision ID: d70c08b4db6f
Revises: 083978d6e455
Create Date: 2021-08-30 22:10:04.186251
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "d70c08b4db6f"
down_revision = "083978d6e455"
branch_labels = None
depends_on = None
def upgrade():
op.add_column(
"miner_payments",
sa.Column("transaction_to_address", sa.String(256), nullable=True),
)
op.add_column(
"miner_payments",
sa.Column("transaction_from_address", sa.String(256), nullable=True),
)
def downgrade():
op.drop_column("miner_payments", "transaction_to_address")
op.drop_column("miner_payments", "transaction_from_address")

57
backfill.py Normal file
View File

@@ -0,0 +1,57 @@
import subprocess
import sys
from typing import Iterator, Tuple
def get_block_after_before_chunks(
after_block: int,
before_block: int,
n_workers: int,
) -> Iterator[Tuple[int, int]]:
n_blocks = before_block - after_block
remainder = n_blocks % n_workers
floor_chunk_size = n_blocks // n_workers
last_before_block = None
for worker_index in range(n_workers):
chunk_size = floor_chunk_size
if worker_index < remainder:
chunk_size += 1
batch_after_block = (
last_before_block if last_before_block is not None else after_block
)
batch_before_block = batch_after_block + chunk_size
yield batch_after_block, batch_before_block
last_before_block = batch_before_block
def backfill(after_block: int, before_block: int, n_workers: int):
if n_workers <= 0:
raise ValueError("Need at least one worker")
for batch_after_block, batch_before_block in get_block_after_before_chunks(
after_block,
before_block,
n_workers,
):
print(f"Backfilling {batch_after_block} to {batch_before_block}")
backfill_command = f"sh backfill.sh {batch_after_block} {batch_before_block}"
process = subprocess.Popen(backfill_command.split(), stdout=subprocess.PIPE)
output, _ = process.communicate()
print(output)
def main():
after_block = int(sys.argv[1])
before_block = int(sys.argv[2])
n_workers = int(sys.argv[3])
backfill(after_block, before_block, n_workers)
if __name__ == "__main__":
main()

6
backfill.sh Normal file
View File

@@ -0,0 +1,6 @@
current_image=$(kubectl get deployment mev-inspect -o=jsonpath='{$.spec.template.spec.containers[:1].image}')
helm template mev-inspect-backfill ./k8s/mev-inspect-backfill \
--set image.repository=$current_image \
--set command.startBlockNumber=$1 \
--set command.endBlockNumber=$2 | kubectl apply -f -

102
cli.py Normal file
View File

@@ -0,0 +1,102 @@
import logging
import os
import sys
import click
from mev_inspect.concurrency import coro
from mev_inspect.crud.prices import write_prices
from mev_inspect.db import get_inspect_session, get_trace_session
from mev_inspect.inspector import MEVInspector
from mev_inspect.prices import fetch_all_supported_prices
RPC_URL_ENV = "RPC_URL"
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logger = logging.getLogger(__name__)
@click.group()
def cli():
pass
@cli.command()
@click.argument("block_number", type=int)
@click.option("--rpc", default=lambda: os.environ.get(RPC_URL_ENV, ""))
@coro
async def inspect_block_command(block_number: int, rpc: str):
inspect_db_session = get_inspect_session()
trace_db_session = get_trace_session()
inspector = MEVInspector(rpc, inspect_db_session, trace_db_session)
await inspector.inspect_single_block(block=block_number)
@cli.command()
@click.argument("block_number", type=int)
@click.option("--rpc", default=lambda: os.environ.get(RPC_URL_ENV, ""))
@coro
async def fetch_block_command(block_number: int, rpc: str):
inspect_db_session = get_inspect_session()
trace_db_session = get_trace_session()
inspector = MEVInspector(rpc, inspect_db_session, trace_db_session)
block = await inspector.create_from_block(block_number=block_number)
print(block.json())
@cli.command()
@click.argument("after_block", type=int)
@click.argument("before_block", type=int)
@click.option("--rpc", default=lambda: os.environ.get(RPC_URL_ENV, ""))
@click.option(
"--max-concurrency",
type=int,
help="maximum number of concurrent connections",
default=5,
)
@click.option(
"--request-timeout", type=int, help="timeout for requests to nodes", default=500
)
@coro
async def inspect_many_blocks_command(
after_block: int,
before_block: int,
rpc: str,
max_concurrency: int,
request_timeout: int,
):
inspect_db_session = get_inspect_session()
trace_db_session = get_trace_session()
inspector = MEVInspector(
rpc,
inspect_db_session,
trace_db_session,
max_concurrency=max_concurrency,
request_timeout=request_timeout,
)
await inspector.inspect_many_blocks(
after_block=after_block, before_block=before_block
)
@cli.command()
@coro
async def fetch_all_prices():
inspect_db_session = get_inspect_session()
logger.info("Fetching prices")
prices = await fetch_all_supported_prices()
logger.info("Writing prices")
write_prices(inspect_db_session, prices)
def get_rpc_url() -> str:
return os.environ["RPC_URL"]
if __name__ == "__main__":
cli()

View File

@@ -1,33 +0,0 @@
services:
mev-inspect:
build: .
depends_on:
- db
env_file:
- .env
volumes:
- .:/app
tty: true
db:
image: postgres:12
volumes:
- mev-inspect-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
pgadmin:
image: dpage/pgadmin4
networks:
- default
depends_on:
- db
env_file:
- .env
ports:
- "5050:5050"
volumes:
mev-inspect-db-data:

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: mev-inspect-backfill
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mev-inspect-backfill.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mev-inspect-backfill.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mev-inspect-backfill.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "mev-inspect-backfill.labels" -}}
helm.sh/chart: {{ include "mev-inspect-backfill.chart" . }}
{{ include "mev-inspect-backfill.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "mev-inspect-backfill.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mev-inspect-backfill.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "mev-inspect-backfill.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "mev-inspect-backfill.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,68 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "mev-inspect-backfill.fullname" . }}-{{ randAlphaNum 5 | lower }}
labels:
{{- include "mev-inspect-backfill.labels" . | nindent 4 }}
spec:
completions: 1
parallelism: 1
ttlSecondsAfterFinished: 5
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- run
- inspect-many-blocks
- {{ .Values.command.startBlockNumber | quote }}
- {{ .Values.command.endBlockNumber | quote }}
env:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: host
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: password
- name: TRACE_DB_HOST
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: host
optional: true
- name: TRACE_DB_USER
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: username
optional: true
- name: TRACE_DB_PASSWORD
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: password
optional: true
- name: RPC_URL
valueFrom:
configMapKeyRef:
name: mev-inspect-rpc
key: url
restartPolicy: OnFailure

View File

@@ -0,0 +1,42 @@
# Default values for mev-inspect.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
repository: mev-inspect-py
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: mev-inspect-prices
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mev-inspect-prices.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mev-inspect-prices.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mev-inspect-prices.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "mev-inspect-prices.labels" -}}
helm.sh/chart: {{ include "mev-inspect-prices.chart" . }}
{{ include "mev-inspect-prices.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "mev-inspect-prices.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mev-inspect-prices.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "mev-inspect-prices.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "mev-inspect-prices.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "mev-inspect-prices.fullname" . }}
spec:
schedule: "0 */1 * * *"
successfulJobsHistoryLimit: 0
jobTemplate:
spec:
template:
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- run
- fetch-all-prices
env:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: host
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: password
restartPolicy: Never

View File

@@ -0,0 +1,7 @@
image:
repository: mev-inspect-py
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: mev-inspect
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mev-inspect.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mev-inspect.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mev-inspect.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "mev-inspect.labels" -}}
helm.sh/chart: {{ include "mev-inspect.chart" . }}
{{ include "mev-inspect.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "mev-inspect.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mev-inspect.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "mev-inspect.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "mev-inspect.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,99 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mev-inspect.fullname" . }}
labels:
{{- include "mev-inspect.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "mev-inspect.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "mev-inspect.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["run", "python", "loop.py"]
livenessProbe:
exec:
command:
- ls
- /
initialDelaySeconds: 20
periodSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: host
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: mev-inspect-db-credentials
key: password
- name: TRACE_DB_HOST
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: host
optional: true
- name: TRACE_DB_USER
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: username
optional: true
- name: TRACE_DB_PASSWORD
valueFrom:
secretKeyRef:
name: trace-db-credentials
key: password
optional: true
- name: RPC_URL
valueFrom:
configMapKeyRef:
name: mev-inspect-rpc
key: url
- name: LISTENER_HEALTHCHECK_URL
valueFrom:
configMapKeyRef:
name: mev-inspect-listener-healthcheck
key: url
optional: true
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,44 @@
# Default values for mev-inspect.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: mev-inspect-py:latest
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}

50
listener Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
set -e
NAME=listener
PIDFILE=/var/run/$NAME.pid
DAEMON=/root/.poetry/bin/poetry
DAEMON_OPTS="run python listener.py"
case "$1" in
start)
echo -n "Starting daemon: "$NAME
start-stop-daemon \
--background \
--chdir /app \
--start \
--quiet \
--pidfile $PIDFILE \
--make-pidfile \
--startas $DAEMON -- $DAEMON_OPTS
echo "."
;;
stop)
echo -n "Stopping daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
echo "."
;;
tail)
tail -f listener.log
;;
restart)
echo -n "Restarting daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
start-stop-daemon \
--background \
--chdir /app \
--start \
--quiet \
--pidfile $PIDFILE \
--make-pidfile \
--startas $DAEMON -- $DAEMON_OPTS
echo "."
;;
*)
echo "Usage: "$1" {start|stop|restart|tail}"
exit 1
esac
exit 0

99
listener.py Normal file
View File

@@ -0,0 +1,99 @@
import asyncio
import logging
import os
import aiohttp
from mev_inspect.block import get_latest_block_number
from mev_inspect.concurrency import coro
from mev_inspect.crud.latest_block_update import (
find_latest_block_update,
update_latest_block,
)
from mev_inspect.db import get_inspect_session, get_trace_session
from mev_inspect.inspector import MEVInspector
from mev_inspect.provider import get_base_provider
from mev_inspect.signal_handler import GracefulKiller
logging.basicConfig(filename="listener.log", filemode="a", level=logging.INFO)
logger = logging.getLogger(__name__)
# lag to make sure the blocks we see are settled
BLOCK_NUMBER_LAG = 5
@coro
async def run():
rpc = os.getenv("RPC_URL")
if rpc is None:
raise RuntimeError("Missing environment variable RPC_URL")
healthcheck_url = os.getenv("LISTENER_HEALTHCHECK_URL")
logger.info("Starting...")
killer = GracefulKiller()
inspect_db_session = get_inspect_session()
trace_db_session = get_trace_session()
inspector = MEVInspector(rpc, inspect_db_session, trace_db_session)
base_provider = get_base_provider(rpc)
while not killer.kill_now:
await inspect_next_block(
inspector,
inspect_db_session,
base_provider,
healthcheck_url,
)
logger.info("Stopping...")
async def inspect_next_block(
inspector: MEVInspector,
inspect_db_session,
base_provider,
healthcheck_url,
):
latest_block_number = await get_latest_block_number(base_provider)
last_written_block = find_latest_block_update(inspect_db_session)
logger.info(f"Latest block: {latest_block_number}")
logger.info(f"Last written block: {last_written_block}")
if last_written_block is None:
# maintain lag if no blocks written yet
last_written_block = latest_block_number - 1
if last_written_block < (latest_block_number - BLOCK_NUMBER_LAG):
block_number = (
latest_block_number
if last_written_block is None
else last_written_block + 1
)
logger.info(f"Writing block: {block_number}")
await inspector.inspect_single_block(block=block_number)
update_latest_block(inspect_db_session, block_number)
if healthcheck_url:
await ping_healthcheck_url(healthcheck_url)
else:
await asyncio.sleep(5)
async def ping_healthcheck_url(url):
async with aiohttp.ClientSession() as session:
async with session.get(url):
pass
if __name__ == "__main__":
try:
run()
except Exception as e:
logger.error(e)

22
loop.py Normal file
View File

@@ -0,0 +1,22 @@
import logging
import time
from mev_inspect.signal_handler import GracefulKiller
logging.basicConfig(filename="loop.log", level=logging.INFO)
logger = logging.getLogger(__name__)
def run():
logger.info("Starting...")
killer = GracefulKiller()
while not killer.kill_now:
time.sleep(1)
logger.info("Stopping...")
if __name__ == "__main__":
run()

81
mev Executable file
View File

@@ -0,0 +1,81 @@
#!/usr/bin/env bash
set -e
DB_NAME=mev_inspect
function get_kube_db_secret(){
kubectl get secrets mev-inspect-db-credentials -o jsonpath="{.data.$1}" | base64 --decode
}
function db(){
host=$(get_kube_db_secret "host")
username=$(get_kube_db_secret "username")
password=$(get_kube_db_secret "password")
kubectl run -i --rm --tty postgres-client \
--env="PGPASSWORD=$password" \
--image=jbergknoff/postgresql-client \
-- $DB_NAME --host=$host --user=$username
}
case "$1" in
db)
echo "Connecting to $DB_NAME"
db
;;
listener)
kubectl exec -ti deploy/mev-inspect -- ./listener $2
;;
backfill)
start_block_number=$2
end_block_number=$3
n_workers=$4
echo "Backfilling from $start_block_number to $end_block_number with $n_workers workers"
python backfill.py $start_block_number $end_block_number $n_workers
;;
inspect)
block_number=$2
echo "Inspecting block $block_number"
kubectl exec -ti deploy/mev-inspect -- poetry run inspect-block $block_number
;;
inspect-many)
start_block_number=$2
end_block_number=$3
echo "Inspecting from block $start_block_number to $end_block_number"
kubectl exec -ti deploy/mev-inspect -- \
poetry run inspect-many-blocks $start_block_number $end_block_number
;;
test)
echo "Running tests"
kubectl exec -ti deploy/mev-inspect -- poetry run pytest tests
;;
fetch)
block_number=$2
echo "Fetching block $block_number"
kubectl exec -ti deploy/mev-inspect -- poetry run fetch-block $block_number
;;
prices)
shift
case "$1" in
fetch-all)
echo "Running price fetch-all"
kubectl exec -ti deploy/mev-inspect -- \
poetry run fetch-all-prices
;;
*)
echo "prices usage: "$1" {fetch-all}"
exit 1
esac
;;
exec)
shift
kubectl exec -ti deploy/mev-inspect -- $@
;;
*)
echo "Usage: "$1" {db|backfill|inspect|test}"
exit 1
esac
exit 0

View File

@@ -0,0 +1,105 @@
from typing import List, Tuple, Optional
from mev_inspect.traces import (
get_child_traces,
is_child_of_any_address,
)
from mev_inspect.schemas.traces import (
ClassifiedTrace,
CallTrace,
DecodedCallTrace,
Classification,
Protocol,
)
from mev_inspect.transfers import get_transfer
from mev_inspect.schemas.transfers import Transfer
from mev_inspect.schemas.liquidations import Liquidation
AAVE_CONTRACT_ADDRESSES: List[str] = [
# AAVE Proxy
"0x398ec7346dcd622edc5ae82352f02be94c62d119",
# AAVE V2
"0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9",
# AAVE V1
"0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3",
# AAVE V2 WETH
"0x030ba81f1c18d280636f32af80b9aad02cf0854e",
# AAVE AMM Market DAI
"0x79be75ffc64dd58e66787e4eae470c8a1fd08ba4",
# AAVE i
"0x030ba81f1c18d280636f32af80b9aad02cf0854e",
"0xbcca60bb61934080951369a648fb03df4f96263c",
]
def get_aave_liquidations(
traces: List[ClassifiedTrace],
) -> List[Liquidation]:
"""Inspect list of classified traces and identify liquidation"""
liquidations: List[Liquidation] = []
parent_liquidations: List[List[int]] = []
for trace in traces:
if (
trace.classification == Classification.liquidate
and isinstance(trace, DecodedCallTrace)
and not is_child_of_any_address(trace, parent_liquidations)
and trace.protocol == Protocol.aave
):
parent_liquidations.append(trace.trace_address)
liquidator = trace.from_address
child_traces = get_child_traces(
trace.transaction_hash, trace.trace_address, traces
)
(
received_token_address,
received_amount,
) = _get_payback_token_and_amount(trace, child_traces, liquidator)
liquidations.append(
Liquidation(
liquidated_user=trace.inputs["_user"],
debt_token_address=trace.inputs["_reserve"],
liquidator_user=liquidator,
debt_purchase_amount=trace.inputs["_purchaseAmount"],
protocol=Protocol.aave,
received_amount=received_amount,
received_token_address=received_token_address,
transaction_hash=trace.transaction_hash,
trace_address=trace.trace_address,
block_number=trace.block_number,
)
)
return liquidations
def _get_payback_token_and_amount(
liquidation: DecodedCallTrace, child_traces: List[ClassifiedTrace], liquidator: str
) -> Tuple[str, int]:
"""Look for and return liquidator payback from liquidation"""
for child in child_traces:
if isinstance(child, CallTrace):
child_transfer: Optional[Transfer] = get_transfer(child)
if child_transfer is not None:
if (
child_transfer.to_address == liquidator
and child.from_address in AAVE_CONTRACT_ADDRESSES
):
return child_transfer.token_address, child_transfer.amount
return liquidation.inputs["_collateral"], 0

View File

@@ -4,23 +4,40 @@ from typing import Optional
from pydantic import parse_obj_as
from mev_inspect.schemas import ABI
from mev_inspect.schemas.classified_traces import Protocol
from mev_inspect.schemas.abi import ABI
from mev_inspect.schemas.traces import Protocol
THIS_FILE_DIRECTORY = Path(__file__).parents[0]
ABI_DIRECTORY_PATH = THIS_FILE_DIRECTORY / "abis"
def get_abi(abi_name: str, protocol: Optional[Protocol]) -> Optional[ABI]:
def get_abi_path(abi_name: str, protocol: Optional[Protocol]) -> Optional[Path]:
abi_filename = f"{abi_name}.json"
abi_path = (
ABI_DIRECTORY_PATH / abi_filename
if protocol is None
else ABI_DIRECTORY_PATH / protocol.value / abi_filename
)
if abi_path.is_file():
return abi_path
return None
# raw abi, for instantiating contract for queries (as opposed to classification, see below)
def get_raw_abi(abi_name: str, protocol: Optional[Protocol]) -> Optional[str]:
abi_path = get_abi_path(abi_name, protocol)
if abi_path is not None:
with abi_path.open() as abi_file:
return abi_file.read()
return None
def get_abi(abi_name: str, protocol: Optional[Protocol]) -> Optional[ABI]:
abi_path = get_abi_path(abi_name, protocol)
if abi_path is not None:
with abi_path.open() as abi_file:
abi_json = json.load(abi_file)
return parse_obj_as(ABI, abi_json)

View File

@@ -0,0 +1 @@
[{"inputs":[{"components":[{"internalType":"contract IERC20TokenV06","name":"makerToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"takerToken","type":"address"},{"internalType":"uint128","name":"makerAmount","type":"uint128"},{"internalType":"uint128","name":"takerAmount","type":"uint128"},{"internalType":"uint128","name":"takerTokenFeeAmount","type":"uint128"},{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"bytes32","name":"pool","type":"bytes32"},{"internalType":"uint64","name":"expiry","type":"uint64"},{"internalType":"uint256","name":"salt","type":"uint256"}],"internalType":"struct LibNativeOrder.LimitOrder[]","name":"orders","type":"tuple[]"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"uint128[]","name":"takerTokenFillAmounts","type":"uint128[]"},{"internalType":"bool","name":"revertIfIncomplete","type":"bool"}],"name":"batchFillLimitOrders","outputs":[{"internalType":"uint128[]","name":"takerTokenFilledAmounts","type":"uint128[]"},{"internalType":"uint128[]","name":"makerTokenFilledAmounts","type":"uint128[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20TokenV06","name":"makerToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"takerToken","type":"address"},{"internalType":"uint128","name":"makerAmount","type":"uint128"},{"internalType":"uint128","name":"takerAmount","type":"uint128"},{"internalType":"address","name":"maker","type":"address"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"address","name":"txOrigin","type":"address"},{"internalType":"bytes32","name":"pool","type":"bytes32"},{"internalType":"uint64","name":"expiry","type":"uint64"},{"internalType":"uint256","name":"salt","type":"uint256"}],"internalType":"struct LibNativeOrder.RfqOrder[]","name":"orders","type":"tuple[]"},{"components":[{"internalType":"enum LibSignature.SignatureType","name":"signatureType","type":"uint8"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct LibSignature.Signature[]","name":"signatures","type":"tuple[]"},{"internalType":"uint128[]","name":"takerTokenFillAmounts","type":"uint128[]"},{"internalType":"bool","name":"revertIfIncomplete","type":"bool"}],"name":"batchFillRfqOrders","outputs":[{"internalType":"uint128[]","name":"takerTokenFilledAmounts","type":"uint128[]"},{"internalType":"uint128[]","name":"makerTokenFilledAmounts","type":"uint128[]"}],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"bootstrap","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"name":"FEATURE_NAME","outputs":[{"internalType":"string","name":"name","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_VERSION","outputs":[{"internalType":"uint256","name":"version","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IERC20TokenV06","name":"erc20","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address payable","name":"recipientWallet","type":"address"}],"name":"transferTrappedTokensTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"indexed":false,"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"contract ILiquidityProvider","name":"provider","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"LiquidityProviderSwap","type":"event"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"contract ILiquidityProvider","name":"provider","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"sellToLiquidityProvider","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.BatchSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexBatchSellEthForToken","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.BatchSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexBatchSellTokenForEth","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.BatchSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexBatchSellTokenForToken","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.MultiHopSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexMultiHopSellEthForToken","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.MultiHopSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexMultiHopSellTokenForEth","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"components":[{"internalType":"enum IMultiplexFeature.MultiplexSubcall","name":"id","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IMultiplexFeature.MultiHopSellSubcall[]","name":"calls","type":"tuple[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"}],"name":"multiplexMultiHopSellTokenForToken","outputs":[{"internalType":"uint256","name":"boughtAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"migrator","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"Migrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"ownerAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IERC20TokenV06[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"enum IPancakeSwapFeature.ProtocolFork","name":"fork","type":"uint8"}],"name":"sellToPancakeSwap","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"oldImpl","type":"address"},{"indexed":false,"internalType":"address","name":"newImpl","type":"address"}],"name":"ProxyFunctionUpdated","type":"event"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"address","name":"impl","type":"address"}],"name":"extend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"uint256","name":"idx","type":"uint256"}],"name":"getRollbackEntryAtIndex","outputs":[{"internalType":"address","name":"impl","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getRollbackLength","outputs":[{"internalType":"uint256","name":"rollbackLength","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"address","name":"targetImpl","type":"address"}],"name":"rollback","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"name":"testFn","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IERC20TokenV06","name":"token","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"_spendERC20Tokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllowanceTarget","outputs":[{"internalType":"address","name":"target","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"token","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"getSpendableERC20BalanceOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"quoteSigner","type":"address"}],"name":"QuoteSignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"name":"TransformedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"transformerDeployer","type":"address"}],"name":"TransformerDeployerUpdated","type":"event"},{"inputs":[{"components":[{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputTokenAmount","type":"uint256"},{"components":[{"internalType":"uint32","name":"deploymentNonce","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ITransformERC20Feature.Transformation[]","name":"transformations","type":"tuple[]"},{"internalType":"bool","name":"useSelfBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ITransformERC20Feature.TransformERC20Args","name":"args","type":"tuple"}],"name":"_transformERC20","outputs":[{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"createTransformWallet","outputs":[{"internalType":"contract IFlashWallet","name":"wallet","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getQuoteSigner","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransformWallet","outputs":[{"internalType":"contract IFlashWallet","name":"wallet","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransformerDeployer","outputs":[{"internalType":"address","name":"deployer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"quoteSigner","type":"address"}],"name":"setQuoteSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transformerDeployer","type":"address"}],"name":"setTransformerDeployer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputTokenAmount","type":"uint256"},{"components":[{"internalType":"uint32","name":"deploymentNonce","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ITransformERC20Feature.Transformation[]","name":"transformations","type":"tuple[]"}],"name":"transformERC20","outputs":[{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IERC20TokenV06[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"bool","name":"isSushi","type":"bool"}],"name":"sellToUniswap","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"bytes","name":"encodedPath","type":"bytes"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"_sellHeldTokenForTokenToUniswapV3","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedPath","type":"bytes"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sellEthForTokenToUniswapV3","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedPath","type":"bytes"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"name":"sellTokenForEthToUniswapV3","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedPath","type":"bytes"},{"internalType":"uint256","name":"sellAmount","type":"uint256"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sellTokenForTokenToUniswapV3","outputs":[{"internalType":"uint256","name":"buyAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"ethRecipient","type":"address"}],"name":"die","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"sender","type":"address"},{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IERC20Transformer.TransformContext","name":"context","type":"tuple"}],"name":"transform","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"},{"name":"wad","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"guy","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Withdrawal","type":"event"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"getFunctionImplementation","outputs":[{"internalType":"address","name":"impl","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

View File

@@ -0,0 +1 @@
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"AuthorizedAddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"AuthorizedAddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"addAuthorizedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"authorities","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"executeCall","outputs":[{"internalType":"bytes","name":"resultData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAuthorizedAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"removeAuthorizedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"removeAuthorizedAddressAtIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address payable","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"executeCall","outputs":[{"internalType":"bytes","name":"resultData","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"executeDelegateCall","outputs":[{"internalType":"bytes","name":"resultData","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"hasSupport","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"tokenFallback","outputs":[],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"provider","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"executeSellEthForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"provider","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"executeSellTokenForEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"provider","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minBuyAmount","type":"uint256"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"executeSellTokenForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address[]","name":"initialAuthorities","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"AuthorizedAddressAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"AuthorizedAddressRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"deployedAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Deployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Killed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"addAuthorizedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"authorities","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"bytecode","type":"bytes"}],"name":"deploy","outputs":[{"internalType":"address","name":"deployedAddress","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAuthorizedAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKillable","name":"target","type":"address"},{"internalType":"address payable","name":"ethRecipient","type":"address"}],"name":"kill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"removeAuthorizedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"removeAuthorizedAddressAtIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"toDeploymentNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IExchange","name":"exchange_","type":"address"},{"internalType":"contract IBridgeAdapter","name":"bridgeAdapter_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderHash","type":"bytes32"}],"name":"ProtocolFeeUnfunded","type":"event"},{"inputs":[],"name":"bridgeAdapter","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"ethRecipient","type":"address"}],"name":"die","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"erc20Proxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchange","outputs":[{"internalType":"contract IExchange","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"sender","type":"address"},{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IERC20Transformer.TransformContext","name":"context","type":"tuple"}],"name":"transform","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"ethRecipient","type":"address"}],"name":"die","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"sender","type":"address"},{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IERC20Transformer.TransformContext","name":"context","type":"tuple"}],"name":"transform","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract IEtherTokenV06","name":"weth_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"ethRecipient","type":"address"}],"name":"die","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"sender","type":"address"},{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IERC20Transformer.TransformContext","name":"context","type":"tuple"}],"name":"transform","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IEtherTokenV06","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

View File

@@ -0,0 +1 @@
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,25 @@
[
{
"inputs": [
{
"internalType": "uint256",
"name": "fee0",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fee1",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "uniswapV3FlashCallback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"uint256","name":"amount0Owed","type":"uint256"},{"internalType":"uint256","name":"amount1Owed","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1 @@
[{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@@ -0,0 +1,615 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "BalanceTransfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "target",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "Burn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "underlyingAsset",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "pool",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "treasury",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "incentivesController",
"type": "address"
},
{
"indexed": false,
"internalType": "uint8",
"name": "aTokenDecimals",
"type": "uint8"
},
{
"indexed": false,
"internalType": "string",
"name": "aTokenName",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "aTokenSymbol",
"type": "string"
},
{
"indexed": false,
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
],
"name": "UNDERLYING_ASSET_ADDRESS",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "address",
"name": "receiverOfUnderlying",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "burn",
"outputs": [
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
],
"name": "getIncentivesController",
"outputs": [
{
"internalType": "contract IAaveIncentivesController",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getScaledUserBalanceAndSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "handleRepayment",
"outputs": [
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ILendingPool",
"name": "pool",
"type": "address"
},
{
"internalType": "address",
"name": "treasury",
"type": "address"
},
{
"internalType": "address",
"name": "underlyingAsset",
"type": "address"
},
{
"internalType": "contract IAaveIncentivesController",
"name": "incentivesController",
"type": "address"
},
{
"internalType": "uint8",
"name": "aTokenDecimals",
"type": "uint8"
},
{
"internalType": "string",
"name": "aTokenName",
"type": "string"
},
{
"internalType": "string",
"name": "aTokenSymbol",
"type": "string"
},
{
"internalType": "bytes",
"name": "params",
"type": "bytes"
}
],
"name": "initialize",
"outputs": [
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "mintToTreasury",
"outputs": [
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "scaledBalanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
],
"name": "scaledTotalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferOnLiquidation",
"outputs": [
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferUnderlyingTo",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More