Complexity / points: Medium (150 points) - maintainer label: points-150-medium
PR must include:
Problem
The contracts (invoice-escrow, invoice-token, payment-distributor) are present, but there is no single canonical document that explains the intended end-to-end invoice lifecycle:
- which contract calls which
- which token/currency each step uses (
payment_token vs invoice-token)
- what state transitions are expected (escrow status + token lock/unlock)
- where fees are applied
As a result, contributors must infer behavior from Rust code and scattered README text, which increases misaligned implementations.
Proposed change
Add a “single source of truthâ€^] lifecycle architecture doc under docs/.
What this doc must include
- Actors/roles (admin/platform, seller, buyer/investor/payer)
- Step-by-step flow with call sequences and parameters:
invoice-escrow::create_escrow
invoice-escrow::fund_escrow
invoice-escrow::record_payment
invoice-escrow::refund
- how/when
invoice-token is minted, locked/unlocked, transferred/burned
- how/when
payment-distributor is invoked and what it distributes
- Cross-contract wiring constraints:
- how
invoice-token’s minter relates to invoice-escrow
- meaning of
EscrowStatus::Created/Funded/Settled/Refunded
- expected invariants (what balances must exist at each step)
- Events and error mapping: list major events to expect and which errors should be raised
- An explicit “Open Questions / Assumptionsâ€^] section for undecided areas
Acceptance criteria
Dependencies
None (this issue unblocks later integration issues).
Complexity / points: Medium (150 points) - maintainer label: points-150-medium
PR must include:
Closes #23in 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 contracts (
invoice-escrow,invoice-token,payment-distributor) are present, but there is no single canonical document that explains the intended end-to-end invoice lifecycle:payment_tokenvsinvoice-token)As a result, contributors must infer behavior from Rust code and scattered README text, which increases misaligned implementations.
Proposed change
Add a “single source of truthâ€^] lifecycle architecture doc under
docs/.What this doc must include
invoice-escrow::create_escrowinvoice-escrow::fund_escrowinvoice-escrow::record_paymentinvoice-escrow::refundinvoice-tokenis minted, locked/unlocked, transferred/burnedpayment-distributoris invoked and what it distributesinvoice-token’sminterrelates toinvoice-escrowEscrowStatus::Created/Funded/Settled/RefundedAcceptance criteria
docs/lifecycle.md(or similarly named file)docs/API.md(once it exists) and/orReadme.mdDependencies
None (this issue unblocks later integration issues).