Skip to content

[#177] Fix reader dashboard: RESERVE_LABEL + truncated decimals#181

Merged
realproject7 merged 2 commits intomainfrom
task/177-reader-donation-label
Mar 16, 2026
Merged

[#177] Fix reader dashboard: RESERVE_LABEL + truncated decimals#181
realproject7 merged 2 commits intomainfrom
task/177-reader-donation-label

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Replace hardcoded "$PLOT" with RESERVE_LABEL (shows "WETH" on testnet)
  • Add formatTruncated helper to limit decimal output to 6 places (e.g., 0.000577 WETH instead of 0.00057715687791651 $PLOT)
  • Applied to both donation total and individual donation amounts

Fixes #177

Test plan

  • tsc --noEmit — zero errors
  • next build — clean
  • Reader dashboard shows "WETH" on testnet, "$PLOT" on mainnet
  • Donation amounts truncated to readable precision

🤖 Generated with Claude Code

Replace hardcoded "$PLOT" with RESERVE_LABEL (WETH on testnet) and
truncate formatUnits output to 6 decimal places for readability.

Fixes #177

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 APPROVE

Clean fix:

  1. formatTruncated — String-based truncation after formatUnits. Correctly strips trailing zeros and trailing dot. Good approach avoiding floating-point issues.
  2. RESERVE_LABEL — Replaces hardcoded "$PLOT". Applied to both total and per-row amounts.

No issues.

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: REQUEST CHANGES

Summary

The label fix is correct, but the reader dashboard still formats donation amounts with a hardcoded 18 decimals in both donation-history display paths. This repo already uses dynamic reserve-token metadata elsewhere, and the queue rules explicitly say not to hardcode values.

Findings

  • [medium] Donation history still hardcodes reserve-token decimals via formatTruncated(..., 18) for both the page total and each donation row. That keeps this screen out of sync with the app's dynamic reserve-token formatting pattern and can misformat values if the reserve token decimals ever differ.
    • File: src/app/dashboard/reader/page.tsx:105
    • Suggestion: Fetch the reserve token decimals dynamically (for example via the same getTokenTVL / token-bond metadata path already used in the dashboard and portfolio code) and pass those decimals into formatTruncated instead of hardcoding 18.

Decision

Requesting changes because PR #181 fixes the label but leaves hardcoded reserve-token decimals in the reader dashboard donation history. The formatting should follow the existing dynamic metadata pattern before this is approved.

Fetch PLOT_TOKEN decimals on-chain via publicClient and pass to
formatTruncated calls. Falls back to 18 if query hasn't resolved.

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.

Verdict: APPROVE

Summary

The follow-up commit removes the hardcoded 18 decimals from the reader dashboard donation-history display and resolves the reserve-token decimals dynamically instead. That closes the formatting issue while keeping the WETH/$PLOT label fix intact.

Findings

  • [info] No remaining blocking findings after 949b292.
    • File: src/app/dashboard/reader/page.tsx:63
    • Suggestion: None.

Decision

Approving because the prior hardcoded-decimals issue is resolved, the reader dashboard now follows the app's reserve-token metadata pattern, and GitHub lint-and-typecheck is passing.

@realproject7 realproject7 merged commit 3ce5195 into main Mar 16, 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.

[QA-Bug] Reader dashboard donation history shows $PLOT instead of WETH on testnet + excessive decimals

2 participants