Trade / Swap Tokens
Use this skill to exchange one token for another. It uses the Fibrous Finance aggregator to find the best route.
Hard Rules (CRITICAL)
- •Pre-Flight Check: Before ANY trade, you MUST run:
- •
npx fibx status - •
npx fibx balance(ensure you have the source token)
- •
- •Chain Specification:
- •If the user mentions a specific chain (e.g., "on Monad", "for my Citrea wallet"), you MUST include the
--chain <name>parameter. - •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
--approve-maxunless the user explicitly requests "infinite approval" or "max approval".
- •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
tx-statusskill.
Usage
bash
npx fibx trade <amount> <from_token> <to_token> [options]
Arguments
| Argument | Description |
|---|---|
amount | Amount to swap (e.g., 1.5, 100). |
from_token | Source token symbol (ETH, USDC) or address. |
to_token | Destination token symbol (WETH, DAI) or address. |
Options
| Option | Description |
|---|---|
--chain <network> | Network: base, citrea, hyperevm, monad. Default: base. |
--slippage <n> | Slippage tolerance in percentage (e.g., 1.0). Default 0.5. |
--approve-max | Force infinite approval. Use with caution. |
--json | Output result as JSON. |
Examples
Standard Swap (Base)
User: "Swap 0.1 ETH for USDC"
Agent Actions:
- •
npx fibx status - •
npx fibx balance - •
npx fibx trade 0.1 ETH USDC - •
npx 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
Swap on Monad
User: "Buy USDC with 1 MON on Monad"
Agent Actions:
- •
npx fibx status --chain monad - •
npx 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
balanceagain. - •"Slippage exceeded": The price moved unfavorably; suggest retrying with higher slippage (after user confirmation).