# Base ERC-20 Allowance & Approval Risk Audit

> Base ERC-20 Allowance & Approval Risk Audit is a paid API for AI agents from x402-data-api.bodhinindustries.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Checks an ERC-20 token allowance on Base chain for a given owner/spender pair, returning drainable exposure, risk flags, Permit2 sub-allowance details, and an actionable recommendation — all computed live from raw chain data.

## Facts

- Endpoint: GET https://x402-data-api.bodhinindustries.workers.dev/allowance
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base-erc-20-allowance-approval-risk-audit-239cd2d1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_cczE62XQyYfOVqjUP6ZL4

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 base-erc-20-allowance-approval-risk-audit-239cd2d1
```

Example prompt: Can you audit the USDC allowance that my wallet 0xABC...123 has granted to the Uniswap Universal Router (0xEF1c6E67703c7BD7107eed8303Fbe6EC2554BF6B) on Base — I want to know if it's unlimited, what my drainable exposure is, and whether I'm over-approved?

## When to prefer this

Choose this endpoint when you need a live, chain-computed audit of an ERC-20 token approval on Base — especially when you want risk flags, drainable exposure, and an actionable recommendation rather than a raw allowance number. Prefer this over generic block explorers when you need structured, agent-consumable output with Permit2 awareness and no reliance on third-party data providers.

## Known failure modes

- Invalid or malformed Ethereum address returns an error response
- Token contract does not exist on Base — returns error or zero allowance
- Network/RPC failure causes a 5xx or timeout
- Permit2 via address provided when spender is not Permit2 — ignored or may error
- Amount parameter in incorrect format (non-numeric string) may cause parsing failure

## How this service works

Self-computed Base onchain toolkit for AI agents: ERC-20 safety scan, manipulation-resistant TWAP price oracle, gas/fee oracle, calldata decoder, token/address/contract intel, wallet approval-risk audit, and batch token triage — all computed live from raw Base chain, no third-party data.

## Output

Returns the current ERC-20 allowance (formatted as 'unlimited' or a human amount), the owner's token balance, the drainable exposure (min of allowance and balance), whether the allowance is unlimited, whether the spender is Permit2, any risk flags, and a recommendation string ('no_allowance' | 'needs_increase' | 'over_approved' | 'ok'). All data is computed live from the Base chain with no third-party data sources.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "owner",
  "token",
  "spender"
 ],
 "properties": {
  "via": {
   "type": "string",
   "description": "Optional downstream spender for the Permit2 sub-allowance (only when spender is Permit2)."
  },
  "owner": {
   "type": "string",
   "description": "Address that granted the approval."
  },
  "token": {
   "type": "string",
   "description": "ERC-20 whose allowance to check."
  },
  "amount": {
   "type": "string",
   "description": "Optional human amount to test sufficiency against."
  },
  "spender": {
   "type": "string",
   "description": "Approved spender to check (router, Permit2, vault)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "block": {
   "type": "integer",
   "description": "Base block height"
  },
  "owner": {
   "type": "string",
   "description": "owner"
  },
  "token": {
   "type": "string",
   "description": "token"
  },
  "symbol": {
   "type": "string",
   "description": "symbol"
  },
  "spender": {
   "type": "string",
   "description": "spender"
  },
  "riskFlags": {
   "type": "array",
   "items": {
    "type": "string"
   }
  },
  "computedAt": {
   "type": "string",
   "description": "ISO-8601 timestamp"
  },
  "isUnlimited": {
   "type": "boolean",
   "description": "near-max allowance"
  },
  "sufficientFor": {
   "type": "boolean",
   "description": "covers ?amount (or null)"
  },
  "recommendation": {
   "type": "string",
   "description": "no_allowance | needs_increase | over_approved | ok"
  },
  "spenderIsPermit2": {
   "type": "boolean",
   "description": "spender is canonical Permit2"
  },
  "allowanceFormatted": {
   "type": "string",
   "description": "'unlimited' or human amount"
  },
  "thirdPartyDataUsed": {
   "type": "boolean",
   "description": "always false"
  },
  "ownerBalanceFormatted": {
   "type": "string",
   "description": "owner balance"
  },
  "drainableExposureFormatted": {
   "type": "string",
   "description": "min(allowance,balance)"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base-erc-20-allowance-approval-risk-audit-239cd2d1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-data-api.bodhinindustries.workers.dev](https://www.zero.xyz/host/x402-data-api.bodhinindustries.workers.dev/llms.txt)
