trade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTrade / Swap Tokens
代币交易/兑换
Use this skill to exchange one token for another. It uses the Fibrous Finance aggregator to find the best route.
使用此技能可以将一种代币兑换为另一种代币。它借助Fibrous Finance聚合器寻找最优交易路径。
Hard Rules (CRITICAL)
硬性规则(至关重要)
- Pre-Flight Check: Before ANY trade, you MUST run:
npx fibx status- (ensure you have the source token)
npx fibx balance
- Chain Specification:
- If the user mentions a specific chain (e.g., "on Monad", "for my Citrea wallet"), you MUST include the parameter.
--chain <name> - If the user DOES NOT mention a chain, you MUST either:
- Explicitly state the default: "I will perform this trade on Base. Is that correct?"
- OR ask for clarification: "Which chain would you like to trade on? Base, Citrea, HyperEVM, or Monad?"
- If the user mentions a specific chain (e.g., "on Monad", "for my Citrea wallet"), you MUST include the
- Slippage Safety: The default slippage is 0.5%. If you need to change this (e.g., for volatile tokens), you MUST ask the user for confirmation first.
- Approval Limits: The CLI defaults to "Exact Approval" (approves only the amount to be swapped).
- Do NOT use unless the user explicitly requests "infinite approval" or "max approval".
--approve-max
- Do NOT use
- Simulation & Verification: The CLI performs a route check before swapping. If this fails, do not proceed. After swapping, verify the transaction with the skill.
tx-status
- 交易前检查:在进行任何交易之前,你必须运行以下命令:
npx fibx status- (确保你拥有足够的源代币)
npx fibx balance
- 链指定规则:
- 如果用户提到特定链(例如“在Monad上”、“为我的Citrea钱包”),你必须添加参数。
--chain <name> - 如果用户未提及链,你必须:
- 明确告知默认链:“我将在Base链上执行此交易。是否确认?”
- 或者询问用户确认:“你希望在哪个链上进行交易?Base、Citrea、HyperEVM还是Monad?”
- 如果用户提到特定链(例如“在Monad上”、“为我的Citrea钱包”),你必须添加
- 滑点安全设置:默认滑点为0.5%。如果需要修改(例如针对高波动代币),你必须先征得用户确认。
- 授权限额规则:CLI默认采用“精确授权”(仅授权本次兑换所需的代币数量)。
- 除非用户明确要求“无限授权”或“最大授权”,否则禁止使用参数。
--approve-max
- 除非用户明确要求“无限授权”或“最大授权”,否则禁止使用
- 模拟与验证:CLI会在兑换前进行路径检查。如果检查失败,请勿继续交易。兑换完成后,使用技能验证交易状态。
tx-status
Usage
使用方法
bash
npx fibx trade <amount> <from_token> <to_token> [options]bash
npx fibx trade <amount> <from_token> <to_token> [options]Arguments
参数说明
| Argument | Description |
|---|---|
| Amount to swap (e.g., |
| Source token symbol ( |
| Destination token symbol ( |
| 参数 | 描述 |
|---|---|
| 兑换数量(例如 |
| 源代币符号( |
| 目标代币符号( |
Options
可选参数
| Option | Description |
|---|---|
| Network: |
| Slippage tolerance in percentage (e.g., |
| Force infinite approval. Use with caution. |
| Output result as JSON. |
| 选项 | 描述 |
|---|---|
| 网络: |
| 滑点容忍度(百分比,例如 |
| 强制开启无限授权。请谨慎使用。 |
| 以JSON格式输出结果。 |
Examples
示例
Standard Swap (Base)
标准兑换(Base链)
User: "Swap 0.1 ETH for USDC"
Agent Actions:
npx fibx statusnpx fibx balancenpx fibx trade 0.1 ETH USDCnpx fibx tx-status <hash>
用户: "兑换0.1 ETH为USDC"
Agent操作:
npx fibx statusnpx fibx balancenpx fibx trade 0.1 ETH USDCnpx fibx tx-status <hash>
Swap with Custom Slippage
自定义滑点兑换
User: "Swap 1000 DEGEN to ETH with 2% slippage"
Agent Actions:
- Checks info.
- Agent: "Confirming: You want to swap 1000 DEGEN to ETH with 2% slippage. Is this correct?"
- User confirms.
npx fibx trade 1000 DEGEN ETH --slippage 2
用户: "将1000 DEGEN兑换为ETH,滑点设置为2%"
Agent操作:
- 检查相关信息。
- Agent: "确认:你希望将1000 DEGEN兑换为ETH,滑点设置为2%。是否正确?"
- 用户确认。
npx fibx trade 1000 DEGEN ETH --slippage 2
Swap on Monad
Monad链上兑换
User: "Buy USDC with 1 MON on Monad"
Agent Actions:
npx fibx status --chain monadnpx fibx trade 1 MON USDC --chain monad
用户: "在Monad链上用1 MON购买USDC"
Agent操作:
npx fibx status --chain monadnpx fibx trade 1 MON USDC --chain monad
Error Handling
错误处理
- "No route found": The trade path might not exist or liquidity is too low.
- "Insufficient balance": Check again.
balance - "Slippage exceeded": The price moved unfavorably; suggest retrying with higher slippage (after user confirmation).
- "No route found":交易路径不存在或流动性过低。
- "Insufficient balance":再次运行命令检查余额。
balance - "Slippage exceeded":价格出现不利波动;建议在征得用户确认后,提高滑点重试。