On this page

Swaps

Use an approved Uniswap route and receive the returned tokens as a private note.

How a swap works#

The adapter takes private input and calls the public swap venue. The action sets who owns the resulting private note. The Pool measures the returned tokens and reverts if they fall below the user's minimum.

The repository includes Uniswap V3 adapters for individual directions and multi-step plans. The default historical fork routes swap USDC and WETH. Look up your deployment's catalog to find which pairs and Uniswap versions it actually serves.

Pending, Active and Settled notes
Pending, Active and Settled notes

Review the quote#

Choose the input amount, output token and an admitted route. The quote reads one canonical block and checks the router, factory, pool and token identities against the route's configuration. Show its expected output separately from the minimum that the proof will enforce.

Price and liquidity may move after quoting. If the minimum cannot be met, execution reverts and the input stays unspent. Getting a new quote does not revoke a proof you already shared.

Review itemCheck
InputAtomic amount and token address
OutputSupported token and display precision
RouteAdmitted adapter, operation and swap direction
MinimumThe output floor approved after choosing slippage
FeesThe authorized relay fee and any venue fee
AccountPrivate result owner and any controller

What the adapter can call#

The V3 adapter accepts an exact-input swap only from its Pool. Deployment fixes its direction, router and pair; users cannot pass arbitrary router calldata. The adapter returns tokens to the Pool, clears the temporary allowance and checks the balance changes.

The WETH route swaps an ERC-20. It does not add native ETH, LP provision or arbitrary pool selection. A new pair or dependency needs publisher review and admission.

Recover the output#

Immediate settlement appends the measured output within the swap transaction. For two-stage settlement, finish the reserved receipt's append before showing the result as spendable.

Recover the output note from authenticated history. The quoted amount and venue event help explain the swap, but the account needs its own validated note before it can spend the result.

If route identity changes#

Stop submission if the router, adapter or token no longer matches the approved configuration, or if the route is no longer admitted. Keep the original notes available. Changing venues requires another user review.

Test withdrawal of the output token separately from swapping it back. WETH can leave the Pool as WETH without reverse-swap liquidity, subject to the token working and the chain processing the withdrawal.