Overview
Support invoices where funds are released in scheduled tranches rather than all at once. Contributors or clients can structure milestone-based payments with a cliff (nothing released until a date) followed by periodic tranches.
Requirements
- Extend
InvoiceOptions with tranches: Option<Vec<Tranche>> where Tranche { release_time: u64, bps: u32 } (basis points of total)
bps across all tranches must sum to exactly 10000 (validated at creation)
release_tranche(env, invoice_id, tranche_index) entry point — releases one tranche if current time ≥ its release_time and invoice is fully funded
- Store released tranche indices to prevent double-release
- Emit
TrancheReleased { invoice_id, tranche_index, amount } event
- Write tests: full vesting schedule, attempt release before time panics, double-release panics, bps not summing to 10000 panics at creation
Acceptance Criteria
Definition of Done
All CI checks must pass before the PR is reviewed.
Overview
Support invoices where funds are released in scheduled tranches rather than all at once. Contributors or clients can structure milestone-based payments with a cliff (nothing released until a date) followed by periodic tranches.
Requirements
InvoiceOptionswithtranches: Option<Vec<Tranche>>whereTranche { release_time: u64, bps: u32 }(basis points of total)bpsacross all tranches must sum to exactly 10000 (validated at creation)release_tranche(env, invoice_id, tranche_index)entry point — releases one tranche if current time ≥ itsrelease_timeand invoice is fully fundedTrancheReleased { invoice_id, tranche_index, amount }eventAcceptance Criteria
cargo test --workspacepasses with zero failurescargo clippy --all-targets -- -D warningsproduces zero warningsDefinition of Done
All CI checks must pass before the PR is reviewed.