evm-token-decimals

Query ERC-20 decimals on-chain with chain-aware caching and exact math.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill evm-token-decimals-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: evm-token-decimals
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/evm-token-decimals
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill evm-token-decimals-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents silent decimal mismatches that can cause balances and fiat/DeFi calculations to be off by orders of magnitude without any explicit failure.

Core Features & Use Cases

  • Runtime decimal lookup: Reads each ERC-20 token’s actual decimals() directly on-chain instead of assuming a fixed standard.
  • Chain-aware caching: Caches decimals by (chain_id, token_address) to stay fast while avoiding cross-chain/accounting mistakes.
  • Defensive normalization: Handles odd or non-standard tokens safely and normalizes amounts consistently for comparisons, pricing, bots, and dashboards.

Quick Start

Use the evm-token-decimals skill to fetch a token’s decimals() on the target EVM chain, normalize amounts safely (optionally to an 18-decimal standard), and compute the correct human-readable balance.

Frequently Asked Questions about evm-token-decimals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why are my ERC-20 token balance calculations off by orders of magnitude across EVM chains?

ERC-20 token balance calculations are off because assuming a fixed 18-decimal standard fails for non-standard tokens. Querying the actual decimals() at runtime and applying precision normalization prevents these silent decimal mismatches.

How do I safely normalize bridged asset decimals for DeFi portfolio dashboards?

To safely normalize bridged asset decimals, query decimals() directly on-chain and cache the results by chain_id and token_address. This chain-aware caching prevents cross-chain accounting mistakes when normalizing amounts for dashboard comparisons.

What is the best way to handle non-standard ERC-20 tokens when building web3 trading bots?

The best way to handle non-standard ERC-20 tokens in web3 bots is applying defensive fallback normalization rules after querying runtime decimals(). This ensures exact math conversions and avoids silent precision drift in price calculations.

Does querying token decimals on-chain scale well for multi-chain EVM applications?

Querying token decimals on-chain scales well for multi-chain EVM applications when using chain-aware caching. Caching decimals by chain_id and token_address keeps lookups fast while avoiding cross-chain accounting mistakes.

When do I need runtime decimals lookup instead of hardcoding 18 for ERC-20 balances?

You need runtime decimals lookup when reading ERC-20 balances across multiple EVM chains or handling bridged assets. Hardcoding 18 fails for non-standard tokens, causing fiat and DeFi calculations to be off by orders of magnitude without failing explicitly.