Skip to content

[#29] Dashboard trading stats#87

Merged
realproject7 merged 3 commits intomainfrom
task/29-dashboard-trading-stats
Mar 15, 2026
Merged

[#29] Dashboard trading stats#87
realproject7 merged 3 commits intomainfrom
task/29-dashboard-trading-stats

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Writer dashboard: Added per-story token price (priceForNextMint), TVL (tokenBond), and donations total — displayed in stats grid via new WriterTradingStats component
  • Reader dashboard: Replaced Phase 5 placeholder with real ReaderPortfolio component — shows token holdings (balanceOf), portfolio value (holdings * priceForNextMint), 24h price change per holding, and best-performing pick highlight

Test plan

  • npm run lint passes
  • npm run typecheck passes
  • Writer dashboard shows token price, TVL, and donations per storyline
  • Reader dashboard shows portfolio with holdings, values, and 24h changes
  • Portfolio handles zero holdings gracefully
  • Best pick shows highest 24h gainer

Fixes #29

🤖 Generated with Claude Code

Writer dashboard:
- Per-story token price (priceForNextMint), TVL (tokenBond), donations total
- Displayed in grid below existing story details

Reader dashboard:
- Portfolio section: token holdings via balanceOf for each storyline
- Portfolio value: holdings * priceForNextMint
- 24h price change per holding via get24hPriceChange
- Best-performing pick highlight
- Replaces Phase 5 placeholder

Fixes #29

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

Summary

The dashboards are close, but the writer side still misses the key earnings stat from the revised issue comment, and the new TVL display reintroduces the reserve-decimal bug we already fixed in the shared price utilities.

Findings

  • [high] The revised issue comment and overnight queue require writer dashboard earnings to include donations plus royalties from MCV2_Bond.getRoyaltyInfo(). WriterTradingStats only shows Donations, while royalties remain in the separate ClaimRoyalties control and are not incorporated into an earnings total. That means the primary writer stat required by #29 is still missing.
    • File: src/components/WriterTradingStats.tsx:50
    • Suggestion: read getRoyaltyInfo() for the storyline token and expose an Earnings stat that combines donations + current royalty amount, or otherwise present royalties as part of the required writer earnings summary.
  • [medium] WriterTradingStats formats tokenBond().reserveBalance with formatUnits(..., 18), hardcoding 18 decimals instead of using the reserve token's actual decimals or the shared getTokenTVL() utility. This recreates the same unit bug we already flagged in PR #82 for non-18-decimal reserves.
    • File: src/components/WriterTradingStats.tsx:79
    • Suggestion: use getTokenTVL() or fetch the reserve token decimals before formatting TVL.

Decision

Requesting changes because the writer dashboard still does not meet the required earnings behavior, and the TVL formatting is unsafe.

- Writer: added unclaimed royalties via getRoyaltyInfo, use getTokenTVL
  for correct reserve token decimals instead of hardcoded 18
- Reader: fetch reserve decimals via getTokenTVL, use per-holding
  decimals for value formatting
- Changed writer grid to 2x2 (price, TVL, donations, royalties)

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

Summary

The TVL formatting issue is fixed, but the writer dashboard still misses the primary earnings stat required by the revised issue comment and overnight queue.

Findings

  • [high] The revised issue comment for #29 says writer stats should show total earnings as donations from Supabase plus royalties from getRoyaltyInfo(), and the overnight queue merge checklist likewise calls for earnings, TVL, token price per storyline. WriterTradingStats now shows Donations and Royalties as separate fields, but it still does not expose a combined Earnings total anywhere. That means the required headline writer metric is still absent.
    • File: src/components/WriterTradingStats.tsx:70
    • Suggestion: add an Earnings stat that sums donations + current royalty amount, or otherwise rename/restructure the writer stats so the combined earnings figure is explicitly presented.

Decision

Requesting one final change because the writer dashboard still does not present the required combined earnings metric.

Earnings shown as primary metric with D/R breakdown below.
Grid changed to 3-col: Earnings, Token Price, TVL.

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 final update adds the required combined writer earnings metric while keeping the earlier TVL-decimal and reader-portfolio fixes intact. The dashboards now match the revised March 15 issue comment and overnight queue for #29.

Findings

  • No blocking findings.

Decision

Approving because the writer dashboard now shows earnings, token price, and TVL per storyline, and the reader dashboard exposes holdings, portfolio value, and 24h change using the shared on-chain utilities.

@realproject7 realproject7 merged commit 4d7128b 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.

[P5-7] Dashboard Trading Stats

2 participants