Complexity / points: Medium (150 points) - maintainer label: points-150-medium
PR must include:
Problem
The escrow settlement flow currently has multiple areas where the intended semantics are not yet fully specified in docs:
- what
amount in record_payment represents
- how
EscrowStatus::Settled should relate to tokenization finalization
- how
EscrowStatus::Refunded impacts invoice tokens (burn/unlock/lock)
Additionally, we already detected a stuck-funds edge case on underpayment (Issue 7), but the overall state-machine invariants still need formalization.
Proposed change
Create a state-machine invariants document for escrow + token:
- define valid transitions among
Created -> Funded -> Settled and Funded -> Refunded
- define invariants on token balances and escrow fields at each transition
- specify exactly when invoice tokens should be minted/burned/unlocked (once implemented)
Acceptance criteria
Dependencies
- Relates to: Issue 7 (partial settlement stuck funds) and Issue 24/25 (settlement money flow)
- Requires the lifecycle doc (Issue 23) as starting context
Complexity / points: Medium (150 points) - maintainer label: points-150-medium
PR must include:
Closes #26in the PR descriptionunwrap()in production Soroban contract paths (project convention)cargo testpasses locally; match CI (cargo fmt,cargo clippy -D warnings) when touching RustProblem
The escrow settlement flow currently has multiple areas where the intended semantics are not yet fully specified in docs:
amountinrecord_paymentrepresentsEscrowStatus::Settledshould relate to tokenization finalizationEscrowStatus::Refundedimpacts invoice tokens (burn/unlock/lock)Additionally, we already detected a stuck-funds edge case on underpayment (Issue 7), but the overall state-machine invariants still need formalization.
Proposed change
Create a state-machine invariants document for escrow + token:
Created -> Funded -> SettledandFunded -> RefundedAcceptance criteria
docs/state-machine.md(or similarly named file)docs/lifecycle.md(Issue 23)Dependencies