useStablecoinBalance defaults a failed decimals() read to 18, misstating 6-dec tokens by 10^12
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 2
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 10
Description
## What happens
In `apps/web/src/hooks/useStablecoinBalance.ts`, when the multicall `decimals()` read fails, the hook silently defaults to 18. For a 6-decimal stablecoin (USDC/USDT class) that misstates the balance by a factor of 10^12 — and since this hook picks the spend token, a transient RPC failure can mis-pick which token the user pays with.
Same file, same fix boundary: the `?? 'TOKEN'` symbol-label fallback is dead code — a failed `symbol()` yields `''`, so the fallback never fires.
## Impact
Money-path default (engineering rules / money-path checklist item 2): unknown must mean reject-or-retry, never a plausible value. Wrong balance display and potentially wrong spend-token selection under RPC flakiness.
## Suggested fix
Treat a failed `decimals()` read as "token unavailable this round" (exclude from selection, surface a retry) instead of assuming 18; make the label fallback real or delete it.
## Evidence
Current behavior is pinned by the new `useStablecoinBalance` tests in #236 (12 tests, module 0→100% stmts) — flip those assertions with the fix.
Found during the test-hardening pass (#236); that PR changes no product code by design.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Assessment
This issue has not been assessed yet.