Skip to content

fix(rewards): perps trading campaign dtos and ineligible state#30907

Merged
VGR-GIT merged 4 commits into
mainfrom
Fix-perps-trading-not-qualified-users
Jun 2, 2026
Merged

fix(rewards): perps trading campaign dtos and ineligible state#30907
VGR-GIT merged 4 commits into
mainfrom
Fix-perps-trading-not-qualified-users

Conversation

@sophieqgu

@sophieqgu sophieqgu commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description

  • Fix DTO shapes PerpsTradingCampaignLeaderboardDto, PerpsTradingCampaignLeaderboardEntry and PerpsTradingCampaignLeaderboardPositionDto
  • Fix 'pending' state where rank is null but user has positive Perps volume, modify card title 'Qualify for this rank' to 'Qualify for the leaderboard'

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Simulator Screenshot - E2E Test  - 2026-06-01 at 20 54 06 Simulator Screenshot - E2E Test  - 2026-06-01 at 20 54 10 Simulator Screenshot - E2E Test  - 2026-06-01 at 20 54 21

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches rewards API mapping and broad campaign UI eligibility gating; behavior changes for users below volume threshold but no auth or payment paths.

Overview
Aligns the perps trading campaign with updated leaderboard API shapes and eligibility rules end to end.

Data layer: Leaderboard and position types/cache now use volume and eligible instead of notionalVolume and qualified, add minVolumeForEligibility and totalParticipants, and allow rank to be null when the user has not met the volume threshold.

UI behavior: Stats summary and leaderboard stats header show only when the user has finite, positive volume (not merely a rank). Pending/qualify flows use API minVolumeForEligibility (with a constant fallback) for the remaining volume message. Copy is updated from “Qualify for this rank” to “Qualify for the leaderboard” across locales.

Tests: View and component tests cover zero/invalid volume, completed campaigns, and non-finite stat fallbacks.

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

@sophieqgu sophieqgu requested a review from a team as a code owner June 2, 2026 00:40
@github-actions

github-actions Bot commented Jun 2, 2026

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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-rewards Rewards team label Jun 2, 2026
@github-actions github-actions Bot added size-M risk:medium AI analysis: medium risk labels Jun 2, 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.

Reviewed by Cursor Bugbot for commit ee34616. Configure here.

Comment thread app/components/UI/Rewards/components/Campaigns/PerpsCampaignStatsSummary.tsx Outdated
@sophieqgu sophieqgu changed the title Fix perps trading not qualified users fix(rewards): perps trading campaign dtos and ineligible state Jun 2, 2026
@github-actions github-actions Bot added size-L and removed size-M labels Jun 2, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.71%. Comparing base (02c85c2) to head (ba11e24).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
...ontrollers/rewards-controller/RewardsController.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #30907   +/-   ##
=======================================
  Coverage   82.70%   82.71%           
=======================================
  Files        5561     5562    +1     
  Lines      143081   143114   +33     
  Branches    33051    33065   +14     
=======================================
+ Hits       118336   118373   +37     
+ Misses      16863    16855    -8     
- Partials     7882     7886    +4     

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

@VGR-GIT VGR-GIT force-pushed the Fix-perps-trading-not-qualified-users branch from ba11e24 to a32a028 Compare June 2, 2026 06:44
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are focused on the Perps Trading Campaign leaderboard/stats system:

  1. RewardsController.ts & types.ts (CRITICAL): Data model changes renaming notionalVolumevolume, qualifiedeligible, and adding new fields minVolumeForEligibility and totalParticipants to leaderboard DTOs and state. These are breaking field renames that propagate through the controller state.

  2. UI Components: Multiple Perps campaign views (PerpsTradingCampaignDetailsView, LeaderboardView, StatsView) and components (PerpsCampaignStatsSummary, PerpsTradingCampaignLeaderboard, PerpsTradingCampaignStatsHeader) updated to use new field names and dynamic minVolumeForEligibility from API instead of hardcoded constant.

  3. Locales: Minor string update across 13 languages ("Qualify for this rank" → "Qualify for the leaderboard").

  4. Reducer tests: Mock data updated to match new type shapes.

Tag selection rationale:

  • SmokePerps: Primary tag - changes directly affect Perps campaign leaderboard/stats UI and the RewardsController that powers it. While no E2E tests specifically cover leaderboard views, SmokePerps tests cover the Perps flow including Add Funds which exercises the controller.
  • SmokeWalletPlatform: Required per SmokePerps tag description - Perps is a section inside the Trending tab, and changes to Perps views affect Trending.
  • SmokeConfirmations: Required per SmokePerps tag description - Add Funds deposits are on-chain transactions.

No existing E2E tests directly test the leaderboard/campaign stats views, so the risk of breaking existing tests is low. The changes are well-contained within the Perps rewards subsystem.

Performance Test Selection:
No performance-sensitive changes detected. The changes are data model field renames and UI logic updates within the Perps campaign leaderboard/stats components. No changes to list rendering performance, app startup, Redux store structure (beyond test mocks), or any other performance-critical paths. The RewardsController changes are limited to leaderboard data caching logic with field name updates.

View GitHub Actions results

@VGR-GIT

VGR-GIT commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@sophieqgu heads-up: I rebased this branch off the latest main and force-pushed (ba11e249c9a32a0283f3). All 4 commits replayed cleanly with no conflicts. If you have this branch checked out locally, please git fetch and git reset --hard origin/Fix-perps-trading-not-qualified-users to resync.

@VGR-GIT

VGR-GIT commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hey @sophieqgu 👋 — heads-up from the backend side on this one.

Since #30907 migrates the perps-trading leaderboard client OFF the old field names and onto volume/eligible, already-rolled-out (older) clients still read the old names. To keep those shipped clients working, backend PR consensys-vertical-apps/va-mmcx-rewards#608 re-adds the old fields as deprecated additive aliases on the perps-trading leaderboard contract:

  • notionalVolume — deprecated alias of volume (on entries, neighbors, and the /me position)
  • qualified — deprecated alias of eligible (on entries, neighbors, and the /me position)

These are purely additive/back-compat — no behavior change for new clients, which keep using volume/eligible.

Also FYI: minVolumeForEligibility is already exposed on both the leaderboard response and the /me position (env-driven, default 25k), so no need to hard-code the threshold client-side.

@VGR-GIT VGR-GIT enabled auto-merge June 2, 2026 07:05
@VGR-GIT VGR-GIT added this pull request to the merge queue Jun 2, 2026
Merged via the queue into main with commit 2c1ab6e Jun 2, 2026
394 of 403 checks passed
@VGR-GIT VGR-GIT deleted the Fix-perps-trading-not-qualified-users branch June 2, 2026 08:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:medium AI analysis: medium risk size-L team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants