/arbitrage

ArbitrageSearch.sol searches for and returns profitable arbitrage trade paths that always start and end with WETH (meaning all arbitrage profits are then in WETH).

The search takes advantage of the mechanism that all tokens on Salty.IO are paired with both WETH and USDC. As such, all pools in the resulting arbitrage path must exist.

There are six possible arbitrage paths (which depend on which tokens are initially swapped by the user). You'll notice that the direction of the user swap is reversed inside of the arbitrage swap path.

The arbitrage trade effectively uses some of the reserves in other pools to offset the impact of the user's original swap.

User SwapArbitrage Path

USDC->WETH

WETH->USDC->USDT->WETH

WETH->USDC

WETH->USDT->USDC->WETH

WETH->token

WETH->USDC->token->WETH

token->WETH

WETH->token->USDC->WETH

token1->token2

WETH->token2->token1->WETH

Fixed possible paths are used to keep gas costs "low" - as the arbitrage is attempted with every user swap.

The user swap is always performed first before the arbitrage (within the same transaction). Every pool that takes part in the arbitrage swap is entitled to receive SALT rewards proportional to the amount of arbitrage profits contributed. Rewards are distributed in the call to performUpkeep.

The swap, arbitrage search and multi-pool arbitrage trades are well optimized gas-wise and use a total of 115k gas within a single transaction for everything.

Last updated