swap-approve
БесплатноБез исполняемых скриптовНе проверенThis skill should be used when the user asks to "approve token", "check allowance", "approve USDC for swapping", "token approval", "revoke approval", "set…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
KyberSwap Approve Skill
Manage ERC-20 token approvals for the KyberSwap router. Check current allowance, approve exact amounts, approve unlimited, or revoke approvals using Foundry's cast.
Prerequisites
- Foundry installed:
castmust be available in PATH - Wallet configured: One of the methods below (only needed for setting/revoking approvals, not for checking allowance)
- Native token for gas: Approval transactions cost gas (~46k gas for standard ERC-20)
Wallet Setup (One-Time)
⚠️ USE YOUR EXISTING WALLET MANAGEMENT FIRST ⚠️
If you or your agent already have wallet management (key management service, vault, HSM, custodial API, MPC signer, or any secure signing infrastructure), use that. Skip the examples below entirely.
The wallet options below are example setups for development and testing only. They have known security issues: plaintext password files on disk, private keys in shell environments, no access control, no audit trail, no key rotation. Do not use them with real funds in production.
Option A: Encrypted Keystore (Recommended)
cast wallet import mykey --interactive
# Enter private key, then set encryption password
# Create password file securely (prompts without echoing to terminal)
printf "Password: " && read -s pw && printf '\n' && echo "$pw" > ~/.foundry/.password && chmod 600 ~/.foundry/.password
Option B: Environment Variable Set the key in your current shell session only (do not persist to shell profiles):
printf "Enter private key: " && read -s PRIVATE_KEY && printf '\n' && export PRIVATE_KEY
Option C: Ledger Hardware Wallet
- Connect Ledger, open Ethereum app
- No setup needed, will prompt for physical confirmation
See ${CLAUDE_PLUGIN_ROOT}/skills/swap-execute/references/wallet-setup.md for detailed instructions.
NEVER echo, print, log, or display any private key value, even in error messages or debug output.
Input Parsing
The user will provide input like:
check USDC allowance on ethereum for 0xAbc123...approve 100 USDC on arbitrum from 0xAbc123...approve unlimited LINK on base from 0xAbc123...revoke USDT approval on ethereum from 0xAbc123...
Extract these fields:
- token — the token symbol (e.g., USDC, LINK)
- chain — the chain slug (default:
ethereum) - sender — the wallet address (required)
- amount — the amount to approve (optional):
- Omitted or "check" = check current allowance only
- A number (e.g.,
100,0.5) = approve that exact amount "unlimited"or"max"= approve type(uint256).max"0"or"revoke"= revoke approval (set allowance to 0)
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) — invalid sender. - Must not be the native token sentinel (
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) — this is a placeholder, not a real account. - Must match format
^0x[a-fA-F0-9]{40}$— reject malformed addresses.
Router Address
The KyberSwap router address is the same on all supported chains:
0x6131B5fae19EA4f9D964eAc0408E4408b66337b5
Workflow
Step 1: Validate Input
- Verify the sender address is provided and valid.
- Reject native tokens — if the user asks to approve ETH, BNB, MATIC/POL, AVAX, MNT, S, BERA, RON, XTZ, or MON, explain:
Native tokens (ETH, BNB, MATIC, etc.) do not use the ERC-20 approval mechanism. They are sent directly as
msg.valuein the transaction. No approval is needed to swap native tokens through the KyberSwap router.
If the user intended the wrapped version (WETH, WBNB, WMATIC, etc.), suggest they specify the wrapped token symbol instead.
Step 2: Resolve Token Address
Read the token registry at ${CLAUDE_PLUGIN_ROOT}/references/token-registry.md.
Look up the token for the specified chain. Match case-insensitively. Note the decimals for the token.
If the token is not found in the registry:
Use the fallback sequence described at the bottom of ${CLAUDE_PLUGIN_ROOT}/references/token-registry.md:
- KyberSwap Token API (preferred) — search whitelisted tokens first:
https://token-api.kyberswap.com/api/v1/public/tokens?chainIds={chainId}&name={symbol}&isWhitelisted=truevia WebFetch. Pick the result whosesymbolmatches exactly with the highestmarketCap. If no whitelisted match, retry withoutisWhitelisted. - CoinGecko API (secondary fallback) — search CoinGecko for verified contract addresses.
- Ask user manually (final fallback) — ask the user for the contract address and decimals. Never guess or fabricate addresses.
Step 3: Check Current Allowance
Determine the RPC URL for the chain:
| Chain | RPC URL |
|---|---|
| ethereum | https://ethereum-rpc.publicnode.com |
| arbit |
Установить swap-approve в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swap-approve?
This skill should be used when the user asks to "approve token", "check allowance", "approve USDC for swapping", "token approval", "revoke approval", "set allowance", "remove approval", "check token approval", "approve router", or wants to manage ERC-20 token approvals for the KyberSwap router. Supports checking allowance, approving exact amounts, unlimited approvals, and revoking approvals.
Как установить скилл swap-approve?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swap-approve запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic