A swap trades any token for any other through the ZKDepth Router, which chains up to three hops across ZKDepth pools, public Uniswap v4 pools and Pons launches in one transaction. The Router charges no fee of its own, so you pay only the fees of the pools you cross.
A route is a list of hops
| Kind | Venue | Direction flag |
|---|---|---|
0 | any Uniswap v4 pool | zeroForOne: currency0 goes in |
1 | a ZKDepth DLMM pair | swapForY: token X goes in |
2 | a Pons bonding curve | isBuy: the pair token goes in |
3 | WETH | wraps or unwraps, and does not count toward the three |
Each hop must start in the token the previous one ended in, and ETH and WETH count as one asset. A v4 hop must consume its whole input, and a Pons hop works only before the token graduates. Your minimum, checked once at the end, is the only price bound in a swap.
The Router swaps through any hop it is given. The app builds hops only from ZKDepth's own pools, hookless public v4 pools and pools the Pons factory created.
How the app picks a route
- 1Gather the poolsZKDepth's pools, the Pons venue of either token, and public v4 pools that hold in-range liquidity. Hookless only, because a hook can run arbitrary code during a swap.
- 2Build candidatesEvery pool holding both tokens, and every two-hop route through USDG, ETH or a Pons pair token, up to 40.
- 3Quote and rank
quoteExactInruns each candidate through aneth_callevery 15 s, and the routes rank by output. The best route through a ZKDepth DLMM pair moves to the top unless it pays 15 % or more below the leader. - 4Measure the impactThe leading route's rate against a quote for 1/1000 of the amount on the same hops, so the pool fees cancel out.
Before you sign
The minimum you sign is the leading quote less your slippage. The page shows it with the rate, the price impact and up to four other routes.
| Name | Allowed | Default | Effect |
|---|---|---|---|
Slippage | 0 - 50 % | 0.5 % | Becomes minAmountOut. Above 5 % needs an acknowledgement. |
Impact warning | fixed | 1 % | Impact shown as a warning. |
Impact confirm | fixed | 5 % | You must accept the impact to swap. |
Impact block | fixed | 15 % | The swap is refused. |
Deadline | fixed | 20 min | Passed to swapExactIn. 10 min in the trade terminal. |
WETH to ETH on its own skips the Router: the page unwraps it with WETH's own withdraw, with no approval. The same swap from a private balance runs in the immediate lane.
Buy and Sell in the trade terminal
The terminal normally trades the asset's Uniswap pool through the Universal Router: approve, Permit2, swap, with ZKDepth's 25 bps fee on the output. When a live Router quote pays more than that estimate, the trade goes through the ZKDepth Router instead, with one exact approval and no 25 bps fee. The terminal does not apply the Swap page's impact gates, so use the Swap page for a large trade.
contracts/src/venue/periphery/Router.solswapExactIn, quoteExactIn, routeTokenspackages/agent/src/route/route.tshop encoding, candidates, ranking, price impactapps/web/lib/amm/useSwapRoutes.tsthe live quote loop behind every page