How Does a Front-Runner Calculate the Optimal Size for Their Sandwich Attack Trades?
A front-runner uses a sophisticated bot to calculate the optimal size for their sandwich trades based on the victim's order size, the liquidity pool's depth, and the victim's slippage tolerance. The bot aims to maximize the price impact caused by its buy order, ensuring the victim's trade executes at the worst possible price (within the slippage limit), while also minimizing the front-runner's capital exposure and transaction fees.
This involves solving a complex optimization problem using the AMM's formula.