
Evm Token Decimals
If you've ever shipped a balance display that was off by a factor of a million because you assumed USDC had 18 decimals everywhere, this prevents that. It walks you through runtime decimal queries, chain-aware caching, and decimal-safe math in Python, TypeScript, and Solidity. The examples are practical: fetching balances with web3.py, normalizing to WAD in contracts, handling non-standard tokens that revert on decimals(). It's focused on the silent bugs that don't throw errors but wreck dashboards and trading bots. Worth a look if you're building anything that touches ERC-20s across multiple chains or needs reliable fiat conversions.
- skills.sh installs
- 3.4K
- GitHub stars
- 229.1K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add affaan-m/everything-claude-code --skill evm-token-decimals --agent claude-codeInstalls into .claude/skills of the current project.
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"},
]
Sponsors
Details
- Repository
- github.com/affaan-m/everything-claude-code
- Category
- Web3 & Blockchain
- First seen
- May 16, 2026
More from affaan-m/everything-claude-code
All 256- Gateguard3.1K
- Everything Claude Code2.7K
- Claude Api2.4K
- Hermes Imports2.3K
- Literature Review1.9K
- Fastapi Patterns1.8K
- Frontend Design1.8K
- Mysql Patterns1.8K
- Pubmed Database1.8K
- Windows Desktop E2e1.8K
- Agent Architecture Audit1.7K
- Agentic Os1.7K
- Angular Developer1.7K
- Cisco Ios Patterns1.7K
- Django Celery1.7K
- Ecc Guide1.7K
- Error Handling1.7K
- Flox Environments1.7K
- Frontend Design Direction1.7K
- Homelab Network Readiness1.7K
- Homelab Network Setup1.7K
- Ios Icon Gen1.7K
- Make Interfaces Feel Better1.7K
- Motion Advanced1.7K