finds.dev← search

// the find

paco0x/amm-arbitrageur

★ 1,998 · Solidity · WTFPL · updated Dec 2022

An arbitrage bot between Uniswap AMMs

A proof-of-concept flash loan arbitrage bot that exploits price differences between Uniswap V2-compatible AMMs on Ethereum and BSC. It derives the optimal borrow amount analytically by solving a quadratic equation from the AMM constant-product formula, then executes the full arb atomically via a Solidity contract. The author is upfront that this is a POC and abandoned — not a production system.

The math is actually worked out properly — deriving the profit-maximizing input size via the quadratic solution rather than just binary-searching is the right approach and saves gas. The flash swap pattern means zero capital at risk: if the arb isn't profitable after fees, the transaction reverts and you lose only gas. Tests use Hardhat mainnet forking against real BSC state, which actually exercises the contract against real reserves rather than fake numbers. The bot auto-enumerates pair combinations from token lists and caches them to JSON, so you don't have to hardcode every pair.

Unmaintained since 2022 and the author says so in the first line — several of the BSC AMMs listed (JulSwap, ValueDeFi, MDEX) are effectively dead, so the pairs-bsc.json will be full of stale pools. No MEV protection: no Flashbots bundle submission, no private mempool, just a plain public transaction that any MEV bot can front-run once they see it pending. The TypeScript bot polls in a loop over all pairs sequentially, which means latency scales with the number of pairs — any serious competitor will be running event-driven monitoring with their own node. Profit calculation doesn't account for gas cost, so the bot will attempt arbs that are technically profitable on-chain but negative after gas.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →