Skip to content

[FEAT] Implement Admin Dispute Resolution API with Multi-Sig On-Chain Execution #28

Description

@Rampop01

Issue #58

[FEAT] Implement Admin Dispute Resolution API with Multi-Sig On-Chain Execution

🔴 Priority: Critical
Difficulty: Hard
Estimated Effort: 4-5 days
Relevant Files: src/controllers/admin.controller.ts, src/services/dispute.service.ts, src/services/soroban.service.ts
Labels: api, admin, security, priority:critical

Requirements

  1. Dispute API

    • Implement POST /admin/disputes/:id/propose-resolution which stores the buyerRefundAmount and sellerPayoutAmount from the admin.
    • Implement POST /admin/disputes/:id/vote which records the admin's vote against the proposal, tracking voteCount.
    • Once voteCount >= threshold (3 of 5), automatically call POST /admin/disputes/:id/execute which builds and submits the Soroban XDR to the Stellar network to route the funds.
  2. Security

    • All admin endpoints must verify the authenticated JWT belongs to a whitelisted admin address.
    • Validate that buyerRefundAmount + sellerPayoutAmount === totalEscrowLocked. Return 400 Bad Request if the amounts don't balance, to prevent creating or destroying tokens.
    • Emit a Supabase Realtime event to both parties when the dispute is resolved, pushing the final amounts.
  3. Testing Requirements

    • Integration test: Simulate 2 admins voting for Resolution A and 1 for Resolution B. Assert nothing executes.
    • Assert that a 3rd admin voting for Resolution A triggers the on-chain execution.
    • Test the balance validation: submit refund + payout != total and assert a 400 is returned.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions