hyperd.contract.audit
Audit any contract before trading. Combines GoPlus, Sourcify, DefiLlama, and on-chain heuristics into a 0-100 risk score with structured findings. Costs $0.10 USDC.
Instructions
Pre-trade contract security audit. Composes GoPlus + Sourcify + DefiLlama protocol recognition + on-chain heuristics into a single 0-100 risk score with structured findings. Use BEFORE interacting with any unfamiliar contract. Costs $0.10 in USDC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contract | Yes | Contract address to audit | |
| chain | No | Chain. Default 'base'. |
Implementation Reference
- src/server.ts:79-92 (helper)paidGet helper function that signs and sends x402 payment requests to the hyperD API backend. Used by the hyperd.contract.audit tool handler to call GET /api/contract/audit.
async function paidGet( path: string, query: Record<string, string | number | boolean | undefined>, ): Promise<unknown> { if (!httpClient) { throw new Error(WALLET_NOT_CONFIGURED_MSG); } const url = new URL(`${API_BASE}${path}`); for (const [k, v] of Object.entries(query)) { if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v)); } return paidRequest("GET", url, undefined); } - src/server.ts:322-334 (registration)Registration of the 'hyperd.contract.audit' tool via server.tool(). Defines tool name, description, input schema (contract address + optional chain), and handler that calls paidGet('/api/contract/audit').
// hyperd.contract.audit — pre-trade contract security ($0.10) server.tool( "hyperd.contract.audit", "Pre-trade contract security audit. Composes GoPlus + Sourcify + DefiLlama protocol recognition + on-chain heuristics into a single 0-100 risk score with structured findings. Use BEFORE interacting with any unfamiliar contract. Costs $0.10 in USDC.", { contract: z.string().describe("Contract address to audit"), chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]) .optional() .describe("Chain. Default 'base'."), }, async (args) => asText(await paidGet("/api/contract/audit", args)), ); - src/server.ts:326-332 (schema)Input schema for hyperd.contract.audit using Zod validation: 'contract' (required string) and 'chain' (optional enum of supported EVM chains).
{ contract: z.string().describe("Contract address to audit"), chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]) .optional() .describe("Chain. Default 'base'."), }, - src/server.ts:333-333 (handler)Handler function for hyperd.contract.audit. Async lambda that awaits paidGet('/api/contract/audit', args) and wraps the result via asText().
async (args) => asText(await paidGet("/api/contract/audit", args)),