← ClaudeAtlas

evm-decimal-validationlisted

Validate and configure token decimals for EVM-compatible blockchain deployments. Use when working with ERC20 tokens, multi-chain deployments, token amount conversions, or when decimals might vary across chains.
widnyana/eyay-toolkits · ★ 4 · DevOps & Infrastructure · score 77
Install: claude install-skill widnyana/eyay-toolkits
# EVM Token Decimal Validation Ensure token decimals are correctly configured for each blockchain deployment to prevent amount calculation errors. ## Quick Start 1. **Check current configuration** - Review network configs for decimal fields 2. **Validate against contracts** - Query on-chain decimals() for each deployment 3. **Update configuration** - Add per-chain decimals to network config 4. **Test conversions** - Verify FromWei/ToWei work correctly ## Token Decimal Standards ### Common Decimal Values | Decimals | Use Case | Examples | |----------|----------|----------| | 18 | Standard ERC20 (most tokens) | WETH, DAI, USDC (on some chains) | | 6 | Stablecoins | USDC, USDT (on Ethereum) | | 8 | Bitcoin-wrapped | WBTC | | 2 | Fiat-backed (cents) | IDRX, some CBDCs | | 0 | Raw integers | Some wrapped tokens | ### Chain-Specific Variations The same token contract deployed on different chains may use different decimals: ``` Token A on Ethereum: 18 decimals Token A on Polygon: 0 decimals (different deployment) Token A on BNB Chain: 0 decimals (different deployment) ``` ## Validation Checklist ### Step 1: Audit Current Configuration ```bash # Find hardcoded decimals grep -rn "18)" --include="*.go" | grep -i "decimal\|wei\|amount" # Check for decimals field in network config grep -rn "Decimals" blockchain/networks.go ``` ### Step 2: Query On-Chain Values ```go // Get decimals from contract decimals, err := contract.Decimals(nil) if err != nil { return fm