# Uniswap v4 Hook Security Scanner & Rug-Check API

> Uniswap v4 Hook Security Scanner & Rug-Check API is a paid API for AI agents from x402.donnyautomation.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Decodes all 14 Uniswap v4 hook permission bits from a contract address on Base mainnet, flags security risks (swap custody, fee-taking, upgradeable proxies), and returns a custody class and risk profile for pre-trade safety gating.

## Facts

- Endpoint: GET https://x402.donnyautomation.com/v4hooks
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/uniswap-v4-hook-security-scanner-rug-check-api-c9c67979
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Dvbc1bo0SUflbVoagardA

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-v4-hook-security-scanner-rug-check-api-c9c67979
```

Example prompt: Before I swap on this Uniswap v4 pool, can you scan the hook at 0x1234567890abcdef1234567890abcdef12345678 on Base mainnet and tell me its custody class and any risk flags — specifically whether it takes fee custody or is upgradeable?

## When to prefer this

Use this endpoint when you need to perform pre-trade safety analysis specifically for Uniswap v4 hooks on Base mainnet. Prefer it over generic contract scanners because it decodes all 14 v4-specific hook permission bits and classifies custody class per Uniswap v4-core semantics, with multi-source verification consensus. Ideal for DEX routers, trading bots, and token scanners that need a fast, cheap ($0.01/call) machine-readable risk gate before executing swaps.

## Known failure modes

- Invalid or malformed address (not 0x + 40 hex chars) returns error
- Address not on Base mainnet returns no data or error
- Unverified contract with no source returns OPAQUE custody class
- Network or RPC timeout on Base mainnet causes degraded response
- Non-hook contract address returns unexpected permission bit profile

## How this service works

Uniswap v4 hook capability scan on Base mainnet. Decodes all 14 permission bits from the hook address per v4-core Hooks.sol, flags swap custody, fee-taking and EIP-1967 upgradeability, and verifies source by Basescan/Sourcify/Blockscout consensus. Returns custodyClass PASSIVE|FLOW_CONTROL|FEE_TAKING|SWAP_CUSTODY|OPAQUE, flags[], riskFlags[] and verificationState. Requires ?address=0x + 40 hex. Errors: 400 invalid_address, 502 analysis_failed. Capability analysis - it never outputs SAFE.

## Output

Returns the hook's custody class (one of PASSIVE, FLOW_CONTROL, FEE_TAKING, SWAP_CUSTODY, or OPAQUE), all 14 decoded permission bits per Uniswap v4-core Hooks.sol, specific risk flags (swap custody, fee-taking, EIP-1967 upgradeability), and source verification state via Basescan/Sourcify/Blockscout consensus. Never returns a blanket SAFE verdict — only a capability and risk analysis.

## 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",
     "required": [
      "address"
     ],
     "properties": {
      "address": {
       "type": "string",
       "description": "Uniswap v4 hook contract address on Base mainnet (0x + 40 hex chars)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "flags": [
   "beforeSwap",
   "afterSwap",
   "beforeSwapReturnDelta",
   "afterSwapReturnDelta"
  ],
  "address": "0x000052423c1db6b7ff8641b85a7eefc7b2791888",
  "chainId": 8453,
  "network": "base",
  "deployed": true,
  "verified": true,
  "riskFlags": [
   "SWAP_DELTA_CUSTODY"
  ],
  "disclaimer": "Capability analysis of on-chain state. We classify what a hook CAN do; we never output SAFE.",
  "upgradeable": false,
  "custodyClass": "SWAP_CUSTODY",
  "verificationState": "VERIFIED"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/uniswap-v4-hook-security-scanner-rug-check-api-c9c67979/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.donnyautomation.com](https://www.zero.xyz/host/x402.donnyautomation.com/llms.txt)
