Skip to content

feat: wire splitter & dispute modules, harden validation, add real tests#138

Merged
BigBen-7 merged 1 commit intoLead-Studios:mainfrom
nottherealalanturing:fix/wire-splitter-dispute-issues-90-91-92-93
Mar 29, 2026
Merged

feat: wire splitter & dispute modules, harden validation, add real tests#138
BigBen-7 merged 1 commit intoLead-Studios:mainfrom
nottherealalanturing:fix/wire-splitter-dispute-issues-90-91-92-93

Conversation

@nottherealalanturing
Copy link
Copy Markdown
Contributor

Summary

Resolves #90, #91, #92, #93 in a single branch.


Changes

lib.rs — Wire modules (closes #92)

  • Declare pub mod dispute and pub mod splitter so both modules compile into the crate.
  • Add #[cfg(test)] mod dispute_test and #[cfg(test)] mod splitter_test.

contract.rs — Expose public entrypoints (closes #92)

  • Add escrow entrypoints: create_escrow, release_escrow, refund_escrow, get_escrow.
  • Add dispute entrypoints: open_dispute, resolve_dispute, get_dispute.
  • Add splitter entrypoints: create_split, distribute, get_split.

dispute.rs — Fix resolve_dispute (closes #93)

  • Remove broken release_escrow(e, escrow_id) / refund_escrow(e, escrow_id) calls (wrong signatures, required depositor/beneficiary auth).
  • Add private settle_escrow_by_outcome helper that directly mutates the escrow record and moves balances — no depositor/beneficiary auth required, only the designated resolver's auth.
  • resolve_dispute now compiles cleanly against the real escrow API.

splitter.rs — Harden validation (closes #91)

  • Reject empty recipient lists.
  • Reject zero-share recipients.
  • Reject duplicate recipient addresses.
  • Reject non-positive total amounts (already via require_positive_amount, now also guarded before BPS loop).

splitter_test.rs — Real Soroban tests (closes #90)

  • Replaced placeholder file (referenced nonexistent Contract, Recipient, calculate_distribution) with real tests using Env, registered contracts, and actual splitter.rs types.
  • Covers: create, distribute (2-recipient, 3-recipient rounding), unauthorized distribute, double-distribute, empty recipients, zero-share, duplicate address, non-positive amount.

dispute_test.rs — New test file (closes #93)

  • Covers: open dispute, resolve for beneficiary, resolve for depositor, wrong resolver panics, double-resolve panics, open dispute on settled escrow panics.

Closes #90
Closes #91
Closes #92
Closes #93

- Wire splitter.rs and dispute.rs into lib.rs (closes Lead-Studios#92)
- Expose create_escrow, release_escrow, refund_escrow, get_escrow,
  open_dispute, resolve_dispute, get_dispute, create_split, distribute,
  get_split on VeritixToken in contract.rs (closes Lead-Studios#92)
- Add settle_escrow_by_outcome private helper in dispute.rs so
  resolve_dispute settles escrow without requiring depositor/beneficiary
  auth; fix broken release_escrow/refund_escrow call signatures (closes Lead-Studios#93)
- Harden create_split: reject empty recipient lists, duplicate addresses,
  zero-share recipients, and non-positive total amounts (closes Lead-Studios#91)
- Replace placeholder splitter_test.rs with real Soroban tests covering
  create, distribute, unauthorized, double-distribute, and all validation
  rejection cases (closes Lead-Studios#90)
- Add dispute_test.rs covering both resolution outcomes and unauthorized
  resolver attempts (closes Lead-Studios#93)
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@nottherealalanturing Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@BigBen-7 BigBen-7 merged commit 2cbfeaa into Lead-Studios:main Mar 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants