evm-token-decimals

Query on-chain decimals() and normalize EVM token amounts with chain-aware caching.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill evm-token-decimals-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: evm-token-decimals
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/evm-token-decimals
Command: npx skills add https://github.com/luongldptit/move-ticket --skill evm-token-decimals-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Silent decimal mismatches are a common, hard-to-debug issue that causes EVM token balances and their fiat values to be off by orders of magnitude without throwing any runtime errors, leading to financial loss or incorrect user-facing data.

Core Features & Use Cases

  • Runtime Decimal Lookup: Queries the on-chain decimals() function for every token at runtime instead of relying on hardcoded values.
  • Chain-Aware Caching: Caches decimal values keyed by chain ID and token address to reduce unnecessary RPC calls.
  • Bridged Token Support: Handles precision drift for wrapped and bridged assets that may have different decimals across chains.
  • Use Case: Ideal for developers building DeFi tools, portfolio trackers, trading bots, or dashboards that display token balances or calculate fiat values.

Quick Start

Use the evm-token-decimals skill to safely calculate the correct USD value of an ERC-20 token balance on any EVM chain, accounting for the token's actual on-chain decimal precision.

Frequently Asked Questions about evm-token-decimals

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

FAQPage Schema
Why are my EVM token balance and fiat value calculations off by orders of magnitude without throwing runtime errors?

Silent EVM token decimal mismatches cause balance and fiat value calculations to be off by orders of magnitude because hardcoded decimal values differ from actual on-chain precision. Querying the decimals() function at runtime normalizes token amounts and prevents these invisible calculation errors.

How do I calculate the correct USD value of an ERC-20 token balance on any EVM chain?

To calculate the correct USD value of an ERC-20 token balance, query the on-chain decimals() function at runtime and apply decimal-safe normalization. This ensures accurate fiat value calculations across any EVM-compatible chain by accounting for actual token precision.

Does this approach to token decimals work with bridged assets across different chains?

Yes, this approach handles precision drift for wrapped and bridged assets that may have different decimals across chains. By querying decimals() at runtime and caching values keyed by chain ID and token address, it ensures accurate token amount calculations for cross-chain DeFi workflows.

What's the best way to reduce RPC calls when querying ERC-20 decimals for a portfolio tracker?

The best way to reduce RPC calls when querying ERC-20 decimals is to implement chain-aware caching. Caching decimal values keyed by chain ID and token address prevents unnecessary RPC calls while maintaining accurate token balance calculations across EVM-compatible chains.

What types of DeFi tools need runtime decimal lookup for token amount normalization?

DeFi tooling, portfolio trackers, trading bots, and cross-chain asset dashboards need runtime decimal lookup for token amount normalization. These EVM development workflows rely on querying decimals() to prevent silent mismatches and ensure accurate balance and fiat value calculations.