$npx -y skills add gate/gate-skills --skill gate-dex-trade-cligate-dex CLI swap skill: one-shot DEX swap (quote → GV checkin → sign → broadcast) via the swap command. GV checkin built in — no external binary. Supports EVM multi-chain and Solana, with ERC20 approve flow. Use this skill whenever the user wants to swap, exchange, buy, sell, co
| 1 | # Gate DEX CLI — Swap |
| 2 | |
| 3 | ## General Rules |
| 4 | |
| 5 | ⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. |
| 6 | Do NOT select or call any tool until all rules are read. These rules have the highest priority. |
| 7 | → Read [gate-runtime-rules.md](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) |
| 8 | - **Only call MCP tools explicitly listed in this skill.** Tools not documented here must NOT be called, even if they |
| 9 | exist in the MCP server. |
| 10 | - **Only use the `gate-dex` CLI subcommands explicitly listed in this skill and its references.** Commands not documented here must NOT be run for these workflows, even if other interfaces expose them. |
| 11 | |
| 12 | > One-shot DEX swap via CLI. GV checkin + sign + broadcast are all built into the `swap` command. No external `tx-checkin` binary needed. Supports EVM and Solana. |
| 13 | |
| 14 | ## Skill Boundaries |
| 15 | |
| 16 | | This skill | Route to other skill | |
| 17 | |-----------|----------------| |
| 18 | | Swap tokens (same-chain) | Auth / login issues → `gate-dex-wallet-cli` | |
| 19 | | Cross-chain bridge | Balance, address, token list → `gate-dex-wallet-cli` | |
| 20 | | Swap quote (preview) | Token transfers (send) → `gate-dex-wallet-cli` | |
| 21 | | Swap / bridge history & order detail | K-line, token info, token security → `gate-dex-market-cli` | |
| 22 | | Swappable & bridge token discovery | — | |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## Applicable Scenarios |
| 27 | |
| 28 | - "Swap ETH for USDT", "exchange tokens", "buy SOL", "convert", "trade" |
| 29 | - Get a swap quote before executing |
| 30 | - View swap history or a specific swap order detail |
| 31 | - List swappable tokens or cross-chain bridge tokens |
| 32 | |
| 33 | --- |
| 34 | |
| 35 | ## CLI Commands |
| 36 | |
| 37 | ### Quote (preview only, no signing) |
| 38 | |
| 39 | ```bash |
| 40 | # EVM: swap native ETH → USDT on Ethereum (chain_id = 1) |
| 41 | gate-dex quote --from-chain 1 --to-chain 1 --from - --to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01 |
| 42 | |
| 43 | # EVM: swap USDT → USDC on Arbitrum |
| 44 | gate-dex quote --from-chain 42161 --to-chain 42161 \ |
| 45 | --from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 \ |
| 46 | --to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 \ |
| 47 | --amount 100 |
| 48 | |
| 49 | # Solana: swap native SOL → USDC |
| 50 | gate-dex quote --from-chain 501 --to-chain 501 --from - \ |
| 51 | --to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.1 |
| 52 | |
| 53 | # Cross-chain bridge: ETH on Ethereum → USDT on Arbitrum |
| 54 | gate-dex quote --from-chain 1 --to-chain 42161 --from - \ |
| 55 | --to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1 \ |
| 56 | --to-wallet 0xYourArbitrumAddress |
| 57 | ``` |
| 58 | |
| 59 | Returns estimated output amount, price impact, route, and fee. **No signing.** |
| 60 | |
| 61 | ### One-Shot Swap (quote + GV checkin + sign + broadcast) |
| 62 | |
| 63 | ```bash |
| 64 | # EVM: swap native ETH → USDT |
| 65 | gate-dex swap --from-chain 1 --to-chain 1 --from - \ |
| 66 | --to 0xdAC17F958D2ee523a2206206994597C13D831ec7 --amount 0.01 |
| 67 | |
| 68 | # EVM: swap ERC20 with custom slippage |
| 69 | gate-dex swap --from-chain 42161 --to-chain 42161 \ |
| 70 | --from 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 \ |
| 71 | --to 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 \ |
| 72 | --amount 100 --slippage 0.005 |
| 73 | |
| 74 | # Solana: swap SOL → USDC |
| 75 | gate-dex swap --from-chain 501 --to-chain 501 --from - \ |
| 76 | --to EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 0.05 |
| 77 | |
| 78 | # Cross-chain bridge: ETH on Ethereum → USDT on Arbitrum |
| 79 | gate-dex swap --from-chain 1 --to-chain 42161 --from - \ |
| 80 | --to 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9 --amount 0.1 \ |
| 81 | --to-wallet 0xYourArbitrumAddress |
| 82 | ``` |
| 83 | |
| 84 | | Option | Required | Description | |
| 85 | |--------|----------|-------------| |
| 86 | | `--from-chain <id>` | Yes | Source chain ID | |
| 87 | | `--to-chain <id>` | No | Destination chain ID (defaults to same as from-chain) | |
| 88 | | `--from <token>` | Yes | Source token contract; use `-` for native token (ETH/S |