Loading...
Loading...
Use this skill to 'invest in DeFi', 'earn yield on USDC', 'deposit into Aave', 'stake ETH on Lido', 'search DeFi products', 'find best APY', 'redeem my DeFi position', 'withdraw from lending', 'claim DeFi rewards', 'borrow USDC', 'repay loan', 'add liquidity to Uniswap V3', 'remove liquidity', or mentions DeFi investing, yield farming, lending, borrowing, staking, liquidity pools, APY/APR across Ethereum, BSC, Avalanche, Sui, Solana, and other supported chains. Supports Aave, Lido, Compound, PancakeSwap, Uniswap, NAVI, Kamino, BENQI, and more. Do NOT use for DEX spot swaps — use okx-dex-swap. Do NOT use for token prices or market data — use okx-dex-market. Do NOT use for wallet token balances — use okx-wallet-portfolio. Do NOT use for viewing DeFi positions/holdings only — use okx-defi-portfolio.
npx skill4agent add okx/onchainos-skills okx-defi-investokx-defi-portfoliookx-dex-marketokx-dex-tokenokx-dex-swapokx-wallet-portfoliookx-onchain-gatewayokx-agentic-wallet| # | Command | Description |
|---|---|---|
| 1 | | List top DeFi products by APY |
| 2 | | Search DeFi products |
| 3 | | Get full product details |
| 4 | | One-step deposit (CLI handles prepare + precision + calldata) |
| 5 | | One-step withdrawal (CLI handles position lookup + calldata) |
| 6 | | One-step reward claim (CLI handles reward check + calldata) |
| 7 | | List DeFi positions by platform |
| 8 | | Get detailed position info |
| productGroup | Description |
|---|---|
| Single-token yield (savings, staking, vaults) |
| Liquidity pools (Uniswap V2/V3, PancakeSwap, etc.) |
| Lending / borrowing (Aave, Compound, etc.) |
ethereum1bsc56solana5011. 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 addressokx-agentic-walletwallet balance --allwallet switch <id>wallet addresses1. defi search --token USDC --chain ethereum → pick investmentId
2. defi detail --investment-id <id> → confirm APY/TVL, get underlyingToken[].tokenAddress
3. token search --query <tokenAddress> --chains <chain> → get decimal (e.g. 6) for amount conversion
4. Ask user for amount → convert: userAmount × 10^decimal (e.g. 100 USDC → 100000000)
5. Check wallet balance (okx-wallet-portfolio) → if insufficient, warn user and stop
6. defi invest --investment-id <id> --address <addr> --token USDC --amount 100000000
→ CLI returns calldata (APPROVE + DEPOSIT steps)
7. User signs and broadcasts each step in orderToken decimal: GetfromtokenAddress→defi detail, then useunderlyingToken[].tokenAddressto gettoken search --query <tokenAddress>. Same approach as DEX swap.decimalCRITICAL — Balance check is REQUIRED before calling. You MUST calldefi investto verify the user has sufficient balance of the deposit token BEFORE generating calldata. If balance is insufficient, STOP and warn the user. Do NOT proceed tookx-wallet-portfoliowithout confirming balance. Skipping this step wastes gas and results in failed on-chain transactions.defi invest
CRITICAL — position-detail is MANDATORY before withdraw. You MUST callimmediately before everydefi position-detail, even if you already have position data from a previous call. Do NOT reuse stale position-detail results.defi withdraw
1. defi positions --address <addr> --chains ethereum
2. defi position-detail --address <addr> --chain ethereum --platform-id <pid>
→ MUST be called fresh — get investmentId, tokenPrecision, coinAmount (current balance)
3. Full exit:
defi withdraw --investment-id <id> --address <addr> --chain ethereum --ratio 1 --platform-id <pid>
Partial exit (convert coinAmount to minimal units: amount × 10^tokenPrecision):
defi withdraw --investment-id <id> --address <addr> --chain ethereum --amount <minimal_units> --platform-id <pid>
4. User signs and broadcastsPartial exit --amount: position-detail returnsin human-readable (e.g. "2.3792") andcoinAmount(e.g. 6). Convert to minimal units:tokenPrecision→floor(2.3792 × 10^6) = 2379200.--amount 2379200
CRITICAL — position-detail is MANDATORY before collect. You MUST callimmediately before everydefi position-detail, even if you already have position data from a previous call in the conversation. Position data (rewards, investmentId, platformId, tokenId) changes after each on-chain operation (withdraw, previous collect, etc.), so stale data leads to wrong parameters or failed transactions. Do NOT skip this step. Do NOT reuse position-detail results from earlier in the conversation.defi collect
1. defi positions --address <addr> --chains ethereum
2. defi position-detail --address <addr> --chain ethereum --platform-id <pid>
→ MUST be called fresh — do NOT reuse prior results
3. defi collect --address <addr> --chain ethereum --reward-type REWARD_INVESTMENT --investment-id <id> --platform-id <pid>
→ CLI returns calldata (or skips if no rewards)
4. User signs and broadcasts1. defi search --token USDT --platform PancakeSwap --chain bsc --product-group DEX_POOL
2. defi detail --investment-id <id>
3. Ask user for amount and tick range
4. Check wallet balance (okx-wallet-portfolio) → if insufficient, warn user and stop
5. defi invest --investment-id <id> --address <addr> --token USDT --amount 100000000 --range 5
→ CLI handles calculate-entry internally, returns calldata
6. User signs and broadcastsinvestwithdrawcollectdataList# For each dataList step:
# 1. User signs the tx externally using dataList[N].to, dataList[N].serializedData, dataList[N].value
# 2. Broadcast:
onchainos gateway broadcast --signed-tx <signed_hex> --address <addr> --chain <chain>
# 3. Poll until confirmed:
onchainos gateway orders --address <addr> --chain <chain> --order-id <orderId>
# → wait for txStatus=2, then proceed to next stepwallet contract-callonchainos wallet contract-call \
--to <dataList[N].to> \
--chain <chainIndex> \
--input-data <dataList[N].serializedData> \
--value <value_in_UI_units>onchainos wallet contract-call \
--to <dataList[N].to> \
--chain 196 \
--input-data <dataList[N].serializedData> \
--value <value_in_UI_units>onchainos wallet contract-call \
--to <dataList[N].to> \
--chain 501 \
--unsigned-tx <dataList[N].serializedData>contract-call--valuedataList[].valuecontract-call --valuevalue_UI = value / 10^nativeToken.decimalvalue"""0""0x0""0"--chaincontract-callgateway broadcastrealChainIndex113756501196dataList[0]dataList[1]txStatus=2contract-call/invest/withdrawonly return unsigned calldata — they do NOT broadcast. The CLI never holds private keys.collect
| # | Platform | Chain | investmentId | Name | APY | TVL |
|---|---|---|---|---|---|---|
| 1 | Aave V3 | ETH | 9502 | USDC | 1.89% | $3.52B |
investmentIdrate%tvl| rewardType | When to use | Required params |
|---|---|---|
| Protocol-level rewards (e.g. AAVE token) | |
| Product mining/staking rewards | |
| V3 trading fee collection | |
| OKX bonus rewards | |
| Merkle proof-based bonus | |
| Unlocked principal after lock | |
callDataType=WITHDRAWcallDataType=DEPOSIT--token-id--ratio--ratio 1--amount--ratio 1| Just completed | Suggest |
|---|---|
| View details → |
| Proceed → |
| View positions → |
| Check positions → |
| Check positions → |
| Code | Scenario | Handling |
|---|---|---|
| 84400 | Parameter null | Check required params — partial exit needs |
| 84021 | Asset syncing | "Position data is syncing, please retry shortly" |
| 84023 | Invalid expectOutputList | CLI auto-constructs from position-detail; retry or pass |
| 84014 | Balance check failed | Insufficient balance — check with |
| 84018 | Balancing failed | V3 balancing failed — adjust price range or increase slippage |
| 84010 | Token not supported | Check supported tokens via |
| 84001 | Platform not supported | DeFi platform not supported |
| 84016 | Contract execution failed | Check parameters and retry |
| 84019 | Address format mismatch | Address format invalid for this chain |
| 50011 | Rate limit | Wait and retry |
--amount--amount 100000defi detaildefi position-detail--address--slippage"0.01""0.03""0.05"defi positionsdefi position-detail--address0x…solana0x…ethereum,bsc,polygon,arbitrum,base,xlayer,avalanche,optimism,fantom,linea,scroll,zksyncsolana