LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

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.

189,255stars29,267forksUpdated 5/24/2026
Data Science & MLWeb Development#blockchain#evm#token-decimals#typescript#python#erc-20

Security Assessment

Low Risk(85/100)

Detected risks:

Secret Exposure([SKILL.md] token =)
Security Score85/100

About evm-token-decimals

This skill is designed to eliminate silent and often costly errors caused by incorrect handling of ERC-20 token decimals across EVM-compatible blockchains. In many DeFi and blockchain applications, developers mistakenly assume a fixed decimal precision for tokens, which can lead to balances, pricing, and portfolio valuations being off by orders of magnitude without any runtime errors. This issue becomes even more complex in cross-chain environments where the same token symbol may have different decimal configurations depending on the chain or bridged representation.

The skill focuses on enforcing safe and accurate decimal handling by requiring runtime retrieval of the `decimals()` value directly from the token contract. It supports caching strategies keyed by `(chain_id, token_address)` to reduce redundant on-chain calls while maintaining correctness. It also encourages defensive programming practices such as fallback handling when `decimals()` is unavailable, and the use of precise numeric types like `Decimal` or `BigInt` instead of floating-point arithmetic. Additionally, it provides normalization strategies for converting token amounts into a consistent 18-decimal WAD format, making internal accounting and comparisons reliable across heterogeneous assets and chains.

This skill is primarily intended for developers building DeFi protocols, trading bots, portfolio trackers, analytics dashboards, or any system that aggregates or compares token balances across multiple environments. It is especially useful in cross-chain applications and systems dealing with bridged assets, where decimal inconsistencies are common. By standardizing decimal handling practices, it helps ensure correctness in financial calculations and prevents subtle bugs that could otherwise lead to significant valuation errors.

FAQ

Why should I avoid hardcoding token decimals?

Hardcoding decimals can lead to incorrect balance and price calculations because different tokens—even those with the same symbol—may use different decimal configurations across chains or bridged versions. This can silently produce errors without any runtime warnings.

How does this skill handle tokens with missing or broken decimals() implementations?

If a token's `decimals()` call fails or reverts, the skill recommends using a defensive fallback (commonly 18 decimals) while logging the incident. This ensures the application continues functioning while making the issue visible for debugging.

Is caching safe when dealing with token decimals?

Yes, caching is safe and recommended as long as it is keyed by both `chain_id` and `token_address`. This prevents cross-chain or cross-token collisions while reducing repeated on-chain calls for the same asset.

What numeric types should be used for safe calculations?

The skill recommends using exact numeric representations such as `Decimal` in Python or `BigInt` in JavaScript/TypeScript to avoid precision loss. Floating-point types should be avoided entirely.

Install evm-token-decimals

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

affaan-m/everything-claude-code

Related Skills

cmux-terminal-multiplexer

88

wps-excel

673

ui-design

167

technical-wireframe-info-layout

7,069