checkHoneypot
Detect honeypot scams in tokens by analyzing buy/sell taxes, risk levels, and honeypot.is data across EVM chains to identify fraudulent contracts.
Instructions
토큰의 허니팟(사기) 여부를 탐지합니다 (매수/매도 세금, 위험도, 플래그, Honeypot.is 기반)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | 토큰 주소 (0x...) 또는 심볼 | |
| chain | No | EVM 체인 | ethereum |
Implementation Reference
- src/tools/checkHoneypot.ts:26-60 (handler)Tool handler function for 'checkHoneypot' which resolves token metadata and invokes the honeypot check utility.
async function handler(args: z.infer<typeof inputSchema>): Promise<ToolResult<HoneypotData>> { const { token, chain } = args; // 토큰 주소 해석 let tokenAddress = token; if (!token.startsWith("0x") || token.length !== 42) { const meta = resolveTokenMeta(token, chain); if (!meta) return makeError(`Token '${token}' not found`, "TOKEN_NOT_FOUND"); const addresses = meta.addresses; tokenAddress = addresses[chain]; if (!tokenAddress) return makeError(`Token '${token}' not available on ${chain}`, "TOKEN_NOT_FOUND"); } try { const result = await checkHoneypotToken(tokenAddress, chain); if (!result) return makeError("Honeypot check failed — API unavailable or unsupported chain", "API_ERROR"); const data: HoneypotData = { token: tokenAddress, tokenName: result.tokenName, tokenSymbol: result.tokenSymbol, isHoneypot: result.isHoneypot, riskLevel: result.riskLevel, buyTax: result.buyTax, sellTax: result.sellTax, flags: result.flags, pairAddress: result.pairAddress, }; return makeSuccess(chain, data, false); } catch (err) { const message = sanitizeError(err); return makeError(`Honeypot check failed: ${message}`, "API_ERROR"); } } - src/tools/checkHoneypot.ts:62-72 (registration)Tool registration for 'checkHoneypot' in the MCP server.
export function register(server: McpServer) { server.tool( "checkHoneypot", "토큰의 허니팟(사기) 여부를 탐지합니다 (매수/매도 세금, 위험도, 플래그, Honeypot.is 기반)", inputSchema.shape, async (args) => { const result = await handler(args as z.infer<typeof inputSchema>); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; }, ); } - src/shared/honeypot.ts:21-83 (helper)Core helper function that interacts with the Honeypot.is API to check token safety.
export async function checkHoneypotToken( tokenAddress: string, chain: string, ): Promise<HoneypotResult | null> { if (!isValidAddress(tokenAddress)) return null; const chainId = CHAIN_IDS[chain as keyof typeof CHAIN_IDS]; if (!chainId) return null; const cacheKey = `honeypot:${chain}:${tokenAddress.toLowerCase()}`; const cached = cache.get<HoneypotResult>(cacheKey); if (cached.hit) return cached.data; try { const res = await fetch( `${BASE_URL}/IsHoneypot?address=${tokenAddress}&chainID=${chainId}`, ); if (!res.ok) return null; const json = (await res.json()) as { honeypotResult?: { isHoneypot: boolean }; simulationResult?: { buyTax: number; sellTax: number; transferTax: number }; contractCode?: { openSource: boolean; isProxy: boolean; hasProxyCalls: boolean }; token?: { name: string; symbol: string; totalHolders: number }; pair?: { address: string; pairName: string }; flags?: string[]; }; const isHoneypot = json.honeypotResult?.isHoneypot ?? false; const buyTax = json.simulationResult?.buyTax ?? 0; const sellTax = json.simulationResult?.sellTax ?? 0; // 위험 플래그 수집 const flags: string[] = []; if (isHoneypot) flags.push("honeypot"); if (buyTax > 10) flags.push("high_buy_tax"); if (sellTax > 10) flags.push("high_sell_tax"); if (json.contractCode?.hasProxyCalls) flags.push("proxy_calls"); if (!json.contractCode?.openSource) flags.push("closed_source"); if (json.flags) flags.push(...json.flags); // 위험도 판정 let riskLevel: "safe" | "warning" | "danger" = "safe"; if (isHoneypot || sellTax > 50) riskLevel = "danger"; else if (buyTax > 10 || sellTax > 10 || flags.length > 2) riskLevel = "warning"; const result: HoneypotResult = { isHoneypot, riskLevel, buyTax: Math.round(buyTax * 100) / 100, sellTax: Math.round(sellTax * 100) / 100, flags: [...new Set(flags)], pairAddress: json.pair?.address ?? null, tokenName: json.token?.name ?? null, tokenSymbol: json.token?.symbol ?? null, }; cache.set(cacheKey, result, HONEYPOT_CACHE_TTL); return result; } catch (err) { logCatchError("honeypot", err); return null; } } - src/tools/checkHoneypot.ts:21-24 (schema)Zod input schema for the 'checkHoneypot' tool.
const inputSchema = z.object({ token: z.string().describe("토큰 주소 (0x...) 또는 심볼"), chain: z.enum(SUPPORTED_CHAINS).default("ethereum").describe("EVM 체인"), });