dapp-aave

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Aave V3 Lending Protocol CLI

Aave V3 借贷协议 CLI

7 commands for lending market data, reserve details, account positions, supply/withdraw, and borrow/repay operations.
包含7个命令,用于获取借贷市场数据、储备详情、账户头寸,以及执行存提、借贷和还款操作。

Pre-flight Checks

前置检查

Every time before running any
plugin-store
command, always follow these steps in order. Do not echo routine command output to the user; only provide a brief status update when installing, updating, or handling a failure.
  1. Confirm installed: Run
    which plugin-store
    . If not found, install it:
    bash
    curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh
    If the install script fails, ask the user to install manually following the instructions at: https://github.com/okx/plugin-store
  2. Check for updates: Read
    ~/.plugin-store/last_check
    and compare it with the current timestamp:
    bash
    cached_ts=$(cat ~/.plugin-store/last_check 2>/dev/null || true)
    now=$(date +%s)
    • If
      cached_ts
      is non-empty and
      (now - cached_ts) < 43200
      (12 hours), skip the update and proceed.
    • Otherwise (file missing or older than 12 hours), run the installer to check for updates:
      bash
      curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh
  3. If any
    plugin-store
    command fails with an unexpected error during this session, try reinstalling before giving up.
每次运行任何
plugin-store
命令前,请务必按以下步骤操作。无需向用户回显常规命令输出;仅在安装、更新或处理失败时提供简短状态更新。
  1. 确认已安装:运行
    which plugin-store
    。若未找到,请执行以下命令安装:
    bash
    curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh
    若安装脚本失败,请告知用户按照以下链接的说明手动安装:https://github.com/okx/plugin-store
  2. 检查更新:读取
    ~/.plugin-store/last_check
    并与当前时间戳对比:
    bash
    cached_ts=$(cat ~/.plugin-store/last_check 2>/dev/null || true)
    now=$(date +%s)
    • cached_ts
      非空且
      (now - cached_ts) < 43200
      (12小时),则跳过更新继续操作。
    • 否则(文件缺失或已超过12小时),运行安装脚本检查更新:
      bash
      curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh
  3. 若本次会话中任何
    plugin-store
    命令出现意外错误,请先尝试重新安装再放弃。

Skill Routing

Skill路由

  • For token search / analytics → use
    okx-dex-token
  • For DEX swap → use
    okx-dex-swap
  • For token prices / charts → use
    okx-dex-market
  • For wallet balances → use
    okx-wallet-portfolio
  • For transaction broadcasting → use
    okx-onchain-gateway
  • For prediction markets → use
    okx-dapp-polymarket
  • 代币搜索/分析 → 使用
    okx-dex-token
  • DEX兑换 → 使用
    okx-dex-swap
  • 代币价格/图表 → 使用
    okx-dex-market
  • 钱包余额 → 使用
    okx-wallet-portfolio
  • 交易广播 → 使用
    okx-onchain-gateway
  • 预测市场 → 使用
    okx-dapp-polymarket

Authentication

身份验证

Data commands (markets, reserve, account): No authentication needed. Work immediately.
Transaction commands (supply, withdraw, borrow, repay): Require an EVM wallet private key:
bash
undefined
数据类命令(市场、储备、账户):无需身份验证,可直接使用。
交易类命令(存入、提取、借贷、还款):需要EVM钱包私钥:
bash
undefined

Add to .env file

添加到.env文件

EVM_PRIVATE_KEY=0x...

The private key is used to sign supply, withdraw, borrow, and repay transactions on-chain.
EVM_PRIVATE_KEY=0x...

私钥用于签署链上的存入、提取、借贷和还款交易。

Quickstart

快速入门

Browse and Research

浏览与调研

bash
undefined
bash
undefined

List all Aave V3 markets on Ethereum

列出以太坊上所有Aave V3市场

plugin-store aave markets --chain ethereum
plugin-store aave markets --chain ethereum

