Evm Token Decimals
Prevents silent decimal mismatch bugs across EVM chains with runtime lookup, caching, and exact-math normalization.
- CCM score
- 75 of 100
- skills.sh installs
- 10.4K
- GitHub stars
- 312.6K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers runtime
decimals()lookup, chain-aware caching, bridged-token precision drift, and normalization for balances and USD values - Includes Python, TypeScript, and Solidity examples plus a
cast callcheck for querying decimals on-chain - Enforces caching by chain ID and token address rather than symbol, and exact math with
DecimalorBigIntinstead of floats - Designed for bots, dashboards, portfolio trackers, and DeFi tools that compare token amounts across multiple chains
Install
$ npx -y skills add affaan-m/ecc --skill evm-token-decimals -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
EVM Token Decimals
Silent decimal mismatches are one of the easiest ways to ship balances or USD values that are off by orders of magnitude without throwing an error.
When to Use
- Reading ERC-20 balances in Python, TypeScript, or Solidity
- Calculating fiat values from on-chain balances
- Comparing token amounts across multiple EVM chains
- Handling bridged assets
- Building portfolio trackers, bots, or aggregators
How It Works
Never assume stablecoins use the same decimals everywhere. Query decimals() at runtime, cache by (chain_id, token_address), and use decimal-safe math for value calculations.
Examples
Query decimals at runtime
from decimal import Decimal
from web3 import Web3
ERC20_ABI = [
{"name": "decimals", "type": "function", "inputs": [],
"outputs": [{"type": "uint8"}], "stateMutability": "view"},
{"name": "balanceOf", "type": "function",
"inputs": [{"name": "account", "type": "address"}],
"outputs": [{"type": "uint256"}], "stateMutability": "view"},
]
Details
- Repository
- github.com/affaan-m/ecc
- Categories
- Web3 & Crypto, Finance & Trading
- First seen
- Jul 14, 2026
Questions
How do I stop token decimal mismatch bugs when reading EVM token balances?
The evm-token-decimals skill queries decimals() at runtime instead of assuming a fixed value, so a balance is not off by orders of magnitude. It caches the result by chain and token address and uses exact decimal math rather than floats.
What does the evm-token-decimals skill cover?
It covers runtime decimal lookup, chain-aware caching, bridged-token precision drift, and safe normalization for bots, dashboards, and DeFi tools. It includes examples in Python, TypeScript with ethers, and Solidity normalization to 18-decimal WAD.
How do I install evm-token-decimals?
Run npx -y skills add affaan-m/ecc --skill evm-token-decimals -y in your project. The skill then lets the agent write balance, USD value and transfer code that reads each token's decimals correctly.
Where does evm-token-decimals rank in the Web3 & Crypto category?
It ranks in the top 50 on the Web3 & Crypto category page on Claude Marketplaces. Its own description says it targets silent decimal bugs in cross-chain token amounts.
What if decimals() reverts on an older token?
The skill shows a defensive pattern that catches the revert, logs a warning with the token address and chain, and falls back to 18 decimals. It asks you to keep that fallback visible because non-standard tokens still exist.
More from affaan-m/ecc
All 257- Gateguard10.1K
- Frontend Design Direction9.9K
- Fastapi Patterns9.4K
- Hermes Imports9.3K
- Blender Motion State Inspection9.3K
- Vite Patterns9.2K
- Agent Architecture Audit9.1K
- Error Handling9.1K
- Windows Desktop E2e9.1K
- Redis Patterns9.1K
- Mysql Patterns9.1K
- Production Audit9K
- Make Interfaces Feel Better9K
- Motion Patterns9K
- Motion Foundations9K
- Motion Advanced8.9K
- Ecc Guide8.9K
- Mle Workflow8.9K
- Django Celery8.8K
- Homelab Network Setup8.8K
- Ios Icon Gen8.8K
- Agentic Os8.8K
- Skill Stocktake8.8K
- Ui To Vue8.8K
Similar to Evm Token Decimals
More Web3 & Cryptouse-usdcSkillcirclefin/skills1.1K installsReference guide for sending, approving, checking, and verifying USDC on EVM chains and Solana, with the 6-decimal rule.
Bankr x402 SDK - Balance QueriesSkillbankrbot/claude-plugins88 starsNatural-language balance, portfolio, and NFT queries across Base, Ethereum, Polygon, and Solana via the Bankr SDK.
emblem-portfolio-trackerSkillemblemcompany/agent-skills8.9K installsRead-only cross-chain crypto portfolio tracker covering seven blockchains with USD valuations and DeFi positions.
Debridge McpMCP serverdebridge-finance31 starsCross-chain and same-chain token swaps via deBridge, with token search and chain listing.
digital-assetsSkilljoellewis/finance_skills762 installsAnalysis of crypto fundamentals, blockchain mechanics, DeFi protocols, and on-chain valuation metrics for investment questions.
Universal Blockchain MCPMCP servernirholas44 starsMulti-chain crypto data and DeFi access covering prices, markets, protocols, TVL, and gas fees.