Skip to content
PATHIEL

Method

How a route is computed here, and where the numbers stop being reliable.

1

How it works

Discovery — what gets quoted

Nothing is hardcoded but factory addresses. For a pair the router asks Uniswap V2, SushiSwap and BaseSwap for their pair, Aerodrome for both its stable and volatile pool, and lists the fee tiers of each concentrated-liquidity deployment — Uniswap V3 and PancakeSwap V3 — then repeats all of that through WETH and USDC as intermediates. A two-hop route is a candidate on the same footing as a direct one.

The candidate set is deliberately wide and pruned by price rather than guesswork: every candidate is quoted once at full size, and only the best six get the full ladder. Laddering all of them would be roughly a hundred and eighty contract calls.

Quoting — where prices come from

Constant-product venues are priced off-chain from reserves, with the fee numerator that fork actually charges — BaseSwap takes 25bp where Uniswap V2 takes 30. Once reserves are known the whole ladder is arithmetic, multi-hop included, since a two-hop route is the same function applied twice. All arithmetic is bigint.

Aerodrome and the V3 deployments are quoted on-chain. A Solidly stable curve and a concentrated-liquidity tick walk can be reimplemented off-chain, and a reimplementation that drifts by one tick is worse than none.

Solving — why it splits

Each venue is quoted at a geometric ladder of sizes, producing an output curverather than a number. Because a pool’s output is concave in size, handing each successive slice to whichever venue offers the best marginal rate converges on the optimum — the water-filling argument.

Interpolation between rungs is piecewise-linear, which on a concave function underestimates. That is the safe direction: the solver will never believe a venue is deeper than it is.

Splitting is then charged for what it costs. A split that wins 3bp on a trade whose extra hop costs 6bp of gas is a loss, and the recommendation needs a full basis point of daylight before it changes.

Gas — priced without an oracle

Comparing a split to a single route needs both sides in one unit, and the extra cost is in ETH while the benefit is in the token being bought. Rather than a price feed, the router converts gas through the same pools it already quoted. The extra-hop cost is 70,000 gas, measured on a mainnet fork as the marginal cost of a second swap.

2

Verification

The central claim is checked rather than asserted: the off-chain quote is compared against a real fill on a mainnet fork and has to match to the wei.

What each suite proves

Prediction quotes a set of trades at a pinned block, forks that exact block, executes them against the deployed routers, and compares. Tolerance is 1bp; measured drift is zero.

Unit tests cover the arithmetic at edges the chain rarely visits — empty pools, one-wei trades, collapsed ladders, the interpolation lower bound the splitter depends on.

Address and token checks assert every hardcoded address still has bytecode and every token’s on-chain symbol and decimals match the table. A right address with wrong decimals misprices by a factor of a thousand, silently.

Gas profile measures the constants the router makes decisions with, so a guessed number cannot quietly bias every routing choice.

3

Custody

This project holds nothing. Swaps execute through Uniswap’s, PancakeSwap’s and Aerodrome’s own deployed routers. No approval is ever granted to it, because it has no contract deployed.

What a bug here could actually cost

A bad quote, not a balance. The minimum-output floor is enforced on-chain by the venue’s router; if the price moves past it the trade reverts rather than filling badly.

Approvals are for the exact trade amount, not type(uint256).max. Infinite approval is the convention and it is why a router bug drains wallets months later.

contracts/SplitRouter.sol would take custody mid-trade. It is written, fork-tested, and deliberately not deployed.

4

Limitations

Two hops maximum
Routes go A→B or A→X→B where X is WETH or USDC. Three-hop routes are not searched.
Execution is single-venue
The solved split is analysis until the router contract is deployed.
No Uniswap V4
Quotable today, but it settles through UniversalRouter with Permit2 rather than a router call. This app does not quote what it cannot execute.
No MEV protection
Transactions go to the public mempool. Base’s sequencer is first-come rather than an auction, which limits sandwiching relative to L1, but that is not a guarantee.
Fee-on-transfer tokens unsupported
The quote assumes the amount sent is the amount the pool receives.
Quotes expire after 30 seconds
A backstop against a tab left open, not a freshness guarantee. Base blocks are two seconds.
Public RPC rate limits
Set RPC_URL for anything beyond casual use.

API

openapi.json
/api/quoteThe solved route and every venue curve behind it.
/api/analyzeSandwich exposure, measured slippage, capacity, fragmentation, round trip.
/api/cyclesArbitrage loops across the token graph.
/api/venuesEvery pool considered, including mid-route ones, with balances.
/api/streamServer-sent quotes, pushed when a block changes the answer.
/api/healthChain height and block age. 503 when the head goes stale.

No authentication — every endpoint reads public chain state. Rate limited to 120 requests per minute per IP.

Independence

unaffiliated Not connected to Uniswap, Aerodrome, PancakeSwap, SushiSwap, BaseSwap, Coinbase or OKX. It reads their public contracts and routes to their public routers, which is what those contracts are for. All names are used descriptively.

It holds no API keys and depends on no commercial data provider. That is a design constraint, not a cost saving: a router whose prices come from an aggregator cannot be checked against that aggregator.