Get reserve details for USDC

获取USDC的储备详情

plugin-store aave reserve USDC --chain ethereum
plugin-store aave reserve USDC --chain ethereum

Check account positions

查看账户头寸

plugin-store aave account 0xYourAddress --chain ethereum
undefined
plugin-store aave account 0xYourAddress --chain ethereum
undefined

Supply and Withdraw

存入与提取

bash
undefined
bash
undefined

Supply 100 USDC to Aave on Ethereum

向以太坊上的Aave存入100 USDC

plugin-store aave supply --token USDC --amount 100 --chain ethereum
plugin-store aave supply --token USDC --amount 100 --chain ethereum

Withdraw 50 USDC from Aave

从Aave提取50 USDC

plugin-store aave withdraw --token USDC --amount 50 --chain ethereum
plugin-store aave withdraw --token USDC --amount 50 --chain ethereum

Withdraw all USDC (full balance)

提取全部USDC(全额余额)

plugin-store aave withdraw --token USDC --amount max --chain ethereum
undefined
plugin-store aave withdraw --token USDC --amount max --chain ethereum
undefined

Borrow and Repay

借贷与还款

bash
undefined
bash
undefined

Borrow 500 USDC against your collateral (variable rate)

以可变利率抵押借贷500 USDC

plugin-store aave borrow --token USDC --amount 500 --chain ethereum
plugin-store aave borrow --token USDC --amount 500 --chain ethereum

Repay 200 USDC of your debt

偿还200 USDC债务

plugin-store aave repay --token USDC --amount 200 --chain ethereum
plugin-store aave repay --token USDC --amount 200 --chain ethereum

Repay all outstanding USDC debt

偿还全部未结清USDC债务

plugin-store aave repay --token USDC --amount max --chain ethereum
undefined
plugin-store aave repay --token USDC --amount max --chain ethereum
undefined

Command Index

命令索引

#CommandAuthDescription
1
plugin-store aave markets --chain <chain>
NoList all Aave V3 reserve markets on a chain
2
plugin-store aave reserve <symbol> --chain <chain>
NoGet detailed reserve data (APY, liquidity, config)
3
plugin-store aave account <address> --chain <chain>
NoView account positions, health factor, borrowing power
4
plugin-store aave supply --token <symbol> --amount <n> --chain <chain>
YesSupply assets to earn yield
5
plugin-store aave withdraw --token <symbol> --amount <n> --chain <chain>
YesWithdraw supplied assets (use "max" for full withdrawal)
6
plugin-store aave borrow --token <symbol> --amount <n> --chain <chain>
YesBorrow assets at variable rate against collateral
7
plugin-store aave repay --token <symbol> --amount <n> --chain <chain>
YesRepay borrowed assets (use "max" for full repayment)
序号命令需要身份验证描述
1
plugin-store aave markets --chain <chain>
列出指定链上所有Aave V3储备市场
2
plugin-store aave reserve <symbol> --chain <chain>
获取储备资产的详细数据(APY、流动性、配置)
3
plugin-store aave account <address> --chain <chain>
查看账户头寸、健康因子、借贷额度
4
plugin-store aave supply --token <symbol> --amount <n> --chain <chain>
存入资产以赚取收益
5
plugin-store aave withdraw --token <symbol> --amount <n> --chain <chain>
提取已存入的资产(使用“max”提取全额)
6
plugin-store aave borrow --token <symbol> --amount <n> --chain <chain>
以可变利率抵押借贷资产
7
plugin-store aave repay --token <symbol> --amount <n> --chain <chain>
偿还借贷资产(使用“max”全额偿还)

Cross-Skill Workflows

跨Skill工作流

Workflow A: Research and Supply (most common)

工作流A:调研与存入(最常见)

User: "What are the best lending rates on Aave right now?"
1. aave markets --chain ethereum                  → show all reserves with APYs
       ↓ user picks an asset
