Defi Scout
/install defi-scout
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
| Source | What | Endpoint |
|---|---|---|
| CoinGecko | Token prices | api.coingecko.com/api/v3/simple/price |
| DeFiLlama | Protocol TVL, yields | api.llama.fi |
| Optimism RPC | Balances, gas | mainnet.optimism.io |
| Base RPC | Balances, gas | mainnet.base.org |
| Across API | Bridge quotes | app.across.to/api/suggested-fees |
Core Scripts
All scripts output JSON. Run with node scripts/\x3Cname>.js.
| Script | Purpose |
|---|---|
wallet-balances.js |
ETH + ERC-20 balances on OP + Base |
token-price.js |
CoinGecko price for any token |
yields.js |
Top yield pools on OP + Base from DeFiLlama |
gas.js |
Current gas on Optimism and Base |
bridge-quote.js |
Across Protocol bridge fee quote (no deps, 10s timeout) |
aave-position.js |
Aave V3 health factor + collateral/debt on OP + Base |
swap-quote.js |
Price-based swap estimate via CoinGecko (price math only — not a protocol-routed quote) |
cmc-sentiment.js |
BTC dominance, ETH dominance, Fear & Greed index (CoinMarketCap) |
Script Details
aave-position.js
node scripts/aave-position.js \x3C0x-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 \x3C 1.2 (liquidation risk). 8-second timeout per RPC call.
swap-quote.js
node scripts/swap-quote.js \x3Ctoken_in> \x3Ctoken_out> \x3Camount_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 \x3Caddress> → 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 \x3Camount_eth> [from_chain=10] [to_chain=8453] → returns fee, fill time, output amount.
Price check: Run token-price.js \x3Ccoingecko_id> → price, 24h change.
Aave health check: Run aave-position.js \x3Caddress> → health factor on both chains. Act immediately if \x3C 1.2.
Swap estimate: Run swap-quote.js \x3CtokenIn> \x3CtokenOut> \x3Camount> → 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.jsreturns 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 \x3C $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
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install defi-scout - 安装完成后,直接呼叫该 Skill 的名称或使用
/defi-scout触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 148 次。
如何安装 Defi Scout?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install defi-scout」即可一键安装,无需额外配置。
Defi Scout 是免费的吗?
是的,Defi Scout 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Defi Scout 支持哪些平台?
Defi Scout 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Defi Scout?
由 old-greggyboy(@old-greggyboy)开发并维护,当前版本 v1.0.3。