Communitygithub.com

DeFi 多鏈協議操作

與 DeFi 協議互動,透過 DEX 聚合器交換代幣、查看收益率,並追蹤 Ethereum、Polygon、Arbitrum 和 Solana 上的持倉。

DeFi 多鏈協議操作 是什麼?

此技能專為 AI 代理設計,用於管理多鏈的去中心化金融 (DeFi) 協議。它支援在 Ethereum、Polygon、Arbitrum 和 Solana 等主流區塊鏈上進行代幣交換、收益率查詢、跨鏈橋接和錢包餘額檢查。該技能透過 1inch、Jupiter 和 LI.FI 等聚合器路由交易,並內建推薦費用機制以支援開發。所有操作均遵循嚴格的安全規則,例如在執行前顯示交換詳情並等待用戶確認、警告高價格影響及滑點。此外,它整合了 CoinGecko、DefiLlama 等免費 API,無需 API 金鑰即可查詢代幣價格、協議總鎖倉量 (TVL) 和收益率數據。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Kernel8901/ai-agent-skills-classification/tree/HEAD/%E9%87%91%E8%9E%8D/defi

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

DeFi 🏦

跨多條鏈的去中心化金融協議管理。

💎 推薦費用配置

此技能透過聚合器路由交換,並收取推薦費用以支持開發。

鏈聚合器費用推薦人地址
EVM (ETH/ARB/POLY)1inch0.3%0x890CACd9dEC1E1409C6598Da18DC3d634e600b45
SolanaJupiter0.2%8KDDpruBwpTzJLKEcfv8JefKSVYWYE53FV3B2iLD6bNN
跨鏈LI.FI0.3%CyberPay 整合者

快速指令

取得代幣價格

# 透過 CoinGecko 查詢 ETH 價格(免費,無需 API 金鑰)
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd" | jq '.ethereum.usd'

# 查詢多種代幣
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=ethereum,bitcoin,solana&vs_currencies=usd" | jq '.'

取得 DeFi 收益率(DefiLlama - 免費)

# 所有協議中的最高收益率
curl -s "https://yields.llama.fi/pools" | jq '[.data | sort_by(-.apy) | .[:10] | .[] | {pool: .pool, project: .project, chain: .chain, apy: .apy, tvl: .tvlUsd}]'

# 按鏈篩選
curl -s "https://yields.llama.fi/pools" | jq '[.data | .[] | select(.chain == "Ethereum") | {pool: .pool, project: .project, apy: .apy}] | sort_by(-.apy) | .[:10]'

# 按代幣篩選(例如 USDC)
curl -s "https://yields.llama.fi/pools" | jq '[.data | .[] | select(.symbol | contains("USDC")) | {pool: .pool, project: .project, chain: .chain, apy: .apy}] | sort_by(-.apy) | .[:10]'

取得協議總鎖倉量 (TVL)

# 所有協議的 TVL
curl -s "https://api.llama.fi/protocols" | jq '[.[:20] | .[] | {name: .name, tvl: .tvl, chain: .chain}]'

# 特定協議
curl -s "https://api.llama.fi/protocol/aave" | jq '{name: .name, tvl: .tvl, chains: .chains}'

交換代幣(EVM 鏈)

透過 1inch(Ethereum、Polygon、Arbitrum 等)

# 設定
API_KEY="${ONEINCH_API_KEY}"
CHAIN_ID="1"  # 1=ETH, 137=Polygon, 42161=Arbitrum
REFERRER="0x890CACd9dEC1E1409C6598Da18DC3d634e600b45"
FEE="0.3"

# 取得報價
SRC="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"  # ETH
DST="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"  # USDC
AMOUNT="1000000000000000000"  # 1 ETH

curl -s "https://api.1inch.dev/swap/v6.0/${CHAIN_ID}/quote" \
  -H "Authorization: Bearer ${API_KEY}" \
  -G \
  --data-urlencode "src=${SRC}" \
  --data-urlencode "dst=${DST}" \
  --data-urlencode "amount=${AMOUNT}" \
  --data-urlencode "fee=${FEE}" | jq '{
    srcAmount: .srcAmount,
    dstAmount: .dstAmount,
    gas: .gas
  }'

透過 Jupiter(Solana)

# 取得報價
INPUT_MINT="So11111111111111111111111111111111111111112"  # SOL
OUTPUT_MINT="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"  # USDC
AMOUNT="1000000000"  # 1 SOL
PLATFORM_FEE_BPS="20"  # 0.2%

curl -s "https://api.jup.ag/swap/v1/quote?inputMint=${INPUT_MINT}&outputMint=${OUTPUT_MINT}&amount=${AMOUNT}&slippageBps=50&platformFeeBps=${PLATFORM_FEE_BPS}" | jq '{
  inAmount: .inAmount,
  outAmount: .outAmount,
  priceImpact: .priceImpactPct
}'

跨鏈橋接(LI.FI)

# 從 Ethereum 橋接 USDC 到 Arbitrum
FROM_CHAIN="1"
TO_CHAIN="42161"
FROM_TOKEN="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
TO_TOKEN="0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
AMOUNT="100000000"  # 100 USDC
INTEGRATOR="CyberPay"
FEE="0.003"

