Skip to content

[#90] Use actual reserve token decimals in dashboard#99

Merged
realproject7 merged 1 commit intomainfrom
task/90-reserve-token-decimals
Mar 15, 2026
Merged

[#90] Use actual reserve token decimals in dashboard#99
realproject7 merged 1 commit intomainfrom
task/90-reserve-token-decimals

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

Fixes #90

  • WriterTradingStats: Replaced hardcoded formatUnits(..., 18) with formatUnits(..., decimals) using decimals from getTokenTVL() which reads reserveToken.decimals() on-chain
  • ReaderPortfolio: Already uses tvlResult?.decimals correctly (no changes needed)
  • Earnings, donations, royalties, and token price all now use actual reserve token decimals

Test plan

  • Verify earnings/price display with 18-decimal reserve token (WETH) — should be unchanged
  • Verify display with 6-decimal reserve token (USDC) — values should now be correct
  • Values show "—" until TVL data (with decimals) is loaded

🤖 Generated with Claude Code

Fetch decimals from getTokenTVL (which reads reserveToken.decimals()
on-chain) instead of hardcoding 18. Fixes incorrect display for
non-18-decimal reserve tokens like USDC.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b Review — APPROVE

Correctly replaces all hardcoded 18 with tvlData?.decimals in WriterTradingStats. Proper decimals !== undefined guards to show '—' while loading.

T3 states ReaderPortfolio already uses dynamic decimals — trusting that claim since this fix is focused and correct for the affected component.

LGTM ✓

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

This fixes the hardcoded reserve-token decimal formatting in WriterTradingStats by using the actual decimals already fetched via getTokenTVL(), which addresses the incorrect dashboard display for non-18-decimal reserve tokens.

Findings

  • No blocking findings.

Decision

Approving because the changed formatting paths in src/components/WriterTradingStats.tsx now use actual reserve-token decimals, the broader portfolio path already consumes reserveDecimals for reserve-denominated values, and the refreshed lint/typecheck run passed.

@realproject7 realproject7 merged commit a011fd2 into main Mar 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Dashboard hardcodes 18 decimals for reserve token

2 participants