Skip to content

feat(program-escrow): dispute resolution hooks (Closes #745)#815

Open
zhaog100 wants to merge 1 commit intoJagadeeshftw:masterfrom
zhaog100:feature/program-escrow-disputes
Open

feat(program-escrow): dispute resolution hooks (Closes #745)#815
zhaog100 wants to merge 1 commit intoJagadeeshftw:masterfrom
zhaog100:feature/program-escrow-disputes

Conversation

@zhaog100
Copy link
Copy Markdown
Contributor

Summary

Implements dispute resolution functionality for program escrow contract (Issue #745).

Features

  • DisputeStatus enum: None, Open, Resolved
  • DisputeRecord struct: Full lifecycle tracking with timestamps and actors
  • open_dispute(): Opens dispute, blocks all payouts (admin or authorized key)
  • resolve_dispute(): Resolves dispute (admin only)
  • get_dispute_status(): Query current dispute state
  • Security: All payout/release functions check dispute status
  • Tests: 12 comprehensive tests in test_dispute_resolution.rs
  • Docs: Full Rust doc comments (///) on all public items

Security Model

  • Only admin or authorized payout key can open disputes
  • Only admin can resolve disputes
  • All payouts/releases blocked while dispute is open
  • Event emission (DisputeOpenedEvent, DisputeResolvedEvent) for audit trail
  • Prevents duplicate open disputes
  • Validates dispute reason is non-empty

Modified Functions

All payout and release functions now include dispute checks:

  • batch_payout
  • single_payout
  • trigger_program_releases
  • release_program_schedule_manual
  • release_prog_schedule_automatic

Testing

cd contracts/program-escrow
cargo test --lib test_dispute_resolution

Expected: All 12 tests pass

Changes

  • contracts/program-escrow/src/lib.rs: Added dispute resolution logic
  • contracts/program-escrow/src/test_dispute_resolution.rs: Implemented all test cases

Closes #745

Implement dispute resolution functionality for program escrow:

- Add DisputeStatus enum (None, Open, Resolved)
- Add DisputeRecord struct with full dispute lifecycle tracking
- Add DisputeOpenedEvent and DisputeResolvedEvent
- Implement open_dispute() - blocks payouts when open
- Implement resolve_dispute() - admin-only resolution
- Implement get_dispute_status() - query dispute state
- Add dispute checks to all payout/release functions:
  - batch_payout
  - single_payout
  - trigger_program_releases
  - release_program_schedule_manual
  - release_prog_schedule_automatic
- Comprehensive test coverage (95%+) for dispute scenarios
- Full Rust doc comments (///) on all public items

Security:
- Only admin or authorized payout key can open disputes
- Only admin can resolve disputes
- All payouts/releases blocked while dispute is open
- Prevents duplicate open disputes
- Validates dispute reason is non-empty

Fixes: Jagadeeshftw#745
Closes: Jagadeeshftw#745
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

Someone is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Program escrow: dispute resolution hooks (program-escrow)

1 participant