Skip to content

feat(rewards): add Perps Trading Campaign#29323

Merged
VGR-GIT merged 7 commits into
mainfrom
feat/perps-trading-campaign
May 5, 2026
Merged

feat(rewards): add Perps Trading Campaign#29323
VGR-GIT merged 7 commits into
mainfrom
feat/perps-trading-campaign

Conversation

@VGR-GIT

@VGR-GIT VGR-GIT commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Description

https://consensyssoftware.atlassian.net/browse/RWDS-1239
https://consensyssoftware.atlassian.net/browse/RWDS-1190
https://consensyssoftware.atlassian.net/browse/RWDS-1215

Adds support for the Perps Trading Competition rewards campaign. Users can view campaign details, join via a guided tour, track their stats (rank, PnL, notional volume and margin thresholds), browse the leaderboard, and monitor the prize pool — which scales from $10k to $50k based on total notional volume. Geo-restricted users see a locked CTA. Once opted in, the CTA switches to "Open Position" navigating directly to the Perps tab.

New screens: campaign details, stats, and full leaderboard. All data-driven from the existing campaign/leaderboard backend infrastructure.

Changelog

CHANGELOG entry: Added: Rewards Perps Trading Campaign — details page, stats page, leaderboard page, prize pool, tour, and opt-in flow.

Screenshots

Simulator Screenshot - E2E Test  - 2026-04-28 at 15 31 25

----------------------------------------Qualified----------------------------------------

Simulator Screenshot - E2E Test  - 2026-04-29 at 15 24 21 Simulator Screenshot - E2E Test  - 2026-04-29 at 15 24 28 Simulator Screenshot - E2E Test  - 2026-04-28 at 17 28 50 Simulator Screenshot - E2E Test  - 2026-04-28 at 17 29 33

----------------------------------------Pending----------------------------------------

Simulator Screenshot - E2E Test  - 2026-04-29 at 15 30 03 Simulator Screenshot - E2E Test  - 2026-04-29 at 15 28 25 Simulator Screenshot - E2E Test  - 2026-04-29 at 15 30 03 Simulator Screenshot - E2E Test  - 2026-04-29 at 15 32 31

----------------------------------------Split View----------------------------------------

Simulator Screenshot - E2E Test  - 2026-04-28 at 17 36 22 Simulator Screenshot - E2E Test  - 2026-04-28 at 17 36 38 Simulator Screenshot - E2E Test  - 2026-04-28 at 17 37 38 Simulator Screenshot - E2E Test  - 2026-04-28 at 17 50 45 Simulator Screenshot - E2E Test  - 2026-04-28 at 18 00 11

---------------------------------Powered by HyperTracker------------------------------

Simulator Screenshot - E2E Test  - 2026-05-01 at 11 44 51 Simulator Screenshot - E2E Test  - 2026-05-01 at 11 44 56

Note

Medium Risk
Adds new Rewards navigation routes and multiple Perps campaign views/CTAs, plus refactors shared leaderboard/prize-pool logic that could affect existing Ondo rendering and testIDs. Risk is moderate due to new conditional UI flows and reused components across campaigns.

Overview
Adds a new Perps Trading rewards campaign user flow with dedicated details, leaderboard, and stats screens, wiring them into RewardsNavigator, CampaignTile navigation (including tour routing), and deeplink handling (campaign=perps-comp).

Refactors campaign UI to improve reuse: extracts a shared CampaignLeaderboard (rows/skeleton/separator + shared test IDs) and updates OndoLeaderboard to use it; splits CampaignStatsSummary into OndoCampaignStatsSummary (renamed test IDs) and reuses its StatCell/tags in new Perps stats components.

Unifies prize pool tier computation by introducing computePrizePoolProgress and migrating OndoPrizePool/OndoLeaderboardView off bespoke getCurrentPrize/progress logic. Adds extensive test coverage for the new Perps views/components and updated Ondo stats/leaderboard behavior.