2. aave reserve USDC --chain ethereum              → show detailed reserve info
       ↓ user wants to supply
3. Check EVM_PRIVATE_KEY is set
       ↓ not set → prompt user to add to .env
       ↓ set → continue
4. aave supply --token USDC --amount 100 --chain ethereum
5. "Supplied 100 USDC to Aave V3. You will receive aUSDC as a receipt token."
Data handoff:
  • symbol
    from markets data →
    <symbol>
    for reserve/supply/withdraw commands
  • underlyingAsset
    address is resolved automatically from the symbol
用户:“当前Aave上的最佳贷款利率是多少?”
1. aave markets --chain ethereum                  → 展示所有储备资产及其APY
       ↓ 用户选择某一资产
2. aave reserve USDC --chain ethereum              → 展示该储备资产的详细信息
       ↓ 用户想要存入资产
3. 检查EVM_PRIVATE_KEY是否已设置
       ↓ 未设置 → 提示用户添加到.env文件
       ↓ 已设置 → 继续
4. aave supply --token USDC --amount 100 --chain ethereum
5. “已向Aave V3存入100 USDC。你将收到aUSDC作为凭证代币。”
数据传递
  • 市场数据中的
    symbol
    → 用于储备/存入/提取命令的
    <symbol>
    参数
  • underlyingAsset
    地址会自动从代币符号解析

Workflow B: Portfolio Review and Withdrawal

工作流B:投资组合审查与提取

1. aave account 0xYourAddress --chain ethereum     → show positions, health factor
2. aave reserve WETH --chain ethereum              → check current rates on a position
3. aave withdraw --token WETH --amount max --chain ethereum  → withdraw full balance
1. aave account 0xYourAddress --chain ethereum     → 展示头寸、健康因子
2. aave reserve WETH --chain ethereum              → 查看当前头寸的利率
3. aave withdraw --token WETH --amount max --chain ethereum  → 提取全额余额

Workflow C: Multi-Chain Comparison

工作流C:多链对比

1. aave markets --chain ethereum                   → Ethereum rates
2. aave markets --chain polygon                    → Polygon rates
3. aave markets --chain arbitrum                   → Arbitrum rates
4. aave supply --token USDC --amount 100 --chain arbitrum  → supply on best chain
1. aave markets --chain ethereum                   → 以太坊利率
2. aave markets --chain polygon                    → Polygon利率
3. aave markets --chain arbitrum                   → Arbitrum利率
4. aave supply --token USDC --amount 100 --chain arbitrum  → 在最优链上存入资产

Workflow D: With OKX Skills

工作流D:与OKX Skills配合使用

1. okx-wallet-portfolio balance --chain ethereum   → check token balances
2. aave markets --chain ethereum                   → check lending rates
3. aave supply --token USDC --amount 100 --chain ethereum  → supply to Aave
1. okx-wallet-portfolio balance --chain ethereum   → 检查代币余额
2. aave markets --chain ethereum                   → 检查贷款利率
3. aave supply --token USDC --amount 100 --chain ethereum  → 向Aave存入资产

Operation Flow

操作流程

Step 1: Identify Intent

步骤1:识别意图

  • Browse markets/rates →
    markets
  • Check specific asset details →
    reserve
  • Check account status →
    account
  • Deposit/lend assets →
    supply
  • Withdraw assets →
    withdraw
  • Borrow against collateral →
    borrow
  • Repay debt →
    repay
  • 浏览市场/利率 → 使用
    markets
    命令
  • 查看特定资产详情 → 使用
    reserve
    命令
  • 检查账户状态 → 使用
    account
    命令
  • 存入/出借资产 → 使用
    supply
    命令
  • 提取资产 → 使用
    withdraw
    命令
  • 抵押借贷 → 使用
    borrow
    命令
  • 偿还债务 → 使用
    repay
    命令

Step 2: Collect Parameters

