DeFi · MEV-resistant DEX · 2026Verified on Arbitrum Sepolia
ClearSwap
A DEX that settles trades in 45-second batch auctions at one uniform price, so there's no ordering to front-run, and it uses 82.5% less gas.
- Gas
- −82.5% vs EVM
- Batch window
- 45s auctions
- Engine
- Rust → WASM
- Tests
- 52 passing
01 The problem
On continuous AMMs, transaction ordering is everything. Bots sandwich trades, priority-gas auctions clog the mempool, and the fastest actor always wins. Moving to an on-chain order book fixes ordering but is far too expensive to compute on the EVM.
ClearSwap collects limit orders into discrete 45-second frequent batch auctions. Every order in a batch clears at one uniform price, so ordering stops mattering. The heavy computation (price sweeping, volume maximisation and pro-rata rationing) runs in a Rust engine compiled to WASM on Arbitrum Stylus, while Solidity contracts handle custody and settlement.
02 How it works
Hover or tap a step
03 What I built
- 01The clearing engine in Rust on Arbitrum Stylus: order sorting, candidate-price extraction, volume evaluation and pro-rata fills.
- 02OrderBook, ClearingAdapter and Settlement contracts in Solidity, with non-prefunded orders (funds stay in traders' wallets until settlement).
- 03A 4-stage invariant check on every engine result before any token moves.
- 04Automatic zero-gas rollovers of unfilled orders into the next batch.
- 0552 tests across the Rust engine and Foundry suites; all contracts verified on Arbiscan.
04 Key decisions
- Dual-VM split: Stylus does the maths, the EVM keeps custody. The adapter never trusts the engine's output blindly.
- Uniform-price clearing gives both sides price improvement and removes the incentive to pay for ordering.
06 Verify it on-chain