A Typical Arbitrage Example

A typical Arbitrage example involves 3 tokens and 3 liquidity pools identified by EigenPhi:

We use the six steps mentioned earlier to determine whether a transaction is an Arbitrage:

Steps 1 & 2: Parse the transfers in the transaction and draw a directed graph based on the transfers.

Step 3: Identify the strongly connected components in the graph and create a combined transfer table based on it.

The result is that the original graph is the strongly connected components.

Then we can create a combined transfer table based on the graph above.

From

To

Asset

Amount

MEV Bot 0x80d

SushiSwap USDC 0x397

USDC

76860.06

SushiSwap USDC 0x397

SushiSwap USDT 0x06d

WETH

38.232

SushiSwap USDT 0x06d

MEV Bot 0x80d

USDT

77666.66

Uniswap V3 USDC-USDT 0x785

MEV Bot 0x80d

USDC

77406.53

MEV Bot 0x80d

Uniswap V3 USDC-USDT 0x785

USDT

77666.66

The TransferTable of the transaction:

USDC

WETH

USDT

MEV Bot 0x80d

-76860.06

SushiSwap USDC 0x397

+76860.06

SushiSwap USDC 0x397

-38.232

SushiSwap USDT 0x06d

+38.232

SushiSwap USDT 0x06d

-77666.66

MEV Bot 0x80d

+77666.66

Uniswap V3 USDC-USDT 0x785

-77406.53

MEV Bot 0x80d

+77406.53

MEV Bot 0x80d

-77666.66

Uniswap V3 USDC-USDT 0x785

+77666.66

The resulted CombinedTransferTable:

Address

USDC

WETH

USDT

Trade?

SushiSwap USDC 0x397

76860.06

-38.232

True

SushiSwap USDT 0x06d

38.232

-77666.66

True

Uniswap V3 USDC-USDT 0x785

-77406.53

77666.66

True

MEV Bot 0x80d

546.47

False

Step 4: Find the closest point to the "from" or "to" address of the transaction in the above strongly connected components.

In view that the "to" address is already in the graph, the closest point is the "to" address itself.

Steps 5 & 6: Calculate the profit of the point (Address) in Step 4, and determine whether it is positive.

(77,406.53 - 76,860.06) USDC + (77,666.66 - 77,666.66) USDT > 0

Therefore, we identify this transaction as an Arbitrage.

Last updated