步骤2:收集参数

  • Missing chain → ask user which chain (ethereum, polygon, or arbitrum)
  • Missing symbol for reserve → use
    markets
    first, then pick from the list
  • Missing address for account → ask user for their wallet address
  • Missing amount for supply/withdraw/borrow/repay → ask user how much
  • Missing private key (for supply/withdraw/borrow/repay) → prompt to set
    EVM_PRIVATE_KEY
    in
    .env
  • 缺少链信息 → 询问用户选择哪个链(ethereum、polygon或arbitrum)
  • 缺少储备资产符号 → 先使用
    markets
    命令,再从列表中选择
  • 缺少账户地址 → 询问用户的钱包地址
  • 缺少存入/提取/借贷/还款金额 → 询问用户具体金额
  • 缺少私钥(用于存入/提取/借贷/还款) → 提示用户在
    .env
    中设置
    EVM_PRIVATE_KEY

Step 3: Execute

步骤3:执行

  • Data phase: show market info, rates, positions, let user make informed decision
  • Confirmation phase: before any supply/withdraw, display token, amount, chain, estimated APY, and ask for confirmation
  • Execution phase: submit transaction, show result with tx hash
  • 数据阶段:展示市场信息、利率、头寸,让用户做出明智决策
  • 确认阶段:在执行任何存入/提取操作前,显示代币、金额、链、预估APY,并请求用户确认
  • 执行阶段:提交交易,展示包含交易哈希的结果

Step 4: Suggest Next Steps

步骤4:建议下一步操作

Just completedSuggest
markets
1. Check specific reserve details →
reserve
2. View account positions →
account
reserve
1. Supply assets →
supply
2. Compare with other chains →
markets
on another chain
account
1. Withdraw assets →
withdraw
2. Supply more →
supply
supply
1. Check updated position →
account
2. View reserve APY →
reserve
withdraw
1. Check updated position →
account
2. View wallet balance →
okx-wallet-portfolio
borrow
1. Check health factor →
account
2. Monitor borrow rate →
reserve
repay
1. Check updated debt →
account
2. View wallet balance →
okx-wallet-portfolio
Present conversationally — never expose skill names or endpoint paths to the user.
刚完成的操作建议操作
markets
1. 查看特定储备资产详情 →
reserve
2. 查看账户头寸 →
account
reserve
1. 存入资产 →
supply
2. 对比其他链 → 在另一链上使用
markets
account
1. 提取资产 →
withdraw
2. 存入更多资产 →
supply
supply
1. 查看更新后的头寸 →
account
2. 查看储备资产APY →
reserve
withdraw
1. 查看更新后的头寸 →
account
2. 查看钱包余额 →
okx-wallet-portfolio
borrow
1. 检查健康因子 →
account
2. 监控借贷利率 →
reserve
repay
1. 查看更新后的债务 →
account
2. 查看钱包余额 →
okx-wallet-portfolio
请以对话形式呈现——切勿向用户暴露Skill名称或端点路径。

CLI Command Reference

CLI命令参考

1. plugin-store aave markets

1. plugin-store aave markets

bash
plugin-store aave markets --chain <chain>
ParamRequiredDefaultDescription
--chain
Yes-Chain: ethereum, polygon, arbitrum
Key return fields per reserve:
FieldDescription
symbol
Asset symbol (e.g. USDC, WETH, DAI)
underlyingAsset
Token contract address
supplyAPY
Current annual supply yield (as decimal, multiply by 100 for %)
borrowAPY
Current annual borrow rate
totalSupply
Total amount supplied
totalBorrow
Total amount borrowed
availableLiquidity
Amount available to borrow
utilizationRate
Ratio of borrowed to supplied
ltv
Loan-to-value ratio for collateral
liquidationThreshold
Threshold at which position can be liquidated
bash
plugin-store aave markets --chain <chain>
参数是否必填默认值描述
--chain
-链:ethereum、polygon、arbitrum
每个储备资产的关键返回字段
字段描述
symbol
资产符号(如USDC、WETH、DAI)
underlyingAsset
代币合约地址
supplyAPY
当前年化存入收益率(小数形式,乘以100为百分比)
borrowAPY
当前年化借贷利率
totalSupply
总存入量
totalBorrow
总借贷量
availableLiquidity
可借贷的资产量
utilizationRate
借贷量与存入量的比率
ltv
抵押品的贷款价值比
liquidationThreshold
头寸可被清算的阈值