Reviewed by Cursor Bugbot for commit fcf01e2. Bugbot is set up for automated code reviews on this repo. Configure here.

@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-rewards Rewards team label Apr 24, 2026
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch from 0fda384 to b602f61 Compare April 28, 2026 16:55
@sophieqgu sophieqgu marked this pull request as ready for review April 28, 2026 22:55
@sophieqgu sophieqgu requested a review from a team as a code owner April 28, 2026 22:55
Comment thread app/components/UI/Rewards/Views/CampaignTourStepView.tsx Outdated
Comment thread app/components/UI/Rewards/Views/PerpsTradingCampaignDetailsView.tsx
@sophieqgu sophieqgu added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Apr 28, 2026
@metamaskbotv2 metamaskbotv2 Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Apr 28, 2026
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch from 26d6760 to 9da0251 Compare April 29, 2026 17:46
Comment thread app/components/UI/Rewards/Views/CampaignTourStepView.tsx
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch from f92e83f to 0c6256d Compare April 29, 2026 19:53
@codecov-commenter

codecov-commenter commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.95021% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.87%. Comparing base (8437791) to head (39c40a0).
⚠️ Report is 63 commits behind head on main.

Files with missing lines Patch % Lines
...ontrollers/rewards-controller/RewardsController.ts 6.97% 40 Missing ⚠️
.../Rewards/Views/PerpsTradingCampaignDetailsView.tsx 74.07% 1 Missing and 13 partials ⚠️
app/reducers/rewards/selectors.ts 43.75% 9 Missing ⚠️
...ents/Campaigns/PerpsTradingCampaignLeaderboard.tsx 82.22% 4 Missing and 4 partials ⚠️
...s/UI/Rewards/components/Campaigns/CampaignTile.tsx 20.00% 4 Missing ⚠️
...ards/Views/PerpsTradingCampaignLeaderboardView.tsx 87.50% 1 Missing and 2 partials ⚠️
app/components/UI/Rewards/RewardsNavigator.tsx 0.00% 1 Missing and 1 partial ⚠️
app/reducers/rewards/index.ts 87.50% 1 Missing and 1 partial ⚠️
...mponents/UI/Rewards/Views/CampaignTourStepView.tsx 50.00% 0 Missing and 1 partial ⚠️
...UI/Rewards/Views/PerpsTradingCampaignStatsView.tsx 97.22% 0 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #29323    +/-   ##
========================================
  Coverage   81.86%   81.87%            
========================================
  Files        5255     5270    +15     
  Lines      138980   139410   +430     
  Branches    31518    31662   +144     
========================================
+ Hits       113774   114136   +362     
- Misses      17465    17517    +52     
- Partials     7741     7757    +16     

☔ 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.

@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch 2 times, most recently from c967e29 to e8deae4 Compare April 30, 2026 14:54
Comment thread app/components/UI/Rewards/utils/formatUtils.ts Outdated
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch from 557d8c0 to 473eb2e Compare April 30, 2026 16:23
Comment thread app/components/UI/Rewards/components/Campaigns/CampaignTile.tsx Outdated
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch 3 times, most recently from e795ae6 to ceca14a Compare May 4, 2026 16:53
isLoading: isLeaderboardLoading,
hasError: hasLeaderboardError,
isLeaderboardNotYetComputed,
computedAt: leaderboardComputedAt,

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.

Duplicate destructuring creates unused leaderboardComputedAt variable

Medium Severity

The property computedAt is destructured twice from useGetOndoLeaderboard — once as computedAt (line 121) and again as leaderboardComputedAt (line 125). The leaderboardComputedAt variable is never referenced anywhere in the file. This looks like an accidental leftover from development, likely intended to be passed to LeaderboardPositionHeader (which added computedAt to its interface but never wired it up).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ceca14a. Configure here.

@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.

There are 2 total unresolved issues (including 1 from previous review).

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.

Reviewed by Cursor Bugbot for commit b3ac5a6. Configure here.

