# On-Chain DEX Swap Quote (Base)

> On-Chain DEX Swap Quote (Base) is a paid API for AI agents from x402-audit.tatschluizguilherme.workers.dev, paid per call via x402, $0.1/call, status unknown (last checked 2026-09-16).

Returns swap quote (amountOut, spot price, price impact, minOut slippage guards) for any ERC-20 pair on Base using Uniswap V3 or Aerodrome V2 pool reserves

## Facts

- Endpoint: GET https://x402-audit.tatschluizguilherme.workers.dev/swap
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/on-chain-dex-swap-quote-base-9d7decc5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__R8R8YdMQgBANfAuQUSXC

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability on-chain-dex-swap-quote-base-9d7decc5
```

Example prompt: Can you get me a swap quote for converting 1000 USDC to WETH on Base — I want to see the amountOut, spot price, price impact, and the minimum I'd receive with 0.5% slippage protection?

## When to prefer this

Choose this endpoint when you need an on-chain, trustless swap quote computed directly from pool reserves on Base — particularly when you want Uniswap V3 best-liquidity-pool selection or Aerodrome V2 routing with automatic WETH fallback, and need slippage guards (minOut) baked into the response. Prefer this over market price APIs when you need the actual executable DEX price rather than a reference price, or when building a trading bot that must set minOut before submitting a transaction.

## Known failure modes

- No liquidity pool found for the requested token pair — returns error if neither direct nor WETH-routed pool exists on Base
- Invalid token address — returns error if tokenIn or tokenOut is not a valid ERC-20 contract on Base
- Zero or negative amountIn — returns validation error
- RPC connectivity issue with Base network — may return timeout or internal error
- Token pair exists but pool has insufficient liquidity to price the trade accurately

## How this service works

Pay-per-call on-chain API for AI agents and developers: wallet audits, token safety audits (honeypot detection), live gas prices, token prices, transaction receipts, balances, ENS resolution, block data, ERC-20 allowances, transaction simulation, swap quotes and multicall batches — all computed on-chain via public RPCs (no external market API). Pay per request in USDC on Base via the x402 exact scheme (EIP-3009 transferWithAuthorization). No API key, no signup, no subscription.

## Output

Returns the computed amountOut for the given amountIn, the spot price between the two tokens, the price impact percentage of the trade, minimum output amounts at 0.5% and 1% slippage thresholds, and the DEX route used (direct Uniswap V3 pool, Aerodrome V2 pool, or WETH-intermediated route) — all derived from on-chain pool reserves without calling any external market price API.

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "note": "Quote on current block state, constant-product within the current tick (V3) / 0.3% fee (V2). priceImpactPct includes pool fees; slippagePct is the price movement only. Execution on a router may differ; use minOut as your slippage guard.",
  "route": [
   {
    "fee": 3000,
    "kind": "uniswap-v3",
    "pool": "0x6c561b446416e1a00e8e93e221854d6ea4171372",
    "amountIn": "1000000",
    "amountOut": "532154915082329"
   }
  ],
  "feePct": 0.3,
  "minOut": {
   "slippage1": "526833365931505",
   "slippage0_5": "529494140693067"
  },
  "network": "base",
  "tokenIn": {
   "symbol": "USDC",
   "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
   "decimals": 6
  },
  "amountIn": {
   "wei": "1000000",
   "formatted": "1"
  },
  "tokenOut": {
   "symbol": "WETH",
   "address": "0x4200000000000000000000000000000000000006",
   "decimals": 18
  },
  "amountOut": {
   "wei": "532154915082329",
   "formatted": "0.00053215"
  },
  "spotPrice": "0.00053375",
  "routeFound": true,
  "blockNumber": 24400123,
  "requestedAt": "2026-08-05T01:50:00.000Z",
  "slippagePct": 0,
  "executionPrice": "0.00053215",
  "priceImpactPct": 0.3
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/on-chain-dex-swap-quote-base-9d7decc5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-audit.tatschluizguilherme.workers.dev](https://www.zero.xyz/host/x402-audit.tatschluizguilherme.workers.dev/llms.txt)
