KyberSwap Fast Execute Skill
⚠️ VIGILANT WARNING — EXTREME CAUTION REQUIRED ⚠️
This skill builds AND executes blockchain transactions IMMEDIATELY without any confirmation. Once executed, transactions are IRREVERSIBLE and cannot be cancelled.
Critical Risks:
- NO CONFIRMATION — Transaction broadcasts the instant this skill runs
- IRREVERSIBLE — Blockchain transactions cannot be undone
- REAL MONEY AT STAKE — Gas fees are charged even if the swap fails
- NO QUOTE VERIFICATION — You cannot review the swap rate before execution
- NO SECOND CHANCE — Wrong parameters or bad rates will still execute
Before Using This Skill, Ensure:
When NOT to Use This Skill:
- High-value transactions (> $1,000 USD equivalent) — Use + instead
- First time using these skills
- When you want to review the quote before executing
- When you're unsure about any swap parameter
- Volatile market conditions
If the estimated swap value exceeds $1,000 USD, refuse fast execution and recommend the user use + with confirmation prompts instead.
Safer Alternatives:
- Use to build (with confirmation), review, then to execute (with confirmation)
- Use for step-by-step quote verification before building
Build and execute a swap transaction in one step using the shell script at
${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.sh
. The script calls
internally to build the swap, then immediately broadcasts it. No confirmation prompts.
Prerequisites
- Foundry installed: must be available in PATH
- curl and jq installed: Required for API calls
- Wallet configured: See
${CLAUDE_PLUGIN_ROOT}/skills/swap-execute/references/wallet-setup.md
Quick wallet setup:
bash
# Import key to keystore
cast wallet import mykey --interactive
# Create password file securely (prompts without echoing to terminal)
read -s -p "Password: " pw && echo "$pw" > ~/.foundry/.password && chmod 600 ~/.foundry/.password
Input Parsing
The user will provide input like:
1 ETH to USDC on base from 0xAbc123...
100 USDC to ETH on arbitrum from 0xAbc123... slippage 100
0.5 WBTC to DAI on polygon from 0xAbc123... keystore mykey
Extract these fields:
- amount — the human-readable amount to swap
- tokenIn — the input token symbol
- tokenOut — the output token symbol
- chain — the chain slug (default: )
- sender — the address that will send the transaction (required)
- recipient — the address to receive output tokens (default: same as sender)
- slippageTolerance — slippage in basis points (default: 50)
- walletMethod — , , , or (default: )
- keystoreName — keystore account name (default: )
If the sender address is not provided, ask the user for it before proceeding. Do not guess or use a placeholder address.
Sender address validation — reject or warn before proceeding:
- Must not be the zero address (
0x0000000000000000000000000000000000000000
) — this is an invalid sender and the transaction will fail. Ask the user for their actual wallet address.
- Must not be the native token sentinel (
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
) — this is a placeholder for native tokens, not a real account. Ask the user for their actual wallet address.
- Warn if it matches a known contract address (e.g., a token address or the router address) — sending from a contract address is unusual and likely a mistake. Ask the user to confirm.
Recipient address warning: When the recipient address differs from the sender, display a prominent warning: "WARNING: Output tokens will be sent to a DIFFERENT address than the sender. Please verify the recipient address carefully before proceeding." Wait for the user to acknowledge before continuing.
Slippage Defaults
If the user does not specify slippage, choose based on the token pair:
| Pair type | Default | Rationale |
|---|
| Stablecoin ↔ Stablecoin (e.g. USDC→USDT) | 5 bps (0.05%) | Minimal price deviation between pegged assets |
| Common tokens (e.g. ETH→USDC, WBTC→ETH) | 50 bps (0.50%) | Standard volatility buffer |
| All other / unknown pairs | 100 bps (1.00%) | Conservative default for long-tail or volatile tokens |
Note: The underlying
script defaults to 50 bps if no slippage argument is passed.
You must calculate and pass the correct slippage value from this table as argument 7 when calling the script.
Known stablecoins: USDC, USDT, DAI, BUSD, FRAX, LUSD, USDC.e, USDT.e, TUSD
Known common tokens: ETH, WETH, WBTC, BTC, BNB, MATIC, POL, AVAX, MNT, S
Workflow
Pre-Step: Verbal Confirmation Required
CRITICAL: Before running any script or making any API call, you MUST confirm with the user:
You are about to execute a swap IMMEDIATELY with no confirmation step. The transaction will be broadcast as soon as the route is found. Proceed? (yes/no)
Wait for the user to explicitly respond with "yes", "proceed", "confirm", or a clear affirmative. If the user says "no", "cancel", "wait", or anything non-affirmative, abort and recommend they use
+
instead for a safer flow with quote review.
Do NOT skip this confirmation. Do NOT assume consent. This is the only safety gate before an irreversible transaction.
Step 0: Dust Amount Pre-Check
Before running the script, sanity-check the swap amount. If the amount is obviously a dust amount (e.g.,
),
warn the user and abort — the script will reject dust amounts (< $0.10 USD or gas > swap value) anyway. Catching it early avoids unnecessary API calls.
"This swap amount is extremely small. Gas fees will far exceed the swap value. Use a larger amount."
Step 0.5: Resolve Token Addresses
Before running the script, resolve both token addresses. The script has a built-in registry and Token API fallback, but unregistered tokens (memecoins, new launches, etc.) may not be found by the script. Pre-resolving ensures all tokens work.
For each token (tokenIn and tokenOut):
- Check
${CLAUDE_PLUGIN_ROOT}/references/token-registry.md
for the token on the specified chain
- If found in registry → pass the symbol to the script (e.g. , ). The script resolves it internally (fastest path).
- If NOT found in registry → resolve the address using this fallback sequence:
a. KyberSwap Token API (preferred) — search whitelisted tokens first:
https://token-api.kyberswap.com/api/v1/public/tokens?chainIds={chainId}&symbol={symbol}&isWhitelisted=true
via WebFetch. Pick the result whose matches exactly (case-insensitive) with the highest . If no whitelisted match, retry without (only trust verified or market-cap tokens). If still nothing, try by name: ?chainIds={chainId}&name={symbol}&isWhitelisted=true
.
b. CoinGecko API (secondary fallback) — search CoinGecko for verified contract addresses if the Token API doesn't have it.
c. Ask user (final fallback) — ask the user for the contract address and decimals. Never guess or fabricate addresses.
- Pass resolved tokens as format (e.g.
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48:6
)
For any non-registry token, check honeypot/FOT before calling the script:
GET https://token-api.kyberswap.com/api/v1/public/tokens/honeypot-fot-info?chainId={chainId}&address={tokenAddress}
Via
WebFetch, check both
and
:
- If — refuse the swap and warn the user.
- If — warn the user about fee-on-transfer tax. Proceed only if acknowledged.
Step 1: Run the Script
Execute the script:
bash
bash ${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.sh <amount> <tokenIn> <tokenOut> <chain> <sender> [recipient] [slippage_bps] [wallet_method] [keystore_name]
Arguments (positional):
| # | Name | Required | Description |
|---|
| 1 | | Yes | Human-readable amount (e.g. , , ) |
| 2 | | Yes | Input token symbol (e.g. , ) or pre-resolved (e.g. ) |
| 3 | | Yes | Output token symbol (e.g. , ) or pre-resolved |
| 4 | | Yes | Chain slug (e.g. , , ) |
| 5 | | Yes | Sender wallet address |
| 6 | | No | Recipient address (default: same as sender) |
| 7 | | No | Slippage in basis points (default: ) |
| 8 | | No | , , , (default: ) |
| 9 | | No | Keystore account name (default: ) |
Note: Arguments 7-9 use snake_case (shell convention) for the script's positional parameters. When parsing user input, map from the camelCase names above (slippageTolerance → slippage_bps, walletMethod → wallet_method, keystoreName → keystore_name).
Examples:
bash
# Known tokens (symbol) — script resolves internally
bash execute-swap.sh 1 ETH USDC ethereum 0xYourAddress
# Pre-resolved tokens (address:decimals) — skips script resolution
bash execute-swap.sh 100 0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202:18 ETH ethereum 0xYourAddress
# Mix: one symbol, one pre-resolved
bash execute-swap.sh 0.5 ETH 0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202:18 ethereum 0xYourAddress "" 100
# Specify all options
bash execute-swap.sh 100 USDC ETH arbitrum 0xYourAddress "" 50 keystore mykey
# Different recipient
bash execute-swap.sh 0.5 WBTC DAI polygon 0xSender 0xRecipient 100 env
# Using Ledger hardware wallet
bash execute-swap.sh 1 ETH USDC base 0xYourAddress "" 50 ledger
Step 2: Parse the Output
json
{
"ok": true,
"chain": "base",
"txHash": "0x1234567890abcdef...",
"blockNumber": "12345678",
"gasUsed": "285432",
"status": "1",
"explorerUrl": "https://basescan.org/tx/0x1234...",
"swap": {
"tokenIn": {"symbol": "ETH", "amount": "1"},
"tokenOut": {"symbol": "USDC", "amount": "2345.67"},
"slippageBps": "50"
},
"tx": {
"sender": "0xYourAddress",
"recipient": "0xYourAddress",
"router": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
"value": "1000000000000000000"
},
"walletMethod": "keystore"
}
json
{
"ok": false,
"error": "Swap failed (pre-flight): Build failed — Route not found. No route available for this pair/amount. No transaction was submitted."
}
Step 3: Format the Output
On success, present:
## Transaction Executed ✅
**{swap.tokenIn.amount} {swap.tokenIn.symbol} → {swap.tokenOut.amount} {swap.tokenOut.symbol}** on {chain}
| Field | Value |
|-------|-------|
| Transaction Hash | `{txHash}` |
| Block Number | {blockNumber} |
| Gas Used | {gasUsed} |
| Status | {status == "1" ? "Success" : "Failed"} |
| Slippage | {swap.slippageBps/100}% |
**Explorer:** [{explorerUrl}]({explorerUrl})
> ⚠️ This transaction was executed immediately without confirmation. If this was a mistake, you cannot undo it.
On error, check the error prefix to determine what happened:
"Swap failed (pre-flight): ..."
— No transaction was submitted on-chain. No gas was spent. Fix the issue and retry.
"Transaction was broadcast but ..."
— A real transaction was sent. Gas fees were consumed. Check the block explorer for details.
Environment Variables
| Variable | Description |
|---|
| Private key (required if ) |
| Override default |
| Override chain RPC URL |
Supported Chains
ethereum, arbitrum, polygon, optimism, base, bsc, avalanche, linea, mantle, sonic, berachain, ronin, unichain, hyperevm, plasma, etherlink, monad, megaeth
Important Notes
- EXTREMELY DANGEROUS: This skill builds AND executes in one step with NO confirmation
- Irreversible: Once sent, transactions cannot be cancelled
- Gas fees: Charged even if the swap fails (e.g., slippage exceeded)
- Ledger/Trezor: Still requires physical button press on the device
- ERC-20 tokens: The script automatically checks allowance and token balance before executing. If insufficient, it aborts with an actionable error.
- Balance pre-check: Native token balance is verified against tx.value + estimated gas cost before sending. ERC-20 balance is checked against amountInWei.
- Gas buffer: A 20% buffer is applied to the API gas estimate to reduce out-of-gas failures.
- Gas price: Current gas price is logged so you can see what you're paying.
- For safer execution, use then (both have confirmation steps)
Common Errors
Pre-Flight Errors (no transaction sent, no gas spent)
These errors appear with the prefix
"Swap failed (pre-flight): ..."
in the script output.
| Error | Cause | Quick Fix |
|---|
| Route not found (4008) | No liquidity for this pair/amount | Try a smaller amount, remove source filters, or try a different chain. |
| Token not found (4011) | Wrong token address or unsupported token | Verify the token symbol and chain are correct. |
| Gas estimation failed — return amount not enough (4227) | Price moved between route fetch and build | Retry — the script will fetch a fresh route. Increase slippage if it keeps failing. |
| Gas estimation failed — insufficient funds (4227) | Sender doesn't have enough native token for value + gas | Top up the wallet or reduce swap amount. |
| Gas estimation failed — TRANSFER_FROM_FAILED (4227) | Missing token approval or insufficient token balance | Approve the router to spend the input token first. Check balance. |
| Quoted amount smaller than estimated (4222) | RFQ quote came in lower than expected | Retry. The script will fetch a fresh route. |
| Insufficient allowance | ERC-20 approval too low | The script detects this and aborts. Approve the router address for at least . |
| Insufficient token balance | Sender doesn't hold enough of the input token | The script detects this and aborts. Check balance. |
| Dust amount detected | Swap value < $0.10 USD | Use a larger amount. Gas fees dwarf the swap value. |
| Uneconomical swap | Gas cost > swap value | Use a larger amount to make the trade worthwhile. |
On-Chain Errors (transaction sent, gas spent)
These errors appear with the prefix
"Transaction was broadcast but ..."
in the script output.
| Error | Cause | Quick Fix |
|---|
| Approval revoked or race condition | Re-approve and retry. |
Return amount is not enough
| Price slipped beyond tolerance during execution | Increase slippage or retry quickly. For MEV protection, use a private RPC. |
| Out of gas | Gas limit insufficient for the route | The script adds a 20% buffer, but complex routes may need more. Set to a faster RPC and retry. |
Troubleshooting
For errors not covered above (full API error catalog, PMM/RFQ error details, advanced debugging), refer to
${CLAUDE_PLUGIN_ROOT}/skills/error-handling/SKILL.md
.
Common script-level errors:
| Error | Solution |
|---|
| Install Foundry: curl -L https://foundry.paradigm.xyz | bash && foundryup
|
| Create with your keystore password |
| Export or use keystore method |
| Set environment variable |