{
  "$comment": "GENERATED FROM api/_tools/<slug>/route.mjs — do not edit by hand",
  "type": "https://eips.ethereum.org/EIPS/eip-8257#tool-manifest-v1",
  "name": "erc20-approval-audit",
  "description": "Audit recent Base ERC-20 approvals for a wallet before an agent spends or routes funds. Scans Approval(owner,spender,value) logs, collapses by token+spender, reads live allowance() for each pair, flags infinite approvals, and returns block/tx evidence. Uses public Base RPC fallbacks. $0.03 USDC per call; AXIOM Tool Pass holders get free access.",
  "endpoint": "https://www.clawbots.org/api/tools/erc20-approval-audit",
  "image": "https://www.clawbots.org/tools/icons/erc20-approval-audit.png",
  "featuredImage": "https://www.clawbots.org/tools/featured/erc20-approval-audit.png",
  "inputs": {
    "type": "object",
    "properties": {
      "owner": {
        "type": "string",
        "description": "Base wallet address whose ERC-20 approvals should be audited (0x...).",
        "pattern": "^0x[a-fA-F0-9]{40}$"
      },
      "lookbackBlocks": {
        "type": "integer",
        "minimum": 1000,
        "maximum": 250000,
        "default": 50000,
        "description": "Recent Base block window to scan for Approval events. Larger windows are slower and may hit public RPC limits."
      },
      "maxApprovals": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100,
        "default": 40,
        "description": "Maximum discovered token+spender pairs to verify with live allowance() reads."
      },
      "includeRevoked": {
        "type": "boolean",
        "default": false,
        "description": "Include discovered pairs whose current live allowance is zero."
      }
    },
    "required": [
      "owner"
    ],
    "additionalProperties": false
  },
  "outputs": {
    "type": "object",
    "properties": {
      "owner": {
        "type": "string"
      },
      "chain": {
        "type": "string"
      },
      "latestBlock": {
        "type": "integer"
      },
      "fromBlock": {
        "type": "integer"
      },
      "lookbackBlocks": {
        "type": "integer"
      },
      "approvalLogsScanned": {
        "type": "integer"
      },
      "distinctTokenSpendersSeen": {
        "type": "integer"
      },
      "activeApprovals": {
        "type": "integer"
      },
      "infiniteApprovals": {
        "type": "integer"
      },
      "riskScore": {
        "type": "integer",
        "description": "0-100 heuristic: infinite approvals dominate, finite live approvals add smaller risk."
      },
      "summary": {
        "type": "string"
      },
      "approvals": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "token": {
              "type": "string"
            },
            "tokenSymbol": {
              "type": [
                "string",
                "null"
              ]
            },
            "tokenName": {
              "type": [
                "string",
                "null"
              ]
            },
            "decimals": {
              "type": [
                "integer",
                "null"
              ]
            },
            "spender": {
              "type": "string"
            },
            "currentAllowanceRaw": {
              "type": "string"
            },
            "infinite": {
              "type": "boolean"
            },
            "risk": {
              "type": "string",
              "enum": [
                "none",
                "medium",
                "high"
              ]
            },
            "lastApprovalRaw": {
              "type": "string"
            },
            "lastApprovalBlock": {
              "type": "integer"
            },
            "lastApprovalTx": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "token",
            "spender",
            "currentAllowanceRaw",
            "infinite",
            "risk",
            "lastApprovalRaw",
            "lastApprovalBlock",
            "lastApprovalTx"
          ]
        }
      },
      "fetchedAt": {
        "type": "string",
        "format": "date-time"
      },
      "evidence": {
        "type": "object",
        "properties": {
          "rpcUrls": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "approvalTopic": {
            "type": "string"
          },
          "scannedRanges": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "note": {
            "type": "string"
          }
        }
      }
    },
    "required": [
      "owner",
      "chain",
      "latestBlock",
      "fromBlock",
      "lookbackBlocks",
      "approvalLogsScanned",
      "distinctTokenSpendersSeen",
      "activeApprovals",
      "infiniteApprovals",
      "riskScore",
      "summary",
      "approvals",
      "fetchedAt",
      "evidence"
    ]
  },
  "creatorAddress": "0xef2cc7d15d3421629f93ffa39727f14179f31c75",
  "tags": [
    "base",
    "erc20",
    "approval",
    "allowance",
    "wallet",
    "risk",
    "preflight"
  ],
  "pricing": [
    {
      "amount": "0.03",
      "asset": "USDC",
      "recipient": "0xef2cc7d15d3421629f93ffa39727f14179f31c75",
      "protocol": "x402"
    }
  ],
  "authentication": [
    {
      "type": "siwe",
      "description": "Sign In With Ethereum. Holders of the Axiom Tool Pass NFT get free unlimited access. Sign a SIWE message proving wallet ownership; the server verifies your wallet holds the pass on-chain.",
      "header": "Authorization: SIWE <base64url(message)>.<0xsignature>",
      "passContract": "0xfc9ce3990f85fA1A3a0eE51a710642396a6Cad82",
      "chain": "base",
      "chainId": 8453,
      "collection": "https://opensea.io/collection/axiom-tool-pass"
    },
    {
      "type": "x402",
      "description": "Pay per call in USDC on Base via the x402 protocol. No account or API key needed.",
      "header": "x-payment: <x402 authorization>"
    }
  ],
  "onChain": {
    "registry": "0x265BB2DBFC0A8165C9A1941Eb1372F349baD2cf1",
    "chainId": 8453,
    "toolId": 268
  }
}
