# Trade

> Swap tokens using Fibrous aggregation on Base, HyperEVM, or Monad. Finds an optimal route and supports a no-broadcast --simulate preview.

- Skill: `fibrous-finance/trade` (Agent Skill)
- Install (CLI): `npx skillmds@latest add fibrous-finance/trade`
- Raw SKILL.md: https://api.skillmd.com/api/skills/fibrous-finance/trade/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: Fibrous-Finance (https://skillmd.com/u/fibrous-finance)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/fibrous-finance/trade

---


# Trade / Swap Tokens

Exchange one token for another via Fibrous aggregation. The CLI finds the best
route, handles token approvals, estimates the swap gas when possible, and
executes.

> **Note:** Automatically detects and executes **Wrap** (Native -> Wrapped) and **Unwrap** (Wrapped -> Native) operations directly via contract calls, bypassing aggregation to save gas.

## Prerequisites

- Active session required.
- Sufficient balance of the source token + gas fees.

## Rules

1. BEFORE any trade, you MUST run `npx fibx@latest status` and `npx fibx@latest balance` to verify connectivity and source token balance.
2. If the user specifies a chain, you MUST include `--chain <name>`. If not specified, default to `base` and state it.
3. Default slippage is **0.5%**. To change it, you MUST ask the user for confirmation before using `--slippage`.
4. The CLI defaults to **exact approval** for ERC-20 tokens. NEVER use `--approve-max` unless the user explicitly requests it.
5. AFTER a successful trade, you MUST verify the transaction using `tx-status` with the same `--chain` flag.

## Chain Reference

| Chain    | Flag               | Native Token |
| -------- | ------------------ | ------------ |
| Base     | `--chain base`     | ETH          |
| HyperEVM | `--chain hyperevm` | HYPE         |
| Monad    | `--chain monad`    | MON          |

## Commands

```bash
npx fibx@latest trade <amount> <from_token> <to_token> [--chain <chain>] [--slippage <n>] [--approve-max] [--simulate] [--json]
```

## Parameters

| Parameter     | Type   | Description                               | Required |
| ------------- | ------ | ----------------------------------------- | -------- |
| `amount`      | number | Amount of source token to swap            | Yes      |
| `from_token`  | string | Source token symbol (e.g. `ETH`, `USDC`)  | Yes      |
| `to_token`    | string | Target token symbol (e.g. `USDC`, `DAI`)  | Yes      |
| `chain`       | string | `base`, `hyperevm`, or `monad`  | No       |
| `slippage`    | number | Slippage tolerance in % (e.g. `1.0`)      | No       |
| `approve-max` | flag   | Use infinite approval instead of exact    | No       |
| `simulate`    | flag   | Preview without broadcasting transactions | No       |
| `json`        | flag   | Output as JSON                            | No       |

Default chain: `base`. Default slippage: `0.5`.

With `--simulate`, no approval or swap is broadcast. If an ERC-20 approval is
needed, the preview reports `requiresApproval: true`; a swap gas estimate is
only available when the current allowance is already sufficient.

## Examples

**User:** "Swap 0.1 ETH for USDC"

```bash
npx fibx@latest status
npx fibx@latest balance
npx fibx@latest trade 0.1 ETH USDC
npx fibx@latest tx-status <hash>
```

**User:** "Buy USDC with 1 MON on Monad"

```bash
npx fibx@latest status
npx fibx@latest balance --chain monad
npx fibx@latest trade 1 MON USDC --chain monad
npx fibx@latest tx-status <hash> --chain monad
```

**User:** "Wrap 1 ETH to WETH on Base"

```bash
npx fibx@latest status
npx fibx@latest balance
npx fibx@latest trade 1 ETH WETH --chain base
npx fibx@latest tx-status <hash>
```

**User:** "Unwrap 0.5 WMON on Monad"

```bash
npx fibx@latest status
npx fibx@latest balance --chain monad
npx fibx@latest trade 0.5 WMON MON --chain monad
npx fibx@latest tx-status <hash> --chain monad
```

## Error Handling

| Error                  | Action                                                        |
| ---------------------- | ------------------------------------------------------------- |
| `No route found`       | Liquidity may be too low or pair doesn't exist on the chain.  |
| `Insufficient balance` | Check `balance` and suggest a smaller amount.                 |
| `Slippage exceeded`    | Price moved unfavorably — suggest retrying with `--slippage`. |
| `Simulation failed`    | Route is invalid or would revert. Do not retry blindly.       |
| `Not authenticated`    | Run `authenticate-wallet` skill first.                        |
| `Rate limit / 429`     | Use `config` skill to set a custom RPC.                       |

## Related Skills

- Run `quote` BEFORE trading to check the expected price and exchange rate.
- Run `balance` BEFORE trading to verify sufficient source token balance.
- Run `portfolio` to see all holdings with USD values before deciding what to trade.
- Run `tx-status` AFTER trading to confirm the swap succeeded.
- Use `config` to set a custom RPC if you encounter rate limit errors.
- Use `aave` to supply swapped tokens into Aave V3 for yield.

