evm-token-decimals
Prevent silent decimal mismatch bugs across EVM chains. Covers runtime decimal lookup, chain-aware caching, bridged-token precision drift, and safe normalization for bots, dashboards, and DeFi tools. Use when handling token amounts across EVM chains, or when a balance, price, or transfer amount is off by orders of magnitude.
Target: Target not categorized. Automatically collected · unverified.
Excerpt from the author’s documentation
Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.
Read the original English text
Topics in the source
- EVM Token Decimals
- When to Use
- How It Works
- Examples
- Query decimals at runtime
- Cache by chain and token
- Handle odd tokens defensively
- Normalize to 18-decimal WAD in Solidity
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. 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 Never assume stablecoins use the same decimals everywhere. Query decimals() at runtime, cache by (chainid, tokenaddress), and use decimal-safe math for value calculations. Do not hardcode 1000000 because a symbol usually has 6 decimals somewhere else. Log the fallback and keep it visible. Old or non-standard tokens still exist. Always query decimals() at runtime Cache by chain plus token address, not symbol Use Decimal, BigInt, or equivalent exact math, not float Re-query decimals after bridging or wrapper changes Normalize internal accounting consistently before comparison or pricing
- Source repository
- affaan-m/ECC
- Source file
- skills/evm-token-decimals/SKILL.md
- Fixed revision
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Sources and evidence
This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.
Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T15:01:43.742Z.
Categories are inferred from names, descriptions and paths. They do not establish compatibility.
License and attribution
MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.
Original license ↗Synchronization, copying and user-reported success do not mark a resource as runtime-tested.
Limitations and notes
- Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.