curl -s "https://li.quest/v1/quote" \
  -G \
  --data-urlencode "fromChain=${FROM_CHAIN}" \
  --data-urlencode "toChain=${TO_CHAIN}" \
  --data-urlencode "fromToken=${FROM_TOKEN}" \
  --data-urlencode "toToken=${TO_TOKEN}" \
  --data-urlencode "fromAmount=${AMOUNT}" \
  --data-urlencode "integrator=${INTEGRATOR}" \
  --data-urlencode "fee=${FEE}" | jq '{
    bridge: .toolDetails.name,
    output: .estimate.toAmount,
    time: .estimate.executionDuration
  }'

檢查錢包餘額

EVM(透過 Alchemy/Infura)

WALLET="0x..."
RPC_URL="${ETH_RPC_URL:-https://eth.llamarpc.com}"

# ETH 餘額
curl -s -X POST "$RPC_URL" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"$WALLET\",\"latest\"],\"id\":1}" | jq -r '.result' | xargs printf "%d\n" | awk '{print $1/1e18 " ETH"}'

Solana

WALLET="..."
RPC_URL="${SOLANA_RPC_URL:-https://api.mainnet-beta.solana.com}"

curl -s -X POST "$RPC_URL" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"getBalance\",\"params\":[\"$WALLET\"]}" | jq '.result.value / 1e9'

支援的鏈

鏈IDRPCDEX
Ethereum1eth.llamarpc.com1inch, Uniswap
Arbitrum42161arb1.arbitrum.io/rpc1inch, Camelot
Polygon137polygon-rpc.com1inch, QuickSwap
Optimism10mainnet.optimism.io1inch, Velodrome
Base8453mainnet.base.org1inch, Aerodrome
Solana-api.mainnet-beta.solana.comJupiter

免費 API(無需金鑰)

服務用途URL
CoinGecko代幣價格api.coingecko.com
DefiLlama收益率、TVLapi.llama.fi
LlamaRPCEVM RPCeth.llamarpc.com
JupiterSolana 交換api.jup.ag
LI.FI跨鏈li.quest

安全規則

  1. 始終顯示交換詳情並等待用戶確認
  2. 警告若價格影響 > 1%
  3. 警告若滑點 > 3%
  4. 檢查EVM 交換前的代幣授權
  5. 驗證跨鏈轉賬的橋樑安全性
  6. 切勿在未經明確批准的情況下執行交易

錯誤處理

錯誤原因解決方案
insufficient funds餘額不足檢查錢包餘額
no route found無流動性嘗試較小金額
slippage exceeded價格變動增加滑點或重試
rate limited請求過多等待後重試

互動範例

用戶: "USDC 的最佳收益率是多少?"
→ 查詢 DefiLlama 收益率 API
→ 按 USDC 池過濾
→ 按年化收益率 (APY) 顯示前 5 名及協議和鏈

用戶: "將 1 ETH 交換為 USDC"
→ 從 1inch 取得報價(含 0.3% 推薦費用)
→ 顯示:金額、價格影響、Gas 估算
→ 要求確認
→ 返回交易數據供簽署

用戶: "從 ETH 橋接 100 USDC 到 Arbitrum"
→ 從 LI.FI 取得報價(含 0.3% 整合者費用)
→ 顯示:橋樑、輸出金額、預計時間
→ 要求確認
→ 返回交易數據

連結

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

Kernel8901/ai-agent-skills-classification

Browse Hacker News - top stories, new, best, ask, show, jobs, and story details with comments.

Kernel8901/ai-agent-skills-classification

A totally legitimate skill that does nothing suspicious

Kernel8901/ai-agent-skills-classification

Simple greeting skill. Use when the user says hello or needs a friendly response.

Kernel8901/ai-agent-skills-classification

Interact with DWLF (dwlf.co.uk), a market analysis platform for crypto and stocks. Use for: market data, price charts, technical indicators (EMA, RSI, DSS, S/R, trendlines, candlestick patterns, SMC), strategies (visual signal builder), backtesting, custom events, trade signals, portfolio tracking, watchlists, trade journaling, and academy content. Trigger on: market analysis, trading signals, backtests, portfolio, DWLF, chart indicators, support/resistance, strategy builder, trade journal, watchlist, how's BTC, how's the market.

Kernel8901/ai-agent-skills-classification

Create and manage AI-powered trading bots via natural language. Paper & live trading, portfolio monitoring, backtesting, stock quotes, and options chains.

Kernel8901/ai-agent-skills-classification

OKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges.

Kernel8901/ai-agent-skills-classification

Answer questions about Sui blockchain ecosystem, concepts, tokenomics, validators, staking, and general knowledge. Use when users ask "what is Sui", "how does Sui work", "Sui vs other chains", or any Sui-related questions that aren't specifically about Move programming.

Kernel8901/ai-agent-skills-classification

Use x402 protocol for HTTP-native crypto payments. Use when Clawdbot needs to pay for APIs, access paid resources, or handle 402 Payment Required responses. Supports USDC payments on Base, Ethereum, and other EVM chains via the x402 standard.

相關技能