alchemistcoin / sandwiched-backend

GNU General Public License v3.0
25 stars 7 forks source link

Disambiguate consecutive sandwiches #51

Closed henridf closed 3 years ago

henridf commented 3 years ago

We ran into one situation with odd in/out sandwich amounts.

image

The second sandwich is incorrect. That same attacker was busy doing other sandwiches on DVG trades in that block and neighboring blocks, and our detection thought that the closes of the preceding sandwich was an open for the user swap above tx, and the open of the following sandwich was a close for your tx.

This is a bit tricky to fix short of detecting all sandwiches on all users. In the near term, maybe disqualify sandwiches where the input of the close is bigger than the output of the open ? (5.41 vs 4.18).

henridf commented 3 years ago

Another similar example seems to be

image

on wallet 0x5d4377C603d5B677d797Cb025e777e9b6B106EF0

henridf commented 3 years ago

And another:

image

0xebdb626c95a25f4e304336b1adcad0521a1bdca1

this one appears to be arbs. As @Fiddlekins noted:

I've taken a look at the open and close transactions and both seem to be individual arb attempts (the close actually costing more in gas than it profited) On etherscan it's clearer that any interim tokens are just steps along the way, and checking the state tab confirms that the net result is just shuffling some ETH around