Skip to content

feat(rewards): Ondo GM portfolio position and leaderboard section#27971

Merged
VGR-GIT merged 11 commits into
mainfrom
rwds-1102-ondo-position
Mar 26, 2026
Merged

feat(rewards): Ondo GM portfolio position and leaderboard section#27971
VGR-GIT merged 11 commits into
mainfrom
rwds-1102-ondo-position

Conversation

@VGR-GIT

@VGR-GIT VGR-GIT commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

This is mostly about implementing the positions section on the ondo campaign details page, but it also has some changes to the leaderboard components.

Jira

RWDS-1102

Changelog

CHANGELOG entry: Ondo GM campaign portfolio positions

Screenshots/Recordings

  • No leaderboard position and positions (cta takes them to rwa token page)
Screenshot from 2026-03-26 13-28-38
  • Error loading positions section
Screenshot from 2026-03-26 13-20-08
  • Positions loaded, tapping them takes a user to the rwa details page for that token/network & notice last updated at.
Screenshot from 2026-03-26 12-11-03
  • Leaderboard rank/position component (no more card layout)
Screenshot from 2026-03-26 12-11-12 Screenshot from 2026-03-26 12-11-03

Note

Medium Risk
Adds a new authenticated portfolio endpoint, cache/state plumbing, and new UI on the Ondo campaign details screen; moderate risk due to new data flow and cache invalidation paths in RewardsController and Redux state.

Overview
Adds an Ondo GM portfolio “Your Positions” section to the Ondo campaign details page (opted-in users only), including loading/error/empty states and navigation to RWA token list or specific asset details.

Extends rewards data flow to fetch/cache portfolio positions: introduces useGetOndoPortfolioPosition, Redux state/actions/selectors for ondoCampaignPortfolio, and a new RewardsController:getOndoCampaignPortfolioPosition action backed by a new authenticated data-service endpoint /ondo-gm/:campaignId/portfolio/me, with cache invalidation on opt-in/logout/subscription cache invalidation.

Refactors Ondo campaign/leaderboard payloads and UI: switches multiple DTO fields from snake_case to camelCase, adds isLeaderboardNotYetComputed (404) handling with an info banner, updates CampaignHowItWorks to use flat steps instead of phased data, and tightens CampaignTile participant-status fetching to active Ondo campaigns only.

Written by Cursor Bugbot for commit 0e4fc3e. This will update automatically on new commits. Configure here.

sophieqgu and others added 4 commits March 25, 2026 15:55
- Rename OndoCampaignPortfolio* → OndoPortfolio* for consistency
- Move leaderboard section header into OndoCampaignDetailsView (pressable)
- Add "Your Position" title to OndoLeaderboardPosition component
- Wire portfolio position backend hook and reducer selectors
- Add i18n strings for new leaderboard position and portfolio keys

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT requested review from a team as code owners March 26, 2026 12:43
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-rewards Rewards team label Mar 26, 2026
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 26, 2026
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Mar 26, 2026
Comment thread app/components/UI/Rewards/components/Campaigns/OndoPortfolio.tsx
Comment thread app/components/UI/Rewards/Views/OndoCampaignDetailsView.tsx
…lio render

`if (hasFetched)` unconditionally returned the empty-state banner after
any completed fetch, making the portfolio rendering path unreachable.
Changed to `if (hasFetched && !portfolio)` to match the pattern used by
OndoLeaderboardPosition. Adds OndoPortfolio unit tests covering loading,
error, empty, unfetched, and data-display states.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread app/components/UI/Rewards/components/Campaigns/OndoPortfolio.tsx
Comment thread app/components/UI/Rewards/hooks/useRewardCampaigns.ts Outdated
Comment thread tests/framework/fixtures/json/default-fixture.json Outdated
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 26, 2026
…leaderboard, and CampaignDtoState types

- Replace deprecated `phases` with `steps` in OndoCampaignHowItWorks test fixtures
- Add missing `isLeaderboardNotYetComputed` to OndoLeaderboardView test hookDefaults
- Add required `image` field to CampaignDtoState inline test fixtures
- Remove `castDraft` import from `@reduxjs/toolkit` (not re-exported); use direct assignment instead

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT mentioned this pull request Mar 26, 2026
7 tasks
Comment thread app/components/UI/Rewards/components/Campaigns/OndoPortfolio.utils.ts Outdated
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 26, 2026
…tests

- Add ondoCampaignPortfolio to initial-background-state.json fixture
- Add setOndoCampaignLeaderboardNotYetComputed mock to useGetOndoLeaderboard test
- Remove unused sumPositionField and ZERO from OndoPortfolio.utils.ts

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 26, 2026
Comment thread app/components/UI/Rewards/hooks/useGetOndoPortfolioPosition.ts
…ty banner

Remove !hasFetched from showSkeleton so that isLoading && !portfolio correctly
triggers the skeleton on retry, preventing the empty-state banner from flashing
while a re-fetch is in progress. Update snapshots for ondoCampaignPortfolio state.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 26, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.26316% with 104 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.82%. Comparing base (62f6136) to head (1967650).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
.../UI/Rewards/components/Campaigns/OndoPortfolio.tsx 11.36% 39 Missing ⚠️
...ontrollers/rewards-controller/RewardsController.ts 2.94% 33 Missing ⚠️
...ewards/components/Campaigns/OndoPortfolio.utils.ts 48.00% 10 Missing and 3 partials ⚠️
...mponents/UI/Rewards/hooks/useGetOndoLeaderboard.ts 0.00% 8 Missing ⚠️
.../components/UI/Rewards/hooks/useRewardCampaigns.ts 0.00% 4 Missing ⚠️
...ewards/components/Campaigns/CampaignHowItWorks.tsx 0.00% 2 Missing ⚠️
...s/components/Campaigns/OndoLeaderboardPosition.tsx 50.00% 1 Missing and 1 partial ⚠️
...nents/UI/Rewards/Views/OndoCampaignDetailsView.tsx 75.00% 1 Missing ⚠️
...omponents/UI/Rewards/Views/OndoLeaderboardView.tsx 0.00% 1 Missing ⚠️
...ts/UI/Rewards/hooks/useGetOndoPortfolioPosition.ts 96.55% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #27971       +/-   ##
===========================================
- Coverage   82.56%   58.82%   -23.74%     
===========================================
  Files        4825     4844       +19     
  Lines      123955   124692      +737     
  Branches    27617    27809      +192     
===========================================
- Hits       102346    73355    -28991     
- Misses      14560    45344    +30784     
+ Partials     7049     5993     -1056     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…andling

- Fix RewardsController cache test to include image:null in expected result
- Fix formatComputedAt to return '' for invalid dates using isNaN check
- Update 'Up next' label to 'Coming soon' across tests and en.json
- Tighten OndoLeaderboard formatComputedAt test assertion

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT force-pushed the rwds-1102-ondo-position branch from 172345c to 4ec5b08 Compare March 26, 2026 14:26
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 26, 2026
Comment thread app/components/UI/Rewards/Views/OndoCampaignDetailsView.tsx
- useGetOndoLeaderboard: add tests for isLeaderboardNotYetComputed selector,
  404 error handling (dispatches notYetComputed instead of error), and
  setOndoCampaignLeaderboardNotYetComputed dispatch on early return/success path
- useRewardCampaigns: add tests for hasLoadedRef optimization — dispatches
  setCampaignsLoading(true) only when hasLoaded=false
- OndoPortfolio.utils: add full test coverage for formatPnlPercent and
  isPnlNonNegative functions
- OndoPortfolio: add navigation press tests, PnL rendering (positive/negative/
  non-numeric), units text, updatedAt text, and empty positions state
- OndoLeaderboardPosition: add RewardsInfoBanner mock and tests for
  isLeaderboardNotYetComputed=true state (NOT_YET_COMPUTED banner shown/hidden)
- OndoLeaderboardView: add test for isLeaderboardNotYetComputed=true rendering

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

…al state

Remove ondoCampaignLeaderboardNotYetComputed from the Redux store entirely.
The flag is transient UI state owned by useGetOndoLeaderboard, so it now
lives in useState. OndoLeaderboardPosition no longer accepts the prop —
the not-yet-computed banner it showed was driven by the wrong data source
(the general leaderboard 404, not the position endpoint).

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT enabled auto-merge March 26, 2026 15:18
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokePerps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 72%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR introduces a new Ondo GM Portfolio feature within the RewardsController ecosystem. Key changes include:

  1. RewardsController (CRITICAL): Added ondoCampaignPortfolio state, new getOndoCampaignPortfolioPosition action, new portfolioPositionInvalidated event. Also renamed snake_case fields to camelCase (e.g., campaign_idcampaignId, computed_atcomputedAt, total_participantstotalParticipants) - this is a breaking change for any code reading leaderboard data.

  2. Fixture changes: default-fixture.json (used by all E2E tests via FixtureBuilder) was updated to add ondoCampaignPortfolio: {}. This is additive and shouldn't break existing tests.

  3. UI Components: New OndoPortfolio component added to the Ondo Campaign Details view. OndoLeaderboard updated to use camelCase field names.

  4. No dedicated Rewards E2E tests exist - there is no tests/smoke/rewards/ directory. The Rewards/Ondo campaign features are part of the Trending tab ecosystem.

SmokeWalletPlatform is selected because:

  • The Trending tab (directly tested by SmokeWalletPlatform) embeds Rewards/Ondo campaign views
  • Changes to Perps, Predictions, or Tokens views embedded in Trending affect this tag
  • The fixture change to default-fixture.json could affect wallet platform tests

SmokePerps is selected because:

  • Perps is a section inside the Trending tab (SmokeWalletPlatform)
  • The RewardsController is shared infrastructure between Perps and Rewards features
  • Per tag description: SmokePerps changes also affect SmokeWalletPlatform (Trending section)

No other tags are warranted - the changes are isolated to the Rewards/Ondo campaign feature area and don't touch confirmations, accounts, identity, network, trade, or other feature areas.

Performance Test Selection:
The changes are focused on adding a new portfolio data feature (OndoPortfolio) and renaming fields in the RewardsController. While new UI components were added (OndoPortfolio), these are within the Rewards/Ondo campaign feature area which is not covered by any existing performance test tags. The changes don't affect account list rendering, onboarding, login, swaps, app launch, asset loading, predictions market performance, or perps trading performance in ways that would warrant performance testing. The fixture changes are additive (empty object) and won't impact performance.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@VGR-GIT VGR-GIT added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 31ebc2b Mar 26, 2026
196 of 199 checks passed
@VGR-GIT VGR-GIT deleted the rwds-1102-ondo-position branch March 26, 2026 17:49
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 26, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-XL team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants