Gate DEX on-chain swap and trade execution skill. Use when the user asks to swap, buy, or sell on-chain with a signed transaction. Triggers on 'DEX swap', 'swap tokens on chain', 'bridge tokens'...
Pure Routing Layer โ Swap EXECUTION only. Every operation produces an on-chain transaction. All specifications in
references/.
โ ๏ธ STOP โ You MUST read and strictly follow the shared runtime rules before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority. โ Read gate-runtime-rules.md
Trigger Scenarios: Use when the user wants to execute a token exchange that modifies blockchain state:
Do not use OpenAPI for swap unless user explicitly asks OpenAPI/AK/SK. MCP unavailable โ references/setup.md only.
NOT this skill (common misroutes):
gate-dex-market (read-only lookup, no trade intent)gate-dex-wallet (account query)gate-dex-wallet (direct transfer, not swap)gate-dex-wallet (DApp interaction)User triggers trading intent
โ
Step 1: Has user explicitly specified a mode?
โโ Explicitly mentions "OpenAPI" / "AK/SK" / "API Key" โ OpenAPI mode
โโ Otherwise โ MCP only (Step 2)
โโ Not specified โ Step 2
โ
Step 2: Is this a cross-chain swap?
โโ Cross-chain โ Must use MCP mode (OpenAPI doesn't support cross-chain), proceed to Step 3
โโ Same-chain / uncertain โ Step 3
โ
Step 3: Gate Wallet MCP Server Discovery & Detection
a) Scan configured MCP Server list for Servers providing `dex_tx_swap_quote`, `dex_tx_swap_prepare`, and staged swap signing tools (and the Gate GV MCP that exposes `tx_checkin` for staged check-in; see MCP Mode below)
b) If found โ Record server identifier, verify with:
CallMcpTool(server="<identifier>", toolName="dex_chain_config", arguments={chain: "ETH"})
โโ Success โ MCP mode
โโ Failed โ Step 4
c) No matching Server โ Step 4
โ
Step 4: MCP unavailable โ setup guide only (`references/setup.md`), no OpenAPI fallback
Read and strictly follow references/mcp.md, execute according to its complete workflow.
Includes: connection detection, authentication (mcp_token), MCP Resource/tool calls (dex_tx_swap_quote / dex_tx_swap_prepare / dex_tx_swap_checkin_preview / staged sign-submit / dex_tx_swap_detail), token address resolution, native_in/native_out rules, three-step confirmation gateway (SOP), quote templates, risk warnings, cross-Skill collaboration, security rules.
Staged swap check-in โ after each dex_tx_swap_checkin_preview (per stage: approve then swap as required), call the Gate Web3 GV MCP tool tx_checkin using the preview fields. The user environment must include that MCP server (discover via tools/list). Parameter mapping: references/mcp.md ยง4.3 โ map preview mcp_token โ authorization as Bearer <token>; user_wallet โ wallet_address; checkin_message โ message; set source to integer 3; pass chain / chain_category as returned; set type to "" unless GV/product documents a required non-empty value. Read data.checkin_token (and handle need_otp) from the tool result, then call dex_tx_swap_sign_approve / dex_tx_swap_sign_swap. Do not reimplement GV check-in with raw curl or custom signing.
Default off in this workspace โ explicit OpenAPI request only.
Limitation: OpenAPI mode only supports same-chain Swap, does not support cross-chain exchanges.
Load files progressively โ only load what the current step needs:
references/openapi/_shared.md โ env detection, credentials, API call method (via helper script)| Stage | Load File | When |
|---|---|---|
| Query (chain/gas) | references/openapi/quote.md |
User asks about chains or gas |
| Swap: get quote | references/openapi/quote.md + references/openapi/sop.md |
User initiates swap |
| Swap: build tx | references/openapi/build.md |
After quote confirmed (SOP Step 2) |
| Swap: sign tx | references/openapi/sign.md |
After build confirmed (SOP Step 3) |
| Swap: submit | references/openapi/submit.md |
After signing complete |
| History | references/openapi/submit.md |
User asks for swap history |
references/openapi/errors.mdLegacy monolithic file preserved at
references/openapi.mdfor backward compatibility.
When MCP detection fails and a setup guide is needed, read and display references/setup.md. Show only the configuration for the user's current platform when identifiable. Display at most once per session.
Actual supported chains are determined by runtime API/Resource returns:
swap://supported_chains Resourcetrade.swap.chain interfaceFor uncommon chains: MCP calls dex_chain_config, OpenAPI calls trade.swap.chain.
mcp_token, OpenAPI uses AK/SK โ never mix