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-code

Installs 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
1sickn33 avatarblockchain-developersickn33/antigravity-awesome-skillsblockchain developer956skills.sh installs
2nansen-ai avatarnansen-wallet-profilernansen-ai/nansen-cliWallet profiler — balance, PnL, labels, transactions, counterparties, related wallets, batch, trace, compare. Use when analysing a specific wallet address or co413skills.sh installs
3nansen-ai avatarnansen-wallet-clusteringnansen-ai/nansen-cliCluster and attribute related wallets — funding chains, shared signers, CEX deposit patterns. Use when tracing wallet ownership, comparing two wallets, finding 388skills.sh installs
4nansen-ai avatarnansen-wallet-managernansen-ai/nansen-cliWallet management — create (local or Privy server-side), list, show, export, send, delete. Use when creating wallets, checking balances, or sending tokens.372skills.sh installs
5sendaifun avatarsolana-kitsendaifun/skillsComplete guide for @solana/kit - the modern, tree-shakeable, zero-dependency JavaScript SDK from Anza. Covers RPC connections, signers, transaction building wit351skills.sh installs
6sickn33 avatarweb3-testingsickn33/antigravity-awesome-skillsweb3 testing229skills.sh installs