Skip to main content
Use this when your contract calls the aggregator: a router, a vault or an intent settler. If your backend just needs a transaction for a user to sign, use the API’s /quote/build instead and skip this page. The full contract reference is in Aggregator v3.

1. Import the client

The WASM on chain is the interface. Fetch it once and import it:
contractimport! generates aggregator::Client and every wire type (Route, Hop, SoroswapHop, AquaHop, SushiHop, CometHop, PhoenixHop, Partner).

2. Build the routes

A route names the pools, in order, that take token_in to token_out, like the single-pool example below. The route amounts must add up to amount_in - fee, with fee = floor(amount_in * bps / 10000).

3. Authorize the token pull, then call

The aggregator pulls token_in from user with transfer. When user is your contract, that transfer happens one call below your own, so your contract must authorize it explicitly:
delivered is credited to me. Forward it wherever your contract needs it.

Example: USDC to deJTRSY through a SushiSwap V3 pool

This contract was deployed and run on mainnet on 2026-10-08:
The call used these values: The swap delivered 0.4865 deJTRSY to the contract. See the transaction. The same swap from an account, with the user signing (no authorize_as_current_contract needed), in both directions: USDC → deJTRSY and deJTRSY → USDC.

Checklist

  • Call CARVQXFP4JF5ELLXUMQ6DALR346YVGBMQOHB4ENA7SSVXAYABXLBDDC4, not the deprecated CAYP3U… aggregator.
  • Make the route amounts add up to amount_in - fee, with the same partner the quote was priced with.
  • Set zero_for_one = (token_in == pool.token0()) on every Sushi hop.
  • Sort each Aquarius step’s token set by Address order, not string order.
  • When user is a contract, authorize token_in.transfer(user, aggregator, amount_in).
  • Set min_out from your own slippage tolerance. It is the only price guarantee: the aggregator calls each venue with no real per-hop minimum (0 or 1, or none for SushiSwap and Phoenix) and checks only the total at the end.