Skip to content

fix(client): wire InvestorDashboard to wallet and on-chain claims - #220

Closed
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/140-investor-dashboard-real-data
Closed

fix(client): wire InvestorDashboard to wallet and on-chain claims#220
shinzoxD wants to merge 1 commit into
Cylo-Traders:masterfrom
shinzoxD:fix/140-investor-dashboard-real-data

Conversation

@shinzoxD

Copy link
Copy Markdown

Summary

InvestorDashboardPage no longer hardcodes GDF4...M9XZ or renders MOCK_INVESTMENTS. The page reads the connected wallet from useWallet(), loads that address's contributions from ProductionEscrowContract event history, and sends refund/return claims through new contract mutation hooks.

Closes #140

Changes

  • Add useClaimRefund() / useClaimReturn() in useEscrowMutations.ts, calling claim_refund / claim_return via invokeContractWrite and invalidating campaign, contribution, and portfolio queries on success.
  • Add useInvestorPortfolio() which scans ContribReceived / RefundClaimed / ReturnClaimed events (same event-log approach as useAdminCampaigns) and hydrates each row with get_campaign + get_contribution.
  • Wire InvestorDashboardPage to the connected wallet: disconnected users see a connect CTA; connected users see their real portfolio. Claim buttons call the mutation hooks, not the in-memory mock helpers.
  • Leave the MOCK_INVESTMENTS fixtures in investorService.ts unused by pages/components (still referenced only by the excluded legacy test file).
  • Route /dashboard/investor to the real page.

Tests

  • Connected wallet renders that wallet's portfolio rows (not the fake maize/cold-chain fixtures).
  • Disconnected wallet shows a connect-to-view-investments state instead of a mock dashboard.
  • Claim refund/return go through mutateAsync on the new hooks; mock claimRefund/claimReturn and Math.random tx hashes are not used.
  • Mutation hooks call invokeContractWrite with claim_refund / claim_return and do not return fabricated 0x hashes.
  • Portfolio mapping uses on-chain integer pro-rata share math.

GrantFox payout wallet: GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH

Replace the hardcoded GDF4...M9XZ wallet and MOCK_INVESTMENTS portfolio with useWallet() plus an event-scan hook, and add useClaimRefund / useClaimReturn so claims invoke claim_refund / claim_return.

Closes Cylo-Traders#140
Copilot AI lite review requested due to automatic review settings August 24, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shinzoxD

Copy link
Copy Markdown
Author

Closing to respect GrantFox assignment.

#141 (same title/scope as #140) is assigned to @Mosas2000, who already has #223 (Closes #141). Same rule as #139 / #218: the assigned contributor owns it, so this duplicate should not stay in the queue.

@shinzoxD shinzoxD closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants