feat: implement ResolutionService.resolveFight and ResolutionService.… - #1165
Merged
Ehonrie merged 2 commits intoJul 27, 2026
Merged
Conversation
…handleDispute Closes Netwalls#1083 Closes Netwalls#1084 Detailed Explanation of Changes: 1. Issue Netwalls#1083 (B-25) — Implement ResolutionService.resolveFight: - What was done: Implemented ResolutionService.resolveFight() to handle market fight outcome resolutions initiated by admin actions. - How it was done: * Added ResolutionService class and resolveFight method in backend/src/services/resolution.service.ts. * Implemented submitResolution in backend/src/services/oracle.service.ts to persist OracleResult entries and set market status to Resolved. * Wired ResolutionService.resolveFight to perform optimistic cache updates (optimisticMarketCache) for instant state retrieval before DB persistence. * Integrated with resolveMarketHandler in backend/src/api/controllers/market.controller.ts, which is routed via admin-authenticated endpoints (/api/admin/markets/resolve) guarded by adminAuth / requireAdmin middleware to enforce that resolution is only callable by authorized admins. 2. Issue Netwalls#1084 (B-26) — Implement ResolutionService.handleDispute: - What was done: Implemented ResolutionService.handleDispute() to process admin review decisions on disputed markets. - How it was done: * Added handleDispute method in backend/src/services/resolution.service.ts accepting disputeId, outcome, admin, and notes. * Enforced strict validation requiring decision notes explaining the resolution outcome. * Invoked oracleService.resolveDispute for dispute resolution and market status finalization. * Executed a database transaction storing the decision notes in Dispute.resolution and logging the action to both AdminLog (action: "handleDispute") and AuditLog for complete auditability. * Wired resolveDisputeHandler in backend/src/api/controllers/market.controller.ts to receive dispute resolution requests from admin-authenticated routes (/api/admin/markets/dispute/resolve).
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…handleDispute
Closes #1083
Closes #1084
Detailed Explanation of Changes:
Issue B-25: Implement ResolutionService.resolveFight #1083 (B-25) — Implement ResolutionService.resolveFight:
Issue B-26: Implement ResolutionService.handleDispute #1084 (B-26) — Implement ResolutionService.handleDispute: