okx-defi-invest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OKX DeFi Invest

OKX DeFi Invest

Multi-chain DeFi product discovery and investment execution. The CLI handles precision conversion, multi-step orchestration, and validation internally.
For CLI parameter details, see references/cli-reference.md.
多链DeFi产品发现与投资执行工具。CLI会在内部处理精度转换、多步骤编排和校验。
如需了解CLI参数详情,请查看references/cli-reference.md

Skill Routing

Skill路由规则

  • For DeFi positions / holdings → use
    okx-defi-portfolio
  • For token price/chart → use
    okx-dex-market
  • For token search by name/contract → use
    okx-dex-token
  • For DEX spot swap execution → use
    okx-dex-swap
  • For wallet token balances → use
    okx-wallet-portfolio
  • For broadcasting signed transactions → use
    okx-onchain-gateway
  • For Agentic Wallet login, balance, contract-call → use
    okx-agentic-wallet
  • 若需查看DeFi头寸/持仓 → 使用
    okx-defi-portfolio
  • 若需查询代币价格/图表 → 使用
    okx-dex-market
  • 若需按名称/合约搜索代币 → 使用
    okx-dex-token
  • 若需执行DEX现货兑换 → 使用
    okx-dex-swap
  • 若需查询钱包代币余额 → 使用
    okx-wallet-portfolio
  • 若需广播已签名交易 → 使用
    okx-onchain-gateway
  • 若需Agentic Wallet登录、余额查询、合约调用 → 使用
    okx-agentic-wallet

Command Index

命令索引

#CommandDescription
1
defi list
List top DeFi products by APY
2
defi search --token <tokens> [--platform <names>] [--chain <chain>] [--product-group <group>]
Search DeFi products
3
defi detail --investment-id <id>
Get full product details
4
defi invest --investment-id <id> --address <addr> --token <symbol_or_addr> --amount <minimal_units> [--chain <chain>] [--slippage <pct>] [--tick-lower <n>] [--tick-upper <n>] [--token-id <nft>]
One-step deposit (CLI handles prepare + precision + calldata)
5
defi withdraw --investment-id <id> --address <addr> --chain <chain> [--ratio <0-1>] [--amount <minimal_units>] [--token-id <nft>] [--platform-id <pid>] [--slippage <pct>]
One-step withdrawal (CLI handles position lookup + calldata)
6
defi collect --address <addr> --chain <chain> --reward-type <type> [--investment-id <id>] [--platform-id <pid>] [--token-id <nft>] [--principal-index <idx>]
One-step reward claim (CLI handles reward check + calldata)
7
defi positions --address <addr> --chains <chains>
List DeFi positions by platform
8
defi position-detail --address <addr> --chain <chain> --platform-id <pid>
Get detailed position info
序号命令描述
1
defi list
按APY排序列出热门DeFi产品
2
defi search --token <tokens> [--platform <names>] [--chain <chain>] [--product-group <group>]
搜索DeFi产品
3
defi detail --investment-id <id>
获取产品完整详情
4
defi invest --investment-id <id> --address <addr> --token <symbol_or_addr> --amount <minimal_units> [--chain <chain>] [--slippage <pct>] [--tick-lower <n>] [--tick-upper <n>] [--token-id <nft>]
一键存款(CLI自动处理准备工作、精度转换和calldata生成)
5
defi withdraw --investment-id <id> --address <addr> --chain <chain> [--ratio <0-1>] [--amount <minimal_units>] [--token-id <nft>] [--platform-id <pid>] [--slippage <pct>]
一键提款(CLI自动处理头寸查询和calldata生成)
6
defi collect --address <addr> --chain <chain> --reward-type <type> [--investment-id <id>] [--platform-id <pid>] [--token-id <nft>] [--principal-index <idx>]
一键领取奖励(CLI自动处理奖励检查和calldata生成)
7
defi positions --address <addr> --chains <chains>
按平台列出DeFi头寸
8
defi position-detail --address <addr> --chain <chain> --platform-id <pid>
获取头寸详细信息

Investment Types

投资类型

productGroupDescription
SINGLE_EARN
Single-token yield (savings, staking, vaults)
DEX_POOL
Liquidity pools (Uniswap V2/V3, PancakeSwap, etc.)
LENDING
Lending / borrowing (Aave, Compound, etc.)
productGroup描述
SINGLE_EARN
单币生息(储蓄、质押、金库)
DEX_POOL
流动性池(Uniswap V2/V3、PancakeSwap等)
LENDING
借贷(Aave、Compound等)

Chain Support

支持链

CLI resolves chain names automatically (e.g.
ethereum
1
,
bsc
56
,
solana
501
).
CLI会自动解析链名称(例如
ethereum
1
bsc
56
solana
501
)。

Operation Flow

操作流程

Step 0: Address Resolution

步骤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地址(以太坊、BSC、Polygon等)
                                       - Solana地址
3. 匹配目标链对应的地址:
   - EVM链 → 使用EVM地址
   - Solana → 使用Solana地址
   - XLayer → 使用XLayer地址
规则:
  • 若用户提供了明确地址,直接使用该地址——跳过此步骤
  • 若钱包未登录,请先让用户登录(跳转至
    okx-agentic-wallet
    )或手动提供地址
  • 若用户要求「检查所有账户」或「所有钱包」,使用
    wallet balance --all
    获取所有账户ID,然后依次执行
    wallet switch <id>
    +
    wallet addresses
  • 若账户有多个同类型地址,在继续操作前务必与用户确认解析出的地址

Deposit (invest)

存款(invest)

1. 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 order
Token decimal: Get
tokenAddress
from
defi detail
underlyingToken[].tokenAddress
, then use
token search --query <tokenAddress>
to get
decimal
. Same approach as DEX swap.
CRITICAL — Balance check is REQUIRED before calling
defi invest
.
You MUST call
okx-wallet-portfolio
to 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 to
defi invest
without confirming balance. Skipping this step wastes gas and results in failed on-chain transactions.
1. defi search --token USDC --chain ethereum       → 选择investmentId
2. defi detail --investment-id <id>                 → 确认APY/TVL,获取underlyingToken[].tokenAddress
3. token search --query <tokenAddress> --chains <chain>  → 获取小数位数(例如6)用于金额转换
4. 询问用户存入金额 → 转换为最小单位:用户输入金额 × 10^小数位数(例如100 USDC → 100000000)
5. 检查钱包余额(调用okx-wallet-portfolio)→ 若余额不足,提示用户并终止操作
6. defi invest --investment-id <id> --address <addr> --token USDC --amount 100000000
   → CLI返回calldata(包含APPROVE + DEPOSIT步骤)
7. 用户依次签名并广播每一步
代币小数位数:从
defi detail
获取
tokenAddress
(underlyingToken[].tokenAddress),再通过
token search --query <tokenAddress>
获取
decimal
。与DEX兑换的处理方式一致。
关键注意事项——调用
defi invest
前必须检查余额
。在生成calldata前,必须调用
okx-wallet-portfolio
验证用户的存入代币余额是否充足。若余额不足,立即终止操作并提示用户。切勿跳过此步骤,否则会浪费Gas并导致链上交易失败。

Withdraw

提款(withdraw)

CRITICAL — position-detail is MANDATORY before withdraw. You MUST call
defi position-detail
immediately before every
defi withdraw
, even if you already have position data from a previous call. Do NOT reuse stale position-detail results.
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 broadcasts
Partial exit --amount: position-detail returns
coinAmount
in human-readable (e.g. "2.3792") and
tokenPrecision
(e.g. 6). Convert to minimal units:
floor(2.3792 × 10^6) = 2379200
--amount 2379200
.
关键注意事项——提款前必须调用position-detail。每次执行
defi withdraw
前,都必须调用
defi position-detail
,即使对话中已有历史头寸数据也不能复用。禁止使用过期的position-detail结果。
1. defi positions --address <addr> --chains ethereum
2. defi position-detail --address <addr> --chain ethereum --platform-id <pid>
   → 必须实时调用——获取investmentId、tokenPrecision、coinAmount(当前余额)
3. 全额退出:
   defi withdraw --investment-id <id> --address <addr> --chain ethereum --ratio 1 --platform-id <pid>
   部分退出(将coinAmount转换为最小单位:金额 × 10^tokenPrecision):
   defi withdraw --investment-id <id> --address <addr> --chain ethereum --amount <minimal_units> --platform-id <pid>
4. 用户签名并广播
部分退出的--amount参数:position-detail返回的
coinAmount
为人类可读格式(例如"2.3792"),
tokenPrecision
为小数位数(例如6)。转换为最小单位:
floor(2.3792 × 10^6) = 2379200
→ 使用
--amount 2379200

Claim Rewards

领取奖励(collect)

CRITICAL — position-detail is MANDATORY before collect. You MUST call
defi position-detail
immediately before every
defi collect
, 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.
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 broadcasts
关键注意事项——领取奖励前必须调用position-detail。每次执行
defi collect
前,都必须调用
defi position-detail
,即使对话中已有历史头寸数据也不能复用。头寸数据(奖励、investmentId、platformId、tokenId)会在每次链上操作(提款、之前的领取奖励等)后发生变化,使用过期数据会导致参数错误或交易失败。切勿跳过此步骤,禁止复用对话中早期的position-detail结果。
1. defi positions --address <addr> --chains ethereum
2. defi position-detail --address <addr> --chain ethereum --platform-id <pid>
   → 必须实时调用——禁止复用历史结果
3. defi collect --address <addr> --chain ethereum --reward-type REWARD_INVESTMENT --investment-id <id> --platform-id <pid>
   → CLI返回calldata(若无奖励则跳过)
4. 用户签名并广播

V3 Pool Deposit

V3池存款

1. 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 broadcasts
1. defi search --token USDT --platform PancakeSwap --chain bsc --product-group DEX_POOL
2. defi detail --investment-id <id>
3. 询问用户存入金额和tick区间
4. 检查钱包余额(调用okx-wallet-portfolio)→ 若余额不足,提示用户并终止操作
5. defi invest --investment-id <id> --address <addr> --token USDT --amount 100000000 --range 5
   → CLI内部处理入场价格计算,返回calldata
6. 用户签名并广播

Step 3: Sign & Broadcast Calldata

步骤3:签名并广播Calldata

After
invest
/
withdraw
/
collect
returns
dataList
, execute each step via one of two paths:
Path A (user-provided wallet): user signs externally → broadcast via gateway
bash
undefined
invest
/
withdraw
/
collect
返回
dataList
后,通过以下两种路径之一执行每一步:
路径A(用户自备钱包):用户外部签名 → 通过网关广播
bash
undefined

For each dataList step:

对dataList中的每一步:

1. User signs the tx externally using dataList[N].to, dataList[N].serializedData, dataList[N].value

1. 用户使用dataList[N].to、dataList[N].serializedData、dataList[N].value在外部签名交易

2. Broadcast:

2. 广播:

onchainos gateway broadcast --signed-tx <signed_hex> --address <addr> --chain <chain>
onchainos gateway broadcast --signed-tx <signed_hex> --address <addr> --chain <chain>

3. Poll until confirmed:

3. 轮询直至交易确认:

onchainos gateway orders --address <addr> --chain <chain> --order-id <orderId>
onchainos gateway orders --address <addr> --chain <chain> --order-id <orderId>

→ wait for txStatus=2, then proceed to next step

→ 等待txStatus=2,再执行下一步


**Path B (Agentic Wallet)**: sign & broadcast via `wallet contract-call`

EVM chains (Ethereum, BSC, Polygon, Arbitrum, Base, etc.):
```bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain <chainIndex> \
  --input-data <dataList[N].serializedData> \
  --value <value_in_UI_units>
EVM (XLayer):
bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain 196 \
  --input-data <dataList[N].serializedData> \
  --value <value_in_UI_units>
Solana:
bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain 501 \
  --unsigned-tx <dataList[N].serializedData>
contract-call
handles TEE signing and broadcasting internally — no separate broadcast step needed.
--value
unit conversion
:
dataList[].value
is in minimal units (wei).
contract-call --value
expects UI units. Convert:
value_UI = value / 10^nativeToken.decimal
(e.g. 18 for ETH/POL, 9 for SOL). If
value
is
""
,
"0"
, or
"0x0"
, use
"0"
.
--chain
mapping
:
contract-call
and
gateway broadcast
require
realChainIndex
(e.g.
1
=Ethereum,
137
=Polygon,
56
=BSC,
501
=Solana,
196
=XLayer).
Execution rules:
  • Execute
    dataList[0]
    first, then
    dataList[1]
    , etc. Never in parallel.
  • Wait for on-chain confirmation before next step (Path A:
    txStatus=2
    ; Path B:
    contract-call
    returns txHash).
  • If any step fails, stop all remaining steps and report which succeeded/failed.
invest
/
withdraw
/
collect
only return unsigned calldata — they do NOT broadcast. The CLI never holds private keys.

**路径B(Agentic Wallet)**:通过`wallet contract-call`签名并广播

EVM链(以太坊、BSC、Polygon、Arbitrum、Base等):
```bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain <chainIndex> \
  --input-data <dataList[N].serializedData> \
  --value <value_in_UI_units>
EVM链(XLayer):
bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain 196 \
  --input-data <dataList[N].serializedData> \
  --value <value_in_UI_units>
Solana链:
bash
onchainos wallet contract-call \
  --to <dataList[N].to> \
  --chain 501 \
  --unsigned-tx <dataList[N].serializedData>
contract-call
会在内部处理TEE签名和广播——无需单独执行广播步骤。
--value
单位转换
dataList[].value
为最小单位(wei),
contract-call --value
要求使用UI单位。转换公式:
value_UI = value / 10^原生代币小数位数
(例如ETH/POL为18,SOL为9)。若
value
为空、"0"或"0x0",则使用"0"。
--chain
映射
contract-call
gateway broadcast
需要传入真实链ID(例如
1
=以太坊,
137
=Polygon,
56
=BSC,
501
=Solana,
196
=XLayer)。
执行规则
  • 先执行
    dataList[0]
    ,再执行
    dataList[1]
    ,以此类推。禁止并行执行
  • 等待上一步链上确认后再执行下一步(路径A:
    txStatus=2
    ;路径B:
    contract-call
    返回txHash)
  • 若某一步失败,终止所有后续步骤并告知用户成功/失败的步骤
invest
/
withdraw
/
collect
仅返回未签名的calldata——不负责广播。CLI绝不会存储私钥。

Displaying Search / List Results

搜索/列表结果展示格式

#PlatformChaininvestmentIdNameAPYTVL
1Aave V3ETH9502USDC1.89%$3.52B
  • investmentId
    is MANDATORY in every row
  • rate
    is decimal → multiply by 100 and append
    %
  • tvl
    → format as human-readable USD ($3.52B, $537M)
  • Display data as-is — do NOT editorialize on APY values
序号平台investmentId名称APYTVL
1Aave V3ETH9502USDC1.89%$3.52B
  • 每一行必须包含
    investmentId
  • rate
    为小数格式 → 乘以100后添加
    %
    符号
  • tvl
    → 格式化为易读的美元金额(如$3.52B、$537M)
  • 按原始数据展示——不得对APY值进行编辑或评价

rewardType Reference

rewardType参考

rewardTypeWhen to useRequired params
REWARD_PLATFORM
Protocol-level rewards (e.g. AAVE token)
--platform-id
REWARD_INVESTMENT
Product mining/staking rewards
--investment-id
+
--platform-id
V3_FEE
V3 trading fee collection
--investment-id
+
--token-id
REWARD_OKX_BONUS
OKX bonus rewards
--investment-id
+
--platform-id
REWARD_MERKLE_BONUS
Merkle proof-based bonus
--investment-id
+
--platform-id
UNLOCKED_PRINCIPAL
Unlocked principal after lock
--investment-id
+
--principal-index
rewardType使用场景必填参数
REWARD_PLATFORM
协议级奖励(例如AAVE代币)
--platform-id
REWARD_INVESTMENT
产品挖矿/质押奖励
--investment-id
+
--platform-id
V3_FEE
V3交易手续费领取
--investment-id
+
--token-id
REWARD_OKX_BONUS
OKX专属奖励
--investment-id
+
--platform-id
REWARD_MERKLE_BONUS
基于默克尔证明的奖励
--investment-id
+
--platform-id
UNLOCKED_PRINCIPAL
锁定期结束后解锁的本金
--investment-id
+
--principal-index

Key Protocol Rules

