okx-defi
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOKX 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 CLI command group.
onchainos defi本技能整合了多链、OKX聚合DeFi的两大功能,二者均基于同一 CLI命令组实现。
onchainos defiPre-flight Checks
前置检查
Read. If that file does not exist, read../okx-agentic-wallet/_shared/preflight.mdinstead._shared/preflight.md
阅读。若该文件不存在,则阅读../okx-agentic-wallet/_shared/preflight.md。_shared/preflight.md
Intent Routing
意图路由
| User Intent | Reference |
|---|---|
| Discover / search DeFi products, find best APY | invest.md |
| Product detail (APY, TVL, accepted tokens) | invest.md |
| Deposit / stake / provide liquidity | invest.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 charts | invest.md |
| View DeFi positions / holdings overview (持仓) | portfolio.md |
| Per-protocol position detail (持仓详情) | portfolio.md |
| Exact parameters / return schemas — invest & charts commands | invest-cli-reference.md |
| Exact parameters / return schemas — positions commands | portfolio-cli-reference.md |
| Errors / failed deposits / expired calldata | invest-troubleshooting.md |
| Errors / empty positions / address-format issues | portfolio-troubleshooting.md |
Typical flow spans both: view positions (Portfolio) → redeem or claim (Invest). Read both reference files when the request chains them.
| 用户意图 | 参考文档 |
|---|---|
| 发现/搜索DeFi产品、寻找最优APY | invest.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. → , → , → ). Full alias table: §Chain Support.
ethereum1bsc56solana501references/portfolio.mdCLI会自动解析链名称(例如→,→,→)。完整别名表请查看中的「链支持」章节。
ethereum1bsc56solana501references/portfolio.mdStep 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 addressRules:
- 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 (→ ) or provide an address manually
okx-agentic-wallet - If the user says "check all accounts" or "all wallets", use to get all account IDs, then
wallet balance --all+wallet switch <id>for each accountwallet addresses - 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 - 若用户要求“检查所有账户”或“所有钱包”,使用获取所有账户ID,然后对每个账户执行
wallet balance --all+wallet switch <id>wallet addresses - 若账户存在多个同类型地址,在继续操作前务必与用户确认解析出的地址
Address-Chain Compatibility (shared — CRITICAL)
地址-链兼容性(共享——至关重要)
The and chain parameters must be compatible. EVM addresses () can only query EVM chains; Solana addresses (base58) can only query . Never mix them — the API will return error 84019 (Address format error).
--address0x…solana- address → only pass EVM chains:
0x…ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync - base58 address → only pass
solana - Sui address → only pass ; Tron address (
sui) → only passT…; TON address → only passtronton - If the user wants positions across both EVM and Solana, make two separate calls with the respective addresses
--address0x…solana- 地址 → 仅传入EVM链:
0x…ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync - base58地址 → 仅传入
solana - Sui地址 → 仅传入;Tron地址(
sui)→ 仅传入T…;TON地址 → 仅传入tronton - 若用户需要查询EVM和Solana跨链持仓,请使用对应地址发起两次独立调用
Global Notes
全局说明
- The wallet address parameter for ALL defi commands is
--address - uses
defi positions(plural, comma-separated);--chainsusesdefi position-detail(singular)--chain - For CLI parameter details, see (invest & charts) and
references/invest-cli-reference.md(positions)references/portfolio-cli-reference.md
- 所有defi命令的钱包地址参数均为
--address - 使用
defi positions(复数,逗号分隔);--chains使用defi position-detail(单数)--chain - 如需了解CLI参数详情,请查看(投资与图表)和
references/invest-cli-reference.md(持仓)references/portfolio-cli-reference.md