Comment thread app/components/UI/Rewards/Views/OndoLeaderboardView.tsx Outdated
VGR-GIT and others added 4 commits May 4, 2026 17:30
Full mobile implementation of the Perps Trading Competition campaign:
data layer (new DTOs, RewardsController cached methods, RewardsDataService
API calls, messenger actions), Redux state + selectors, three hooks
(leaderboard, leaderboard position, prize pool), components
(PerpsTradingCampaignLeaderboard, PerpsTradingCampaignPrizePool,
PerpsTradingCampaignCTA with perps geo-restriction, PerpsTradingCampaignStatsHeader),
three campaign views (details, leaderboard, stats), navigator registration,
route constants, CampaignTile routing, tour step view routing, and en.json
translations. Tests added for all three hooks and the formatPnl utility.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

f

Fix perp details view

Fix stats page

Fix leaderboard

Fix tests

Fix lint

Update RewardsController-method-action-types.ts

Fix

Fix Ondo computedAt

Fix prize pool

Fix prize pool

Add qualified card

Fix test

Update endpoint

Update useGetPerpsTradingCampaignVolume.test.ts

Fix lint
@sophieqgu sophieqgu force-pushed the feat/perps-trading-campaign branch from 637c0d9 to cb11d59 Compare May 4, 2026 21:30
@VGR-GIT VGR-GIT enabled auto-merge May 5, 2026 06:56
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 78%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR introduces a new Perps Trading Campaign feature within the Rewards system. Key changes include:

  1. RewardsController (CRITICAL): New state fields (perpsTradingCampaignLeaderboard, perpsTradingCampaignLeaderboardPositions, perpsTradingCampaignVolume), new methods, and new messenger actions. These are additive changes but modify the controller's default state.

  2. initial-background-state.json (CRITICAL for E2E): Updated with new RewardsController state fields. This file is used as the fixture for E2E tests - any test that initializes the background state could be affected if the state shape doesn't match.

  3. Routes.ts: New route constants for Perps Trading Campaign views. Navigation changes can affect tests that rely on routing.

  4. RewardsNavigator.tsx: New screens registered for Perps Trading Campaign. New deeplink handling for 'perps-comp' campaign.

  5. Redux Reducer: New state slices and reducers for Perps Trading Campaign data.

  6. New UI Components: PerpsTradingCampaignDetailsView, PerpsTradingCampaignLeaderboardView, PerpsTradingCampaignStatsView, and related components/hooks.

Tag Selection Rationale:

  • SmokePerps: Directly relevant - this adds Perps Trading Campaign leaderboard/stats functionality. The Perps tests cover the Perps trading interface which is the entry point for this campaign. The new campaign details view is accessible from the Perps section.
  • SmokeWalletPlatform: The Perps section is embedded in the Trending tab (SmokeWalletPlatform). Changes to Perps views affect Trending. The SmokePerps tag description explicitly states to also select SmokeWalletPlatform.
  • SmokeConfirmations: Per SmokePerps tag description, when selecting SmokePerps, also select SmokeConfirmations since Add Funds deposits are on-chain transactions.

The changes are primarily additive (new feature, not modifying existing flows), which reduces risk. No existing E2E tests directly test the Rewards/Perps Campaign leaderboard feature, so the main risk is regression in existing Perps and WalletPlatform flows due to the controller state changes and navigation updates.

Performance Test Selection:
The PR adds new Perps Trading Campaign leaderboard, position, and volume data fetching to the RewardsController. These new API calls and state management additions could impact the performance of the Perps-related flows. The @PerformancePreps tag covers perpetuals trading performance including perps market loading and balance display, which could be affected by the new data loading patterns introduced in this PR.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@VGR-GIT VGR-GIT added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit c03ef59 May 5, 2026
113 of 115 checks passed
@VGR-GIT VGR-GIT deleted the feat/perps-trading-campaign branch May 5, 2026 09:54
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 5, 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.77.0 Issue or pull request that will be included in release 7.77.0 size-XL skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants