# Uniswap V2 Swap Output Calculator

> Uniswap V2 Swap Output Calculator is a paid API for AI agents from dominion-data.x402-evm-math.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-20).

Calculates the exact output amount for a Uniswap V2 token swap given pool reserves and input amount

## Facts

- Endpoint: GET https://dominion-data.x402-evm-math.workers.dev/defi/v2-swap?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/uniswap-v2-swap-output-calculator-38b81b43
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_or8cdbzCa2cvDm5Lhex0O

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 uniswap-v2-swap-output-calculator-38b81b43
```

Example prompt: What's the exact token output if I swap 1000 USDC for ETH on a Uniswap V2 pool with reserves of 500,000 USDC and 200 ETH?

## When to prefer this

Choose this endpoint when you need exact, deterministic Uniswap V2 swap output math without making an on-chain call — ideal for agents pre-checking trade outputs, simulating arbitrage paths, or validating slippage before submitting a transaction. Prefer over V3 calculator when dealing specifically with V2 constant-product pools.

## Known failure modes

- Missing required query parameters returns an error
- Zero or invalid reserve values may cause division errors or unexpected results
- Very large input amounts relative to reserves will show extreme slippage in output
- Payment not included or insufficient USDC payment returns 402 Payment Required

## How this service works

Exact EVM address, calldata, Uniswap V2/V3 and impermanent-loss math. Pay per call in USDC on Base via x402.

## Output

Returns a JSON object with `amount_out`, the precise number of output tokens the swap would yield, computed using the Uniswap V2 constant-product formula (x*y=k) with the 0.3% fee deducted.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {}
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "amount_out": "499248..."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/uniswap-v2-swap-output-calculator-38b81b43/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from dominion-data.x402-evm-math.workers.dev](https://www.zero.xyz/host/dominion-data.x402-evm-math.workers.dev/llms.txt)
