Record the balance before formatting
Start with the raw integer returned by balanceOf. If it is 123,000, an app that uses three decimal places shows 123 tokens. An app that uses six shows 0.123. Both displays can be produced from the same raw balance. ERC-20 specifies decimals as optional metadata, so an integration also needs a safe way to handle contracts that omit it.
Check the exact contract on the exact chain
Two assets with the same ticker can have different contract addresses and precision. Record the chain, the address and the value returned by decimals() for that address. Then compare it with the wallet configuration, token list or cached metadata. When only one app shows the discrepancy, compare the raw balances at the same block before assuming the contract is the problem.
Keep entry and display failures separate
A pure display failure changes how an integer is labeled. An app that also uses the wrong precision to prepare a transfer can encode a materially different integer amount. Before confirming a transaction in a suspect interface, verify the recipient, contract and raw amount against the contract’s precision using a trusted tool.
Treat a metadata change as an integration change
Changing a front-end setting can correct the label immediately. Changing decimals on a contract that permits upgrades can change displayed quantities across integrations without rewriting existing integer balances. Reviewers should separately verify the contract’s upgrade design and any proposal that claims to migrate existing balances.
Sources
Prepared with AI assistance. This guide explains protocol behavior for educational use.
Editorial policy (Chinese)