📋 Description
When a dispute resolves against the business, the natural remedy is to refund the investor via refund_escrow_funds in quicklendx-contracts/src/escrow.rs, which moves the escrow Held -> Refunded, the invoice to Refunded, the accepted bid to Cancelled, and the investment to Refunded. The dispute lifecycle in dispute.rs and refund mechanics are each tested separately, but the combined path — dispute resolved then escrow refunded — has no end-to-end consistency test.
Why this matters: the dispute-to-refund path is where investor protection actually pays out, and it touches four pieces of state that must all move together. A test that opens a dispute, resolves it, refunds, and asserts every status aligns (and that no second refund/settle can follow) proves the remedy is atomic and final — exactly the property a disputing investor relies on.
🎯 Requirements & Context
Functional requirements
Context & constraints
🛠️ Suggested Execution
1. Fork & branch
git checkout -b test/dispute-refund-flow
2. Implement changes
- Build the full path and the multi-module consistency + finality assertions.
- Doc-comment the atomic-remedy invariant.
3. Test & commit
cargo test -p quicklendx-contracts test_dispute_refund_flow -- --nocapture
- Edge cases: refund attempted while dispute still
UnderReview; refund by admin vs business; double refund rejected; settle after refund rejected.
Example commit message
test(disputes): add end-to-end dispute-resolution-then-refund consistency and finality suite
Verifies invoice/escrow/bid/investment/dispute statuses align after refund and that the
remedy is final with no double disbursement.
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| Full dispute-to-refund path covered |
Required |
| Cross-module status alignment asserted |
Required |
| Finality + no-double-spend asserted |
Required |
| Coverage of refund/dispute branches |
≥ 95% |
| Docs + doc comments |
Required |
cargo test + cargo clippy clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Questions, design discussion, and help getting your environment running — join the QuickLendX contributor community on Discord: https://discord.gg/VpngvTjWa
Please drop a note in the channel when you pick this up so we can avoid duplicate work and unblock you fast. Clear communication during the PR keeps the review fast and friction-free. 🚀
📋 Description
When a dispute resolves against the business, the natural remedy is to refund the investor via
refund_escrow_fundsinquicklendx-contracts/src/escrow.rs, which moves the escrowHeld -> Refunded, the invoice toRefunded, the accepted bid toCancelled, and the investment toRefunded. The dispute lifecycle indispute.rsand refund mechanics are each tested separately, but the combined path — dispute resolved then escrow refunded — has no end-to-end consistency test.🎯 Requirements & Context
Functional requirements
quicklendx-contracts/src/test_dispute_refund_flow.rsdriving: fund -> create dispute -> put under review -> resolve -> refund escrow.Refunded, escrowRefunded, bidCancelled, investmentRefunded, disputeResolved— all consistent.settle_invoiceand a secondrefund_escrow_fundsboth fail; no double disbursement (verify token balance delta equals one refund).Context & constraints
test_cancel_refund.rsandtest_escrow_refund_hardened.rs.25.1.1.🛠️ Suggested Execution
1. Fork & branch
2. Implement changes
3. Test & commit
cargo test -p quicklendx-contracts test_dispute_refund_flow -- --nocaptureUnderReview; refund by admin vs business; double refund rejected; settle after refund rejected.Example commit message
✅ Acceptance Criteria & Guidelines
cargo test+cargo clippyclean💬 Community & Support
Questions, design discussion, and help getting your environment running — join the QuickLendX contributor community on Discord: https://discord.gg/VpngvTjWa
Please drop a note in the channel when you pick this up so we can avoid duplicate work and unblock you fast. Clear communication during the PR keeps the review fast and friction-free. 🚀