2. plugin-store aave reserve

2. plugin-store aave reserve

bash
plugin-store aave reserve <symbol> --chain <chain>
ParamRequiredDefaultDescription
<symbol>
Yes-Asset symbol (e.g. USDC, WETH, DAI)
--chain
Yes-Chain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
symbol
Asset symbol
supplyAPY
Current supply APY
variableBorrowAPY
Variable borrow rate
stableBorrowAPY
Stable borrow rate (if available)
totalSupply
Total supplied amount
totalBorrow
Total borrowed amount
availableLiquidity
Available to borrow
utilizationRate
Current utilization
ltv
Max loan-to-value for collateral
liquidationThreshold
Liquidation trigger threshold
liquidationBonus
Bonus for liquidators
reserveFactor
Protocol fee on interest
canBeCollateral
Whether asset can be used as collateral
borrowingEnabled
Whether borrowing is enabled
bash
plugin-store aave reserve <symbol> --chain <chain>
参数是否必填默认值描述
<symbol>
-资产符号(如USDC、WETH、DAI)
--chain
-链:ethereum、polygon、arbitrum
返回字段
字段描述
symbol
资产符号
supplyAPY
当前存入APY
variableBorrowAPY
可变借贷利率
stableBorrowAPY
稳定借贷利率(若可用)
totalSupply
总存入量
totalBorrow
总借贷量
availableLiquidity
可借贷的资产量
utilizationRate
当前使用率
ltv
抵押品的最大贷款价值比
liquidationThreshold
清算触发阈值
liquidationBonus
清算者奖励
reserveFactor
协议对利息收取的手续费
canBeCollateral
该资产是否可作为抵押品
borrowingEnabled
是否允许借贷该资产

3. plugin-store aave account

3. plugin-store aave account

bash
plugin-store aave account <address> --chain <chain>
ParamRequiredDefaultDescription
<address>
Yes-Wallet address (0x...)
--chain
Yes-Chain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
totalSuppliedUSD
Total value of supplied assets in USD
totalBorrowedUSD
Total value of borrowed assets in USD
netWorthUSD
Net position value in USD
healthFactor
Health factor (< 1.0 = liquidatable)
availableBorrowsUSD
Remaining borrowing capacity in USD
currentLTV
Current loan-to-value ratio
supplies
List of supplied positions
[{symbol, amount, amountUSD, apy}]
borrows
List of borrow positions
[{symbol, amount, amountUSD, apy}]
bash
plugin-store aave account <address> --chain <chain>
参数是否必填默认值描述
<address>
-钱包地址(0x...)
--chain
-链:ethereum、polygon、arbitrum
返回字段
字段描述
totalSuppliedUSD
已存入资产的总价值(美元)
totalBorrowedUSD
已借贷资产的总价值(美元)
netWorthUSD
净头寸价值(美元)
healthFactor
健康因子(<1.0表示可被清算)
availableBorrowsUSD
剩余借贷额度(美元)
currentLTV
当前贷款价值比
supplies
已存入头寸列表
[{symbol, amount, amountUSD, apy}]
borrows
已借贷头寸列表
[{symbol, amount, amountUSD, apy}]

4. plugin-store aave supply

4. plugin-store aave supply

bash
plugin-store aave supply --token <symbol> --amount <amount> --chain <chain>
ParamRequiredDefaultDescription
--token
Yes-Asset symbol (e.g. USDC, WETH)
--amount
Yes-Amount to supply (in token units)
--chain
Yes-Chain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
txHash
Transaction hash
status
Transaction status (pending, confirmed, failed)
supplied
Amount supplied
token
Token symbol
chain
Chain used
bash
plugin-store aave supply --token <symbol> --amount <amount> --chain <chain>
参数是否必填默认值描述
--token
-资产符号(如USDC、WETH)
--amount
-存入金额(代币单位)
--chain
-链:ethereum、polygon、arbitrum
返回字段
字段描述
txHash
交易哈希
status
交易状态(pending、confirmed、failed)
supplied
存入金额
token
代币符号
chain
使用的链

5. plugin-store aave withdraw

5. plugin-store aave withdraw

bash
plugin-store aave withdraw --token <symbol> --amount <amount> --chain <chain>
ParamRequiredDefaultDescription
--token
Yes-Asset symbol (e.g. USDC, WETH)
--amount
Yes-Amount to withdraw (in token units, or "max" for full withdrawal)
--chain
Yes-Chain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
txHash
Transaction hash
status
Transaction status (pending, confirmed, failed)
withdrawn
Amount withdrawn
token
Token symbol
chain
Chain used
bash
plugin-store aave withdraw --token <symbol> --amount <amount> --chain <chain>
参数是否必填默认值描述
--token
-资产符号(如USDC、WETH)
--amount
-提取金额(代币单位,或使用“max”提取全额)
--chain
-链:ethereum、polygon、arbitrum
返回字段
字段描述
txHash
交易哈希
status
交易状态(pending、confirmed、failed)
withdrawn
提取金额
token
代币符号
chain
使用的链

6. plugin-store aave borrow

6. plugin-store aave borrow

bash
plugin-store aave borrow --token <symbol> --amount <amount> --chain <chain>
ParamRequiredDefaultDescription
--token
Yes-Asset symbol to borrow (e.g. USDC, WETH)
--amount
Yes-Amount to borrow (in token units)
--chain
NoethereumChain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
txHash
Transaction hash
status
Transaction status (success, reverted)
borrowed
Amount borrowed
token
Token symbol
chain
Chain used
bash
plugin-store aave borrow --token <symbol> --amount <amount> --chain <chain>
参数是否必填默认值描述
--token
-要借贷的资产符号(如USDC、WETH)
--amount
-借贷金额(代币单位)
--chain
ethereum链:ethereum、polygon、arbitrum
返回字段
字段描述
txHash
交易哈希
status
交易状态(success、reverted)
borrowed
借贷金额
token
代币符号
chain
使用的链

7. plugin-store aave repay

7. plugin-store aave repay

bash
plugin-store aave repay --token <symbol> --amount <amount> --chain <chain>
ParamRequiredDefaultDescription
--token
Yes-Asset symbol to repay (e.g. USDC, WETH)
--amount
Yes-Amount to repay (in token units, or "max" for full repayment)
--chain
NoethereumChain: ethereum, polygon, arbitrum
Return fields:
FieldDescription
txHash
Transaction hash
status
Transaction status (success, reverted)
repaid
Amount repaid
token
Token symbol
chain
Chain used
bash
plugin-store aave repay --token <symbol> --amount <amount> --chain <chain>
参数是否必填默认值描述
--token
-要偿还的资产符号(如USDC、WETH)
--amount
-偿还金额(代币单位,或使用“max”全额偿还)
--chain
ethereum链:ethereum、polygon、arbitrum
返回字段
字段描述
txHash
交易哈希
status
交易状态(success、reverted)
repaid
偿还金额
token
代币符号
chain
使用的链

Key Concepts

