okx-defi

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OKX DeFi (experimental merge of okx-defi-invest + okx-defi-portfolio)

OKX DeFi(okx-defi-invest与okx-defi-portfolio的实验性合并版本)

Multi-chain, OKX-aggregated DeFi in two capabilities behind one skill. Both wrap the same
onchainos defi
CLI command group.
本技能整合了多链、OKX聚合DeFi的两大功能,二者均基于同一
onchainos defi
CLI命令组实现。

Pre-flight Checks

前置检查

Read
../okx-agentic-wallet/_shared/preflight.md
. If that file does not exist, read
_shared/preflight.md
instead.
阅读
../okx-agentic-wallet/_shared/preflight.md
。若该文件不存在,则阅读
_shared/preflight.md

Intent Routing

意图路由

User IntentReference
Discover / search DeFi products, find best APYinvest.md
Product detail (APY, TVL, accepted tokens)invest.md
Deposit / stake / provide liquidityinvest.md
Withdraw / redeem a position (full or partial)invest.md
Claim rewards (platform / investment / V3 fee / bonus / unlocked principal)invest.md
APY history, TVL history, V3 depth / price chartsinvest.md
View DeFi positions / holdings overview (持仓)portfolio.md
Per-protocol position detail (持仓详情)portfolio.md
Exact parameters / return schemas — invest & charts commandsinvest-cli-reference.md
Exact parameters / return schemas — positions commandsportfolio-cli-reference.md
Errors / failed deposits / expired calldatainvest-troubleshooting.md
Errors / empty positions / address-format issuesportfolio-troubleshooting.md
Typical flow spans both: view positions (Portfolio) → redeem or claim (Invest). Read both reference files when the request chains them.
用户意图参考文档
发现/搜索DeFi产品、寻找最优APYinvest.md
产品详情(APY、TVL、支持代币)invest.md
存入/质押/提供流动性invest.md
提取/赎回持仓(全额或部分)invest.md
领取奖励(平台/投资/V3手续费/奖励金/解锁本金)invest.md
APY历史、TVL历史、V3深度/价格图表invest.md
查看DeFi持仓/资产概览(持仓)portfolio.md
单协议持仓详情(持仓详情)portfolio.md
精确参数/返回结构——投资与图表命令invest-cli-reference.md
精确参数/返回结构——持仓命令portfolio-cli-reference.md
错误/存入失败/过期调用数据invest-troubleshooting.md
错误/空持仓/地址格式问题portfolio-troubleshooting.md
典型流程会涉及两大功能:查看持仓(Portfolio)→ 赎回或领取(Invest)。当请求包含连续操作时,请阅读两份参考文档。

Skill Routing

技能路由

  • For DApp-named investing/lending/staking/positions ("on Aave", "my Hyperliquid balance") → use
    okx-dapp-discovery
  • For token price/chart or token search by name/contract → use
    okx-dex
  • For DEX spot swap execution → use
    okx-agentic-wallet
  • For wallet token balances → use
    okx-agentic-wallet
  • For broadcasting signed transactions → use
    okx-agentic-wallet
  • For Agentic Wallet login, balance, contract-call → use
    okx-agentic-wallet
  • 若用户提及具体DApp的投资/借贷/质押/持仓(如“在Aave上”、“我的Hyperliquid余额”)→ 使用
    okx-dapp-discovery
  • 若用户查询代币价格/图表或按名称/合约搜索代币 → 使用
    okx-dex
  • 若用户执行DEX现货兑换 → 使用
    okx-agentic-wallet
  • 若用户查询钱包代币余额 → 使用
    okx-agentic-wallet
  • 若用户广播已签名交易 → 使用
    okx-agentic-wallet
  • 若用户进行Agentic Wallet登录、余额查询、合约调用 → 使用
    okx-agentic-wallet

Chain Support

链支持

CLI resolves chain names automatically (e.g.
ethereum
1
,
bsc
56
,
solana
501
). Full alias table:
references/portfolio.md
§Chain Support.
CLI会自动解析链名称(例如
ethereum
1
bsc
56
solana
501
)。完整别名表请查看
references/portfolio.md
中的「链支持」章节。

