This is a MEV (Maximal Extractable Value) bot contract designed to perform sandwich attacks and arbitrage on decentralized exchanges. Here's a breakdown of what it does:
- Owner:
0x6c8ec8f14be7c01672d31cfa5f2cefeab2562b50 - Target DEX:
0x764c64b2a09b09acb100b80d8c505aa6a0302ef2(likely a DEX router) - Token:
0xf65b5c5104c4fafd4b709d9d60a185eae063276c(token being traded)
// Performs sandwich attack with miner bribe
function attack(uint256 bribeAmount) external onlyOwner {
// Loop through 5 stored pool addresses
for (uint i = 0; i < 5; i++) {
address pool = pools[i];
// 1. Get quote from pool
uint256 amountOut = pool.getAmountOut(poolAddress);
// 2. If profitable, buy tokens
if (amountOut <= balance) {
pool.swap(poolAddress, amountOut);
// 3. Check token balance
uint256 tokenBalance = token.balanceOf(address(this));
// 4. Approve and sell tokens back
token.approve(pool, tokenBalance);
pool.sell(tokenBalance);
// 5. Calculate profit
uint256 profit = currentBalance - initialBalance;
// Emit trade event
}
}
// 6. Pay miner bribe to get transaction included first
require(profit > bribeAmount, "Not profitable after bribe");
block.coinbase.transfer(bribeAmount);
// 7. Withdraw remaining profit to owner
owner.transfer(address(this).balance);
}// Similar attack without specifying bribe amount
// Loops through same 5 pools performing trades// Single-pool attack with specific parameters
// Takes pool address and bribe amount as inputswithdraw()- Sends all ETH to ownerwithdrawToken(address)- Sends all tokens of specified address to ownerowner()- Returns owner addresstarget()- Returns target DEX address
- Monitor mempool for large pending trades
- Front-run: Submit transaction with higher gas to execute BEFORE victim
- Buy tokens, driving price up
- Victim's transaction executes at worse price
- Back-run: Immediately sell tokens at profit
- Bribe miner with part of profits to ensure transaction ordering
- Withdraw profits to owner
- ✗ Exploits transaction ordering for profit
- ✗ Harms regular users by increasing their slippage
- ✗ Uses miner bribes (payments to
block.coinbase) to guarantee execution order - ✗ Multiple attack vectors for flexibility
- ✗ Hardcoded pools array for quick execution
This is a classic MEV sandwich attack bot that extracts value from unsuspecting traders on DEXs.