evm_get_token_allowance
Check ERC20 token spending allowance from an owner to a spender to verify approvals before DeFi operations and determine whether re-approval is needed.
Instructions
Check ERC20 token spending allowance currently granted from owner to spender.
Returns the amount of tokens a spender is currently allowed to transfer on behalf of the owner. Used to verify approvals before DeFi operations and check if re-approval is needed.
CRITICAL RULES:
Returns current allowance amount (may be 0 if not approved)
Allowance decreases as spender uses it (check before each operation)
Allowance of 0 means no approval exists
Very large number (2^256-1) indicates unlimited approval
Read-only operation, no gas cost
PARAMETERS:
chain: EVM chain to query (required)
Allowances are chain-specific
Same owner/spender may have different allowances per chain
tokenAddress: ERC20 token contract address (required)
Format: 0x followed by 40 hex characters
Allowances are per-token
Examples: USDC, USDT, DAI, WETH
ownerAddress: Token owner address (required)
Address that granted the approval
Format: 0x followed by 40 hex characters
Must be address holding the tokens
spenderAddress: Spender address (required)
Address that can spend the tokens
Typically a smart contract (DEX, lending pool)
Format: 0x followed by 40 hex characters
EXAMPLES: ✅ Check USDC allowance for Uniswap on Polygon: {chain: "polygon", tokenAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", ownerAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", spenderAddress: "0xE592427A0AEce92De3Edee1F18E0157C05861564"}
✅ Check allowance before DEX swap: {chain: "arbitrum", tokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", ownerAddress: "0x...", spenderAddress: "0xRouterAddress"}
✅ Verify approval was successful: {chain: "bsc", tokenAddress: "0x...", ownerAddress: "0x...", spenderAddress: "0x..."}
❌ Invalid - swapped owner and spender: {ownerAddress: "0xContractAddress", spenderAddress: "0xUserWallet"} // Backwards
❌ Invalid - wrong chain: {chain: "ethereum", tokenAddress: "0xPolygonUSDC..."} // Token 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 query success • chain: Chain queried • tokenAddress: Token contract checked • ownerAddress: Token owner • spenderAddress: Approved spender • allowance: Object with raw (string) and formatted (string) values • decimals: Token decimals used for formatting • isUnlimited: Boolean indicating if allowance is max uint256 • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Confusing owner and spender parameters (easy to swap)
Not checking allowance before assuming approval exists
Forgetting allowance decreases as it's spent
Not accounting for decimals when interpreting raw value
Assuming non-zero allowance means sufficient for operation
USE CASES:
Check if approval needed before DEX swap
Verify approval transaction succeeded
Monitor remaining allowance after partial usage
Audit approved spenders for security
Determine if re-approval required
ALLOWANCE LIFECYCLE:
Initially 0 (no approval)
Increased by evm_approve_token
Decreased as spender transfers tokens
Can be set back to 0 (revoke approval)
Can be increased again (re-approve)
INTERPRETATION:
allowance = 0: No approval, must call evm_approve_token
allowance < needed: Insufficient, need to approve more
allowance ≥ needed: Sufficient, can proceed with operation
allowance = 2^256-1: Unlimited approval (never decreases)
SECURITY AUDITING: Check all your token allowances periodically:
Query allowance for each token you hold
Identify unknown or unused spender contracts
Revoke suspicious or old approvals (approve amount "0")
BEFORE DEX SWAP: Always check allowance before attempting swap:
Check allowance (this tool)
If insufficient, approve tokens (evm_approve_token)
Execute swap (evm_execute_swap)
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>",
"ownerAddress": "<ownerAddress>",
"spenderAddress": "<spenderAddress>"
},
"name": "evm_get_token_allowance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain to query | |
| ownerAddress | Yes | Token owner address (0x...) | |
| tokenAddress | Yes | ERC20 token contract address (0x...) | |
| spenderAddress | Yes | Spender address (0x...) |