← 返回
未分类 Key 中文

Defi Scout

On-chain DeFi intelligence for AI agents. Use when asked about wallet balances, token prices, DEX quotes, yield opportunities, protocol TVL, gas prices, or a...
链上DeFi情报,供AI代理使用。用于查询钱包余额、代币价格、DEX报价、收益机会、协议TVL、Gas价格等。
old-greggyboy
未分类 clawhub v1.0.3 1 版本 100000 Key: 需要
★ 0
Stars
📥 392
下载
💾 0
安装
1
版本
#latest

概述

DeFi Scout

On-chain financial intelligence across Optimism and Base. Most scripts require no API keys. Exception: cmc-sentiment.js requires CMC_API_KEY (free tier at coinmarketcap.com).

Data Sources

SourceWhatEndpoint
------------------------
CoinGeckoToken pricesapi.coingecko.com/api/v3/simple/price
DeFiLlamaProtocol TVL, yieldsapi.llama.fi
Optimism RPCBalances, gasmainnet.optimism.io
Base RPCBalances, gasmainnet.base.org
Across APIBridge quotesapp.across.to/api/suggested-fees

Core Scripts

All scripts output JSON. Run with node scripts/.js.

ScriptPurpose
-----------------
wallet-balances.jsETH + ERC-20 balances on OP + Base
token-price.jsCoinGecko price for any token
yields.jsTop yield pools on OP + Base from DeFiLlama
gas.jsCurrent gas on Optimism and Base
bridge-quote.jsAcross Protocol bridge fee quote (no deps, 10s timeout)
aave-position.jsAave V3 health factor + collateral/debt on OP + Base
swap-quote.jsPrice-based swap estimate via CoinGecko (price math only — not a protocol-routed quote)
cmc-sentiment.jsBTC dominance, ETH dominance, Fear & Greed index (CoinMarketCap)

Script Details

aave-position.js

node scripts/aave-position.js <0x-address>

Queries Aave V3 Pool getUserAccountData on both Optimism and Base via direct JSON-RPC eth_call. Returns collateral, debt, available borrows, liquidation threshold, LTV, and health factor. Adds a warning field if health factor < 1.2 (liquidation risk). 8-second timeout per RPC call.

swap-quote.js

node scripts/swap-quote.js <token_in> <token_out> <amount_in> [--chain optimism|base]
# Example: node scripts/swap-quote.js ETH USDC 1.5 --chain base

Fetches live prices from CoinGecko and computes estimated output = (priceIn / priceOut) amountIn 0.997 (0.3% fee estimate). Supported tokens: ETH, WETH, USDC, USDT, OP, VELO, AERO, cbETH. Not a real quote — use Aerodrome/Velodrome UI for execution.

Workflow

Wallet check: Run wallet-balances.js

→ summarise balances + USD value.

Opportunity scan: Run yields.js → filter by chain, TVL >$1M, sort by APY. Flag stable pairs (no IL) and volatile pairs separately. Cross-reference gas cost vs position size before recommending entry.

Bridge quote: Run bridge-quote.js [from_chain=10] [to_chain=8453] → returns fee, fill time, output amount.

Price check: Run token-price.js → price, 24h change.

Aave health check: Run aave-position.js

→ health factor on both chains. Act immediately if < 1.2.

Swap estimate: Run swap-quote.js → rough output estimate for planning. Never use for execution.

Market sentiment: Run cmc-sentiment.js → BTC dom, ETH dom, Fear & Greed. Requires CMC_API_KEY env var. Caches results for 6h.

yields.js flags:

node scripts/yields.js                                 # OP + Base, TVL >$1M, top 20
node scripts/yields.js --chain optimism                # OP only
node scripts/yields.js --chain base                    # Base only
node scripts/yields.js --chain all --min-tvl 5000000   # both chains, TVL >$5M
node scripts/yields.js --top 5                         # top 5 results only

Error Handling

  • Bad address (wallet-balances.js, aave-position.js): returns { error: "invalid address" } — always validate 0x format before passing
  • Unknown token (swap-quote.js): returns { error: "Unsupported token: XYZ" } — supported list is in script header
  • RPC timeout: 8s timeout per call; on failure returns { error: "RPC timeout" } — retry once before surfacing to user
  • DeFiLlama offline: yields.js returns empty array [] — surface as "yield data temporarily unavailable"

Key Addresses (verified)

See references/addresses.md for verified contract addresses on Optimism and Base.

Risk Rules

  • Never recommend pools with TVL < $1M
  • Flag APY > 100% as high-risk / likely temporary incentive
  • Always show gas cost as % of position before recommending entry
  • Stable pairs (USDC-USDT, USDC-msUSD) = lower risk, note explicitly

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-05-03 08:57 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Web3 Docs

old-greggyboy
涵盖 Solidity、Foundry、Hardhat、Viem、Wagmi、ethers.js 和 OpenZeppelin 的最新文档与代码模式。适用于智能合约编写、调试...
★ 0 📥 673

Durable Workflow

old-greggyboy
构建能够应对真实故障的AI智能体工作流的模式与流程,适用于多步骤自动化、流水线或智能体的搭建场景。
★ 0 📥 625

Abi Toolchain

old-greggyboy
智能合约项目的ABI生命周期管理。适用于前端与合约变更不同步、或需配置ABI生成等场景。
★ 0 📥 454