核心概念

  • Supply APY: Annual percentage yield earned by supplying assets. Rates are variable and change based on utilization.
  • Health Factor: Ratio indicating position safety. Above 1.0 is safe; below 1.0 means the position can be liquidated. Keep it well above 1.0 (recommended > 1.5).
  • aTokens: Receipt tokens received when supplying (e.g. supply USDC, receive aUSDC). aTokens accrue interest automatically — their balance grows over time.
  • RAY: Aave uses 27-decimal fixed-point numbers (1 RAY = 10^27) for rate calculations internally. The CLI converts these to human-readable percentages.
  • LTV (Loan-to-Value): Maximum percentage of collateral value that can be borrowed. E.g. 80% LTV means you can borrow up to 80% of your collateral value.
  • Liquidation Threshold: The LTV level at which a position becomes eligible for liquidation. Always higher than the max LTV.
  • Utilization Rate: Ratio of total borrowed to total supplied. Higher utilization = higher rates for both suppliers and borrowers.
  • Supply APY:存入资产可获得的年化收益率。利率是可变的,会根据使用率变化。
  • 健康因子:表示头寸安全性的比率。高于1.0为安全;低于1.0表示头寸可被清算。建议保持在1.5以上。
  • aTokens:存入资产时收到的凭证代币(如存入USDC,收到aUSDC)。aTokens会自动累积利息——其余额会随时间增长。
  • RAY:Aave内部使用27位定点数(1 RAY = 10^27)进行利率计算。CLI会将其转换为人类可读的百分比。
  • LTV(贷款价值比):可借贷的抵押品价值的最大百分比。例如,80% LTV表示你最多可借贷抵押品价值的80%。
  • 清算阈值:头寸具备清算资格的LTV水平。始终高于最大LTV。
  • 使用率:总借贷量与总存入量的比率。使用率越高,存入者和借贷者的利率就越高。

Edge Cases

边缘情况

  • Insufficient balance: If the user tries to supply more than their wallet balance, the transaction will fail. Check balance first via
    okx-wallet-portfolio
    .
  • Health factor risk: When withdrawing collateral or borrowing, warn if the resulting health factor would drop below 1.5. Withdrawing/borrowing too much can trigger liquidation.
  • Borrow capacity: User must have sufficient collateral before borrowing. Check available borrows via
    account
    command.
  • Max repay: Use
    --amount max
    to repay the full outstanding debt including accrued interest.
  • Max withdrawal: Use
    --amount max
    to withdraw the full supplied balance including accrued interest. This uses
    type(uint256).max
    internally.
  • Token approval: First-time supply of a token requires an ERC-20 approval transaction. The CLI handles this automatically but it will use additional gas.
  • Private key not set: For supply/withdraw commands, show clear error: "Set EVM_PRIVATE_KEY in your .env file"
  • Unsupported chain: Only ethereum, polygon, and arbitrum are supported. Other chains will return an error.
  • Asset not listed: If a token symbol is not recognized as an Aave V3 reserve, suggest using
    markets
    to see available assets.
  • Rate limiting: OKX API has rate limits. Use retry with backoff.
  • 余额不足:若用户尝试存入超过钱包余额的资产,交易将失败。请先通过
    okx-wallet-portfolio
    检查余额。
  • 健康因子风险:当提取抵押品或借贷时,若结果健康因子低于1.5,需发出警告。提取/借贷过多可能触发清算。
  • 借贷额度:用户在借贷前必须有足够的抵押品。请通过
    account
    命令检查可用借贷额度。
  • 全额偿还:使用
    --amount max
    偿还包括应计利息在内的全部未结清债务。
  • 全额提取:使用
    --amount max
    提取包括应计利息在内的全部已存入余额。内部使用
    type(uint256).max
    实现。
  • 代币授权:首次存入某代币需要进行ERC-20授权交易。CLI会自动处理,但会消耗额外的Gas。
  • 未设置私钥:对于存入/提取命令,显示清晰错误:“请在.env文件中设置EVM_PRIVATE_KEY”
  • 不支持的链:仅支持ethereum、polygon和arbitrum。其他链会返回错误。
  • 资产未列出:若代币符号不被识别为Aave V3储备资产,建议使用
    markets
    命令查看可用资产。
  • 速率限制:OKX API有速率限制,请使用退避重试机制。