核心协议规则

  • Aave borrow: uses
    callDataType=WITHDRAW
    internally — do not expose to user
  • Aave repay: uses
    callDataType=DEPOSIT
    internally — do not expose to user
  • V3 Pool exit: pass
    --token-id
    +
    --ratio
    (e.g.
    --ratio 1
    for full exit)
  • Partial withdrawal (non-V3): pass
    --amount
    for the exit amount
  • Full withdrawal:
    --ratio 1
  • Aave借入:内部使用
    callDataType=WITHDRAW
    ——无需向用户暴露此细节
  • Aave偿还:内部使用
    callDataType=DEPOSIT
    ——无需向用户暴露此细节
  • V3池退出:需传入
    --token-id
    +
    --ratio
    (例如全额退出使用
    --ratio 1
  • 非V3部分提款:需传入
    --amount
    指定提款金额
  • 全额提款:使用
    --ratio 1

Post-execution Suggestions

操作后建议

Just completedSuggest
defi list
/
defi search
View details →
defi detail
, or start deposit flow
defi detail
Proceed →
defi invest
, or compare →
defi search
defi invest
success
View positions →
okx-defi-portfolio
, or search more
defi withdraw
success
Check positions →
okx-defi-portfolio
, or check balance →
okx-wallet-portfolio
defi collect
success
Check positions →
okx-defi-portfolio
, or swap rewards →
okx-dex-swap
刚完成的操作建议后续操作
defi list
/
defi search
查看产品详情→
defi detail
,或启动存款流程
defi detail
继续操作→
defi invest
,或对比其他产品→
defi search
defi invest
成功
查看头寸→
okx-defi-portfolio
,或搜索更多产品
defi withdraw
成功
检查头寸→
okx-defi-portfolio
,或检查余额→
okx-wallet-portfolio
defi collect
成功
查询头寸→
okx-defi-portfolio
,或兑换奖励→
okx-dex-swap

Error Codes

错误码

CodeScenarioHandling
84400Parameter nullCheck required params — partial exit needs
--amount
or
--ratio
84021Asset syncing"Position data is syncing, please retry shortly"
84023Invalid expectOutputListCLI auto-constructs from position-detail; retry or pass
--platform-id
84014Balance check failedInsufficient balance — check with
okx-wallet-portfolio
84018Balancing failedV3 balancing failed — adjust price range or increase slippage
84010Token not supportedCheck supported tokens via
defi detail
84001Platform not supportedDeFi platform not supported
84016Contract execution failedCheck parameters and retry
84019Address format mismatchAddress format invalid for this chain
50011Rate limitWait and retry
代码场景处理方式
84400参数为空检查必填参数——部分提款需传入
--amount
--ratio
84021资产同步中「头寸数据正在同步,请稍后重试」
84023expectOutputList无效CLI会自动从position-detail构造参数;重试或传入
--platform-id
84014余额检查失败余额不足——调用
okx-wallet-portfolio
确认
84018平衡失败V3池平衡失败——调整价格区间或提高滑点
84010代币不支持通过
defi detail
查看支持的代币
84001平台不支持该DeFi平台未被支持
84016合约执行失败检查参数后重试
84019地址格式不匹配该地址格式不适用于目标链
50011触发速率限制等待后重试

Global Notes

全局注意事项

  • --amount
    must be in minimal units (integer). Convert: userAmount × 10^tokenPrecision. Example: 0.1 USDC (precision=6) →
    --amount 100000
    . Get tokenPrecision from
    defi detail
    or
    defi position-detail
  • The wallet address parameter for ALL defi commands is
    --address
  • --slippage
    default is
    "0.01"
    (1%); suggest
    "0.03"
    "0.05"
    for volatile V3 pools
  • CRITICAL — Solana transaction expiry: Solana DeFi transactions use base58-encoded VersionedTransaction with a blockhash that expires in ~60 seconds. After receiving calldata, you MUST warn the user: "This Solana transaction must be signed and broadcast within 60 seconds or it will expire. Please sign immediately." Do NOT proceed to other conversation without delivering this warning first.
  • CRITICAL — High APY risk warning: When displaying search/list results, if any product has APY > 50% (rate > 0.5), you MUST warn the user: "WARNING: This product shows APY above 50%, which indicates elevated risk (potential impermanent loss, smart contract risk, or unsustainable rewards). Proceed with caution." Do NOT silently display high-APY products without this warning.
  • CRITICAL — Address-chain compatibility: When calling
    defi positions
    or
    defi position-detail
    , 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
    • If the user wants positions across both EVM and Solana, make two separate calls with the respective addresses
  • User confirmation required before every invest/withdraw/collect execution
  • Address used for calldata generation MUST match the signing address
  • --amount
    必须为最小单位(整数)。转换方式:用户输入金额 × 10^tokenPrecision。示例:0.1 USDC(precision=6)→
    --amount 100000
    。从
    defi detail
    defi position-detail
    获取tokenPrecision
  • 所有defi命令的钱包地址参数均为
    --address
  • --slippage
    默认值为
    "0.01"
    (1%);对于波动较大的V3池,建议设置为
    "0.03"
    "0.05"
  • 关键注意事项——Solana交易过期时间:Solana DeFi交易使用base58编码的VersionedTransaction,其blockhash约60秒后过期。获取calldata后,必须立即提示用户:「此Solana交易需在60秒内签名并广播,否则将过期。请立即签名。」在发出此提示前,不得进行其他对话操作
  • 关键注意事项——高APY风险提示:展示搜索/列表结果时,若任何产品APY>%50(rate>0.5),必须提示用户:「警告:该产品APY超过50%,存在高风险(可能无常损失、智能合约风险或奖励不可持续)。请谨慎操作。」不得静默展示高APY产品
  • 关键注意事项——地址与链兼容性:调用
    defi positions
    defi position-detail
    时,
    --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
    • 若用户需要查询EVM和Solana链的头寸,需使用对应地址分别发起两次调用
  • 执行invest/withdraw/collect前必须获得用户确认
  • 生成calldata使用的地址必须与签名地址一致