OKX DeFi (experimental merge of 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.
Pre-flight Checks
At the start of each thread, complete the checks in ../okx-agentic-wallet/_shared/preflight.md. If missing, read _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.
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-market
- 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
Chain Support
CLI resolves chain names automatically (e.g. ethereum → 1, bsc → 56, solana → 501). Full alias table: references/portfolio.md §Chain Support.
Step 0: Address Resolution (shared by both capabilities)
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
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
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)
1---2name: okx-defi3description: For discovering and managing OKX-aggregated DeFi products and positions across protocols and chains. Use it for yield, APY, or TVL discovery and history; DeFi deposits, staking, liquidity, withdrawals, rewards, lending, CLMM analysis, and positions or holdings. Trigger phrases: earn yield, best APY, DeFi product, APY/TVL history, deposit or stake for yield, provide/remove liquidity, withdraw/redeem a DeFi position, claim DeFi rewards, borrow/repay a lending position, CLMM, DeFi portfolio, DeFi 持仓. Requests targeting a named third-party DApp—Aave, Lido, PancakeSwap, Uniswap, Curve, Compound, Morpho, Pendle, Kamino, Raydium, Hyperliquid, or Polymarket—route to okx-dapp-discovery; generic swaps, wallet balances, and transaction broadcast route to okx-agentic-wallet; token search, market prices, K-lines, and token charts route to okx-dex-market. DeFi APY/TVL and V3 liquidity charts stay here.4license: MIT5---6
7# OKX DeFi (experimental merge of okx-defi-invest + okx-defi-portfolio)
8
9Multi-chain, OKX-aggregated DeFi in two capabilities behind one skill. Both wrap the same `onchainos defi` CLI command group.
10
11## Pre-flight Checks
12
13At the start of each thread, complete the checks in `../okx-agentic-wallet/_shared/preflight.md`. If missing, read `_shared/preflight.md`.
14
15## Intent Routing
16
17| User Intent | Reference |
18|---|---|
19| Discover / search DeFi products, find best APY | [invest.md](references/invest.md) |
20| Product detail (APY, TVL, accepted tokens) | [invest.md](references/invest.md) |
21| Deposit / stake / provide liquidity | [invest.md](references/invest.md) |
22| Withdraw / redeem a position (full or partial) | [invest.md](references/invest.md) |
23| Claim rewards (platform / investment / V3 fee / bonus / unlocked principal) | [invest.md](references/invest.md) |
24| APY history, TVL history, V3 depth / price charts | [invest.md](references/invest.md) |
25| View DeFi positions / holdings overview (持仓) | [portfolio.md](references/portfolio.md) |
26| Per-protocol position detail (持仓详情) | [portfolio.md](references/portfolio.md) |
27| Exact parameters / return schemas — invest & charts commands | [invest-cli-reference.md](references/invest-cli-reference.md) |
28| Exact parameters / return schemas — positions commands | [portfolio-cli-reference.md](references/portfolio-cli-reference.md) |
29| Errors / failed deposits / expired calldata | [invest-troubleshooting.md](references/invest-troubleshooting.md) |
30| Errors / empty positions / address-format issues | [portfolio-troubleshooting.md](references/portfolio-troubleshooting.md) |
31
32Typical flow spans both: view positions (Portfolio) → redeem or claim (Invest). Read both reference files when the request chains them.
33
34## Skill Routing
35
36- For DApp-named investing/lending/staking/positions ("on Aave", "my Hyperliquid balance") → use `okx-dapp-discovery`
37- For token price/chart or token search by name/contract → use `okx-dex-market`
38- For DEX spot swap execution → use `okx-agentic-wallet`
39- For wallet token balances → use `okx-agentic-wallet`
40- For broadcasting signed transactions → use `okx-agentic-wallet`
41- For Agentic Wallet login, balance, contract-call → use `okx-agentic-wallet`
42
43## Chain Support
44
45CLI resolves chain names automatically (e.g. `ethereum` → `1`, `bsc` → `56`, `solana` → `501`). Full alias table: `references/portfolio.md` §Chain Support.
46
47## Step 0: Address Resolution (shared by both capabilities)
48
49When the user does NOT provide a wallet address, resolve it automatically from the Agentic Wallet **before** running any defi command:
50
51```
521. onchainos wallet status → check if logged in, get active account
532. onchainos wallet addresses → get addresses grouped by chain category:
54 - XLayer addresses
55 - EVM addresses (Ethereum, BSC, Polygon, etc.)
56 - Solana addresses
573. Match address to target chain:
58 - EVM chains → use EVM address
59 - Solana → use Solana address
60 - XLayer → use XLayer address
61```
62
63Rules:
64- If the user provides an explicit address, use it directly — skip this step
65- If wallet is not logged in, ask the user to log in first (→ `okx-agentic-wallet`) or provide an address manually
66- 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
67- Always confirm the resolved address with the user before proceeding if the account has multiple addresses of the same type
68
69## Address-Chain Compatibility (shared — CRITICAL)
70
71The `--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).
72
73- `0x…` address → only pass EVM chains: `ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksync`
74- base58 address → only pass `solana`
75- Sui address → only pass `sui`; Tron address (`T…`) → only pass `tron`; TON address → only pass `ton`
76- If the user wants positions across both EVM and Solana, make **two separate calls** with the respective addresses
77
78## Global Notes
79
80- The wallet address parameter for ALL defi commands is `--address`
81- `defi positions` uses `--chains` (plural, comma-separated); `defi position-detail` uses `--chain` (singular)
82- For CLI parameter details, see `references/invest-cli-reference.md` (invest & charts) and `references/portfolio-cli-reference.md` (positions)