finds.dev

libevm/subway

A practical example on how to perform sandwich attacks on Ethereum

View on GitHub

★ 2,204SolidityMITupdated Aug 2023

// the take

An educational reference implementation for sandwiching UniswapV2 swaps: Solidity/Yul+ contracts for the sandwich execution plus a JavaScript bot that reads the mempool, decodes swaps, and fires bundles. It's for developers trying to understand MEV mechanics end-to-end, not for anyone looking to actually run this in production.

Covers the full pipeline rather than just the contract — mempool decoding, profit calculation, gas bribe math, and bundle submission are all there, which is rare for MEV example repos that usually just show the Solidity half. The Yul+ contract keeps the hot path (swap + transfer) minimal, so it's a decent read for anyone learning gas-sensitive low-level Solidity. The README is upfront about what's missing instead of overselling the bot's sophistication.

No uncle bandit protection, by the author's own admission, so running this as-is would get the bot's profit stolen by anyone watching the same mempool. The bot side has zero tests — only the contract has a Foundry test. Last push was August 2023, and mempool-based sandwiching on mainnet has largely moved to private order flow (Flashbots Protect, MEV-Share) since then, so the bot's core assumption — that profitable targets are visible in the public mempool — is increasingly stale. No poison token checks or circuit breakers, which the README flags, but those aren't nice-to-haves, they're most of what separates a toy from something that survives contact with real liquidity.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,204
Forks
523
Language
Solidity
License
MIT
Last commit
2 Aug 2023

// nearby

If subway isn't quite it.

All repos →