evm_approve_token
Approve ERC20 token spending allowances for DEX, lending, or other contracts so they can transfer tokens on your behalf; set amount to 0 to revoke.
Instructions
Approve ERC20 token spending allowance for a spender address (DEX, lending protocol, or other contract).
Grants permission for another address to spend your tokens on your behalf. Required before using DeFi protocols, DEX swaps, or any contract interaction that needs to transfer your tokens. Does NOT transfer tokens immediately.
CRITICAL RULES:
Approval does NOT transfer tokens - only grants permission
Required before DEX swaps, staking, lending, or any DeFi operations
"unlimited" approval is convenient but risky (allows spender to take all tokens)
Approval is per-token, per-spender, per-chain (must approve separately for each)
Can be revoked by approving amount "0"
Requires gas payment in native token
PARAMETERS:
chain: EVM chain to execute approval on (required)
Approval is chain-specific
Must have gas in native token on this chain
Token and spender must exist on same chain
tokenAddress: ERC20 token contract to approve (required)
Format: 0x followed by 40 hex characters
Token you want to allow spender to transfer
Examples: USDC, USDT, DAI, WETH
spenderAddress: Address receiving approval (required)
Typically a smart contract (DEX router, lending pool)
Format: 0x followed by 40 hex characters
Examples: Uniswap Router, Aave Pool, custom contract
VERIFY THIS ADDRESS - malicious spenders can steal tokens
amount: Approval amount (required)
Human-readable format: "100" = 100 tokens
Use "unlimited" or "max" for maximum approval (2^256-1)
Use "0" to revoke existing approval
Best practice: approve only amount needed
privateKey: Token owner's private key (required, KEEP SECRET)
Format: 0x followed by 64 hex characters
Must be key for address holding tokens
Never expose, share, or log this value
EXAMPLES: ✅ Approve 100 USDC for Uniswap on Polygon: {chain: "polygon", tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", spenderAddress: "0xE592427A0AEce92De3Edee1F18E0157C05861564", amount: "100", privateKey: "0xac0974..."}
✅ Approve unlimited WETH for DEX (convenient but risky): {chain: "arbitrum", tokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", spenderAddress: "0x...", amount: "unlimited", privateKey: "0x..."}
✅ Revoke approval (security best practice): {chain: "bsc", tokenAddress: "0x...", spenderAddress: "0x...", amount: "0", privateKey: "0x..."}
❌ Invalid - approving EOA instead of contract: {chain: "polygon", spenderAddress: "0xPersonalWallet..."} // Personal wallets don't need approval
❌ Invalid - wrong chain for spender: {chain: "ethereum", spenderAddress: "0xPolygonOnlyRouter..."} // Spender not on Ethereum
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • success: Boolean indicating approval success • chain: Chain where approval executed • transactionHash: Transaction hash for approval • tokenAddress: Token contract approved • spenderAddress: Address granted spending permission • amount: Amount approved (formatted) • owner: Token owner address (from privateKey) • gasUsed: Gas consumed by transaction • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Forgetting to approve before attempting DEX swap (will fail)
Approving personal wallet addresses (unnecessary)
Not revoking old approvals to unused contracts (security risk)
Approving wrong token or wrong spender
Unlimited approval to unaudited contracts (dangerous)
Not checking approval succeeded before next operation
USE CASES:
Enable DEX token swaps (approve router to spend token A)
Deposit tokens to lending protocols (approve pool contract)
Stake tokens in farming contracts (approve staking contract)
Bridge tokens across chains (approve bridge contract)
Interact with any DeFi protocol requiring token transfers
APPROVAL WORKFLOW:
Identify spender address (DEX router, lending pool, etc.)
Approve token for spender (this tool)
Wait for approval transaction confirmation
Execute main operation (swap, stake, lend)
Optionally revoke approval after operation (security)
SECURITY CONSIDERATIONS:
Unlimited approvals are convenient but dangerous
Malicious contracts can drain approved tokens
Approve only verified, audited contracts
Revoke unused approvals periodically
Use exact amounts when possible (not unlimited)
Check spender address multiple times before approving
GAS COSTS:
Approval typically costs 45,000-50,000 gas
Ethereum Sepolia: ~0.001 ETH
Polygon: ~0.00005 POL (very cheap)
BSC: ~0.0001 BNB
Arbitrum/Base: ~0.0001 ETH
CHECKING EXISTING APPROVALS: Use evm_get_token_allowance to check current approval amount before approving again.
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chain": "<chain>",
"tokenAddress": "<tokenAddress>",
"spenderAddress": "<spenderAddress>",
"amount": "<amount>",
"privateKey": "<privateKey>"
},
"name": "evm_approve_token"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain to execute on | |
| amount | Yes | Approval amount (use "unlimited" for max approval) | |
| privateKey | Yes | Token owner private key (0x...) | |
| tokenAddress | Yes | ERC20 token contract address (0x...) | |
| spenderAddress | Yes | Spender address to approve (0x...) |