Swap Tokens

Swap or trade tokens via decentralized exchanges on any supported chain. Use when you or the user want to trade, swap, exchange, buy, sell, or convert betwee...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 127 · 0 current installs · 0 all-time installs
byRachid Jarray@rachidjarray-hk-qa-fdt
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name/description (swap tokens via DEX) matches the instructions, which exclusively call fdx CLI commands for wallet status, balance, and swap execution. There are no unrelated dependencies or credentials requested.
Instruction Scope
SKILL.md confines runtime actions to fdx status, fdx call getWalletOverview, and fdx call swapTokens, and explicitly requires human confirmation before executing swaps. It does not instruct reading arbitrary files, environment variables, or sending data to external endpoints beyond the fdx CLI.
Install Mechanism
No install spec or code is provided (instruction-only), so nothing is downloaded or written to disk by the skill itself.
Credentials
The skill declares no required environment variables, credentials, or config paths. It relies on whatever wallet/authentication the local fdx CLI has configured, which is appropriate for an on-chain swap helper.
Persistence & Privilege
The skill is not always-enabled and allows model invocation (default). This is normal for user-invocable skills; note that when invoked it will run CLI commands that act with the user's configured wallet credentials (not stored or requested by the skill).
Assessment
This skill is a thin instruction-only wrapper around your local fdx CLI and appears coherent. Before installing or using it, ensure: (1) you understand and trust the installed fdx CLI and its wallet configuration (the skill will execute on-chain swaps using those credentials), (2) you confirm swap details (amount, slippage, chain) every time—test with a small amount first to avoid unexpected losses, and (3) you do not expose private keys or paste secrets into chat. No environment variables or external installers are requested by this skill.

Like a lobster shell, security has layers — review code before you run it.

Current versionv0.1.0
Download zip
latestvk9721nr7myzxkkrvx89jykqxen82jx2s

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Swapping Tokens

Use the fdx call swapTokens command to swap between tokens via decentralized exchanges on any supported chain. Unlike centralized exchange swaps, these execute directly on-chain through DEX protocols.

Confirm wallet is authenticated

fdx status

If the wallet is not authenticated, refer to the authenticate skill.

Check Balance Before Swapping

Verify the wallet holds enough of the source token:

fdx call getWalletOverview --chainKey <chain>

Executing a Swap

fdx call swapTokens \
  --chainKey <chain> \
  --tokenIn <token> \
  --tokenOut <token> \
  --amount <amount>

Parameters

ParameterRequiredDescription
--chainKeyYesBlockchain to swap on (e.g. ethereum, polygon, base, solana)
--tokenInYesSource token — symbol (e.g. USDC, ETH) or contract address
--tokenOutYesDestination token — symbol or contract address
--amountYesAmount of tokenIn to swap (human-readable)
--modeNoSwap mode (e.g. exact input, exact output)
--objectiveNoOptimization objective (e.g. best price, lowest gas)
--maxSlippageBpsNoMaximum slippage tolerance in basis points (100 = 1%)
--deadlineSecondsNoTransaction deadline in seconds

Examples

Basic swaps

# Swap 100 USDC for ETH on Ethereum
fdx call swapTokens \
  --chainKey ethereum \
  --tokenIn USDC \
  --tokenOut ETH \
  --amount 100

# Swap 0.05 ETH for USDC on Base
fdx call swapTokens \
  --chainKey base \
  --tokenIn ETH \
  --tokenOut USDC \
  --amount 0.05

# Swap SOL for USDC on Solana
fdx call swapTokens \
  --chainKey solana \
  --tokenIn SOL \
  --tokenOut USDC \
  --amount 2

Swap with slippage control

# Swap with 0.5% max slippage
fdx call swapTokens \
  --chainKey ethereum \
  --tokenIn USDC \
  --tokenOut ETH \
  --amount 500 \
  --maxSlippageBps 50

Swap using contract addresses

# Swap using explicit token contract addresses
fdx call swapTokens \
  --chainKey ethereum \
  --tokenIn 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
  --tokenOut 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
  --amount 100

Flow

  1. Check authentication with fdx status
  2. Check balance with fdx call getWalletOverview --chainKey <chain>
  3. Confirm the swap details with the human (amount, tokens, chain, slippage)
  4. Execute with fdx call swapTokens
  5. Optionally check updated balance with fdx call getWalletOverview

Important: DEX swaps are subject to slippage — the final output amount may differ slightly from the quoted amount. For large swaps, consider setting --maxSlippageBps explicitly.

Prerequisites

  • Must be authenticated (fdx status to check, see authenticate skill)
  • Wallet must hold sufficient balance of the source token on the target chain
  • If the wallet has insufficient funds, suggest using the fund-wallet skill

Error Handling

  • "Not authenticated" — Run fdx setup first, or see authenticate skill
  • "Insufficient balance" — Check balance with getWalletOverview; see fund-wallet skill
  • "Cannot swap a token to itself" — tokenIn and tokenOut must be different
  • "No liquidity" — Try a smaller amount or a different token pair
  • "Swap failed" — May be a slippage issue; try with a higher --maxSlippageBps

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…