feat(rewards|perps): support batch points estimation for perps#21658
Merged
Conversation
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. |
jonson
approved these changes
Oct 27, 2025
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR adds support for batch PERPS position estimation in the RewardsController to enable the "close all positions" feature. The backend API (rewards team PR #247) was already deployed with support for accepting
perpsContextas either a single object or an array of positions, returning aggregated points and bonus estimates.Changes:
EstimatePointsContextDtotype to acceptperpsContextas either a single object or an arrayThe implementation maintains backwards compatibility with existing single-position calls and follows a pass-through architecture (no controller logic changes needed).
Changelog
CHANGELOG entry: support batch points estimation for perps
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
N/A - Backend/Controller change only, no UI modifications
Before
perpsContextonly accepted single objectAfter
perpsContextaccepts single object or array of objects for batch estimationPre-merge author checklist
Pre-merge reviewer checklist
Technical Details
Files Modified:
app/core/Engine/controllers/rewards-controller/types.ts(lines 133-147)app/core/Engine/controllers/rewards-controller/RewardsController.ts(lines 1544-1550)app/core/Engine/controllers/rewards-controller/RewardsController.test.ts(lines 820-850)Type Changes:
Test Coverage:
Note
Add batch PERPS points estimation by allowing
perpsContextto be an array, updating docs, and adding a unit test; controller forwards requests unchanged.EstimatePointsContextDtoto acceptperpsContextasEstimatePerpsContextDto | EstimatePerpsContextDto[]for batch estimation.RewardsController.estimatePointsdocumenting batch behavior (aggregated points, average bonus).RewardsController.test.tsto verify estimating points with an array of PERPS positions passes through toRewardsDataService:estimatePoints.Written by Cursor Bugbot for commit 42bf6bb. This will update automatically on new commits. Configure here.