flashbots / mev-inspect-rs

Discover historic Miner Extractable Value (MEV) opportunities
MIT License
550 stars 127 forks source link

Fix misclassified transactions #13

Open gakonst opened 3 years ago

gakonst commented 3 years ago

Txs below:

tx_hash datetime amount_usd gas_spend_in_usd type address
0x1b1b0e149de4e358a0eadab48125c1b4acf4ad568aac9dc1a27e21817a97240e October 14, 2020, 10:31 AM $497,749.62 $244.45 {trade,arbitrage} 0xfe56a0dbdad44dd14e4d560632cc842c8a13642b
0x203152e6fd3e9c2f8ff2718998127180daac1c01d8ffc3901d5793620aae2a72 January 11, 2021, 10:41 PM $779,922.74 $106.54 {arbitrage} 0x923b167e3026869c15fbcf2e82e4429e4dc97cbb
0x6aab9d1a448736975c102adc628c9d320efc4732fd3a3a9bb5f00265b5447113 October 14, 2020, 4:44 PM $518,697.86 $275.65 {arbitrage,trade} 0xfe56a0dbdad44dd14e4d560632cc842c8a13642b
0xa90968af5eac95c8643f820a6e5760db1b4cbb566e8ef37e92d9efdd160191d2 January 11, 2021, 10:39 PM $572,090.81 $228.21 {trade,arbitrage} 0x770b4c20451fc8183f13ac6db4f166b21e0edc93
0xd242175e58e74c22088b6a4b05585da4a0ec6d52dabd7d7e141a4e008c90dc92 January 11, 2021, 10:40 PM $582,018.08 $169.50 {arbitrage} 0x89653c7156ccc49be0e0b5ab63f2848296bb1a8d
0xe017fb4afc9c407982392851f0c1fd8e14248aaf43ba62650ecdac3fbab77288 October 14, 2020, 3:02 AM $569,385.29 $67.06 {trade,arbitrage} 0xd6fe434afd8a03cf2ad770cc4e0403b262168b0c
0xff93e60267c2021923ea6fc28e860150be4af56bda120f5b4c5e81ccb415340b January 11, 2021, 10:40 PM $635,046.30 $110.42 {arbitrage} 0x5a16552f59ea34e44ec81e58b3817833e9fd5436
obadiaa commented 3 years ago

this tx

0x83dd147043e1ceec0e51adc4be46db68e9351cce71103236d8bb7c72713e76b7

classified as a MEV profit of $954,665.13 shows up as a reverted tx on Etherscan: https://etherscan.io/tx/0x83dd147043e1ceec0e51adc4be46db68e9351cce71103236d8bb7c72713e76b7

obadiaa commented 3 years ago

0x8837130fe51f7ef3b27955bca9f6074a4785ebff8fc919ea8883ea5e05592123 this one's revenue feels suspicious, it's a volume of ~$3m and recorded a revenue of ~$3m, seems unlikely or a hack

These are all DRC transactions that seem like deflationary token hacks, I wonder if we should exclude them? They currently make up most of our top MEV txs leaderboard 0x36056bb6b74ad6befedd7788509724c225270fc4e3a2b5d05d1d6d160c7224b7 0x1e40bacf218704964ff5a085b2520f7d1b8f46c332894ab8095c829ec047b55e 0x4f40404a9f9d43a583f6ae8499a5f462d082c7a1aedf34079ec6ec59ca415177 0x605d29d26993827fb792f10d7b54fb50321c9445ec8832862c35df924332323f 0xf93b48617c616b3aea2f4fa2f2556f3216f9cf250b1f6629c2e2ca7984ed43e4 0xfba3d7d5591d82e0059642e47bf72b4f5912ea09a822908d8414aa1c78d98946 0xe017fb4afc9c407982392851f0c1fd8e14248aaf43ba62650ecdac3fbab77288 0x6aab9d1a448736975c102adc628c9d320efc4732fd3a3a9bb5f00265b5447113 0x9653a62b1cb731cf1ced04c391f07bd8bd3b1aab549252bef5fa9def32bdbf0e 0x1b1b0e149de4e358a0eadab48125c1b4acf4ad568aac9dc1a27e21817a97240e

gakonst commented 3 years ago

0x8837130fe51f7ef3b27955bca9f6074a4785ebff8fc919ea8883ea5e05592123

This the yearn recycler, I've patched it here and should be manually removed from the db.

Re: DRC transactions, I'd remove them from the db, and I'll add it to the type of things we ignore.

Re: reverted with >0 profit, that's intended, it might be best to just filter your SQL queries where status != reverted.

gakonst commented 3 years ago

DRC transactions are no longer processed since #38

obadiaa commented 3 years ago

Just a comment it's a good thing we don’t seem to be categorising the Eminence exploits (like this one https://etherscan.io/tx/0x3503253131644dd9f52802d071de74e456570374d586ddd640159cf6fb9b8ad8)

We have these two txs in our db but aren't accounting any revenue for it when they're highly profitable (each ~153 eth it seems): 0x40219fdaff2c1575c5fcf0f764ed437b4c5ab69d9f6f8ca6f181b849838a1f89 0xe7726863cd71fb97bb37fd0cb04ab0a78217e1cf9b23068a6d1165f38f5fd496

Not really misclassified but potentially smth to look out for here: for this tx we seem to have a diff revenue than Arthur Gervais et. al. paper (they have 92.23 ETH, we seem to have 72 ETH) 0xdc1f3dea442c587799a0c4740f12e4e2ad10c5c45157612a3c9c3f082698a4cd

gakonst commented 3 years ago
obadiaa commented 3 years ago

drops mic

obadiaa commented 3 years ago

https://etherscan.io/tx/0x7461f9261d1f50adaafca7377642b70504094f235ffd6c85113df1556e80f43a this one tx is categorized as profit of ~$100k USD when it just seems like a 1Inch swap?

in our db, revenue is 625,303,946,340,502,100,000 🤔

gakonst commented 3 years ago

Good catch, https://github.com/flashbots/mev-inspect-rs/pull/39 fixed here

obadiaa commented 3 years ago

I'll have more soon but all these are Flashloan-based, MakerDAO-loan opening based arbs we classify in our db as 0 revenue when I don't believe they are

0x448b94d1eed3449d7427f769341d7789474a2db60820b9ed9c494af0ae6b049c 0x0fa6b5afa4d1f6452692d2b780ae3baee04c5911a17a8b9154b332756e69a997 0xbbda18fc7191da4d52bbba0713adcbecca7c9ff6cb4b14db609ff556a2a9601d 0xfd9b9884bb10ef536cc5d2c5fac470812668917146eace00c4de9d5de3a5a273 0x78c94fac1f9ef1e4b0626d317a701f8868c7c0f0a6b18f6403b0a85dac4664c8 0xb948f8bd148851ccdd01b2a2abf173c03b9a3a584fcdadc835dff265d70efc97 https://etherscan.io/tx/0x9b66714ea0ba474db9fcd1488ada31023cccaaec72de1ca8596f2dc02d8669b1 0xf234bf3c56d7b4e59d2d5a922bcfc0334ba13c45b48d0ce432c27095130e9576 https://etherscan.io/tx/0x93117d8d1d0dab45a79e9a657b1a29628ccada76af30ad2620ce2979be00edcd 0x8f6a6963d9c9fdbbca7f93d1cdb60b984956c161c55b883e8457199c34a93ed4 0xbd1c420891a114c63d15f33659dd0d50ac8546248fd23aee237923c78be37393 0x8c1317beafe5e7df387ad7bcbef7c542681f68048259e903693d1a9ac8810876 0x47db89d8ca16e26fe4f849006e57d80e3c901010db7907a985ca1c31871a8556 0x4f852655dccdbe1b52e0a2e832ff36d17f6ec49c2b7e73abb0a9c2b1f7e6fe60 0x8cc92554be9e2f5d7956acaef91eb49039d4ab3a76c740ec2df349de64dd61b7

Different behaviours that are worth checking: 0x69d1ca3749c29f1a4709e3e91a572ef0dfc5d95c67f5a050919cd3af8a25e115 0x5413e58b5c0561902bd3c91db2be60968157e0cda1b5bb6e993180ff2e25caf6

obadiaa commented 3 years ago

another zapper address: 0x80c5e6908368cb9db503ba968d7ec5a565bfb389

gakonst commented 3 years ago

The Maker CDP +Curve transactions (e.g. 0x448b9, 0x0fa6b) are part of Abstracted Finance's CloseShortDAI script. They basically call their dsproxy which calls to their script to automate some actions. Shouldn't be flagged as revenue generating!

obadiaa commented 3 years ago

Aren't there still arbs in these txs? Like the very first one looks like they walked off 33k USDc after reimbursing their DyDx flashloans?

obadiaa commented 3 years ago

We classified this arb as 865k revenue https://etherscan.io/tx/0x2d346682871ecb407ee25af4de2b9998e70b4621116acafae7e07b6b79f585e3 when it's a 0.13 ETH profit (~103$). We seem to have overlooked the loan from DyDx that's taken and repaid

Another example of the same issue (classified as $303k revenue in our db): https://etherscan.io/tx/0xde13ef98fd52c4116703ee9c8d4d82a9fb449612112e35450cefc1570b556153

classified this Aave liquidation as $837k revenue https://etherscan.io/tx/0xa72072f5041bcde89c560ba12cc00b22a87779ee369dbff81a78bba26d35e989 when it's a (828.6k - 797.7k) DAI 'true' revenue. It seems we overlook the 'Liquidator Repay' step of the liquidation process

Other examples of the same issue: https://etherscan.io/tx/0xa6069cc7b53fb471fe6e27eec7aa3517cd28abe1fad5e031d8f5311013d854f0 (this is a 0 true revenue) and here: https://etherscan.io/tx/0x48d735b2dedcdc67ced30995b367c114221060f8bc2b0c1b85a6ee5513fe584d this is a (418k-398k)DAI true revenue

obadiaa commented 3 years ago

https://etherscan.io/tx/0x8b89589c6afb0e7a6e11afe04efa21312e078764986b692ef7b4c76f3f28ceef this is 0x exchange proxy we've classified as $289k revenue when it looks closer to (942-321)$ revenue, not sure why

obadiaa commented 3 years ago

https://etherscan.io/tx/0x21bdb4fffb209d6f7f0a28df5cfd6b8f736bc5ad529a1d33eba0c661476d826e this is an arb of profit ~1ETH classified as $217k in our db, it looks like we ignore either the first or second step of ETH transfer to either Uniswap or Uniswap

Another example: https://etherscan.io/tx/0xf67ec3abc9ce22be956ca7efa951115834fc37541f75f2e0da8b1b27c5370563