Step 0: Address Resolution (shared by both capabilities)

步骤0:地址解析(两大功能共享)

When the user does NOT provide a wallet address, resolve it automatically from the Agentic Wallet before running any defi command:
1. onchainos wallet status          → check if logged in, get active account
2. onchainos wallet addresses       → get addresses grouped by chain category:
                                       - XLayer addresses
                                       - EVM addresses (Ethereum, BSC, Polygon, etc.)
                                       - Solana addresses
3. Match address to target chain:
   - EVM chains → use EVM address
   - Solana     → use Solana address
   - XLayer     → use XLayer address
Rules:
  • If the user provides an explicit address, use it directly — skip this step
  • If wallet is not logged in, ask the user to log in first (→
    okx-agentic-wallet
    ) or provide an address manually
  • If the user says "check all accounts" or "all wallets", use
    wallet balance --all
    to get all account IDs, then
    wallet switch <id>
    +
    wallet addresses
    for each account
  • Always confirm the resolved address with the user before proceeding if the account has multiple addresses of the same type
当用户未提供钱包地址时,需在执行任何defi命令之前,从Agentic Wallet自动解析地址:
1. onchainos wallet status          → 检查是否已登录,获取活跃账户
2. onchainos wallet addresses       → 获取按链分类的地址:
                                       - XLayer地址
                                       - EVM地址(Ethereum、BSC、Polygon等)
                                       - Solana地址
3. 将地址与目标链匹配:
   - EVM链 → 使用EVM地址
   - Solana → 使用Solana地址
   - XLayer → 使用XLayer地址
规则:
  • 若用户提供明确地址,直接使用该地址——跳过此步骤
  • 若钱包未登录,请先让用户登录(→
    okx-agentic-wallet
    )或手动提供地址
  • 若用户要求“检查所有账户”或“所有钱包”,使用
    wallet balance --all
    获取所有账户ID,然后对每个账户执行
    wallet switch <id>
    +
    wallet addresses
  • 若账户存在多个同类型地址,在继续操作前务必与用户确认解析出的地址

Address-Chain Compatibility (shared — CRITICAL)

地址-链兼容性(共享——至关重要)

The
--address
and chain parameters must be compatible. EVM addresses (
0x…
) can only query EVM chains; Solana addresses (base58) can only query
solana
. Never mix them — the API will return error 84019 (Address format error).
  • 0x…
    address → only pass EVM chains:
    ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync
  • base58 address → only pass
    solana
  • Sui address → only pass
    sui
    ; Tron address (
    T…
    ) → only pass
    tron
    ; TON address → only pass
    ton
  • If the user wants positions across both EVM and Solana, make two separate calls with the respective addresses
--address
参数与链参数必须兼容。EVM地址(
0x…
)仅可查询EVM链;Solana地址(base58格式)仅可查询
solana
。切勿混用——否则API会返回错误码84019(地址格式错误)。
  • 0x…
    地址 → 仅传入EVM链:
    ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync
  • base58地址 → 仅传入
    solana
  • Sui地址 → 仅传入
    sui
    ;Tron地址(
    T…
    )→ 仅传入
    tron
    ;TON地址 → 仅传入
    ton
  • 若用户需要查询EVM和Solana跨链持仓,请使用对应地址发起两次独立调用

Global Notes

全局说明

  • The wallet address parameter for ALL defi commands is
    --address
  • defi positions
    uses
    --chains
    (plural, comma-separated);
    defi position-detail
    uses
    --chain
    (singular)
  • For CLI parameter details, see
    references/invest-cli-reference.md
    (invest & charts) and
    references/portfolio-cli-reference.md
    (positions)
  • 所有defi命令的钱包地址参数均为
    --address
  • defi positions
    使用
    --chains
    (复数,逗号分隔);
    defi position-detail
    使用
    --chain
    (单数)
  • 如需了解CLI参数详情,请查看
    references/invest-cli-reference.md
    (投资与图表)和
    references/portfolio-cli-reference.md
    (持仓)