Description
Extend the invoice recipient system to support: a creator-defined recipient cap, post-creation recipient replacement (with co-creator approval voting), and weighted recipient shares that are recalculated on replacement.
Acceptance Criteria
Context
- Co-signer approval pattern is in
sign_release (~line 1794 in lib.rs)
claimed Vec on Invoice tracks which recipients have claimed
InvoiceExt in types.rs is the right place for proposal storage references
- All storage keys must use
symbol_short! (max 9 chars)
Description
Extend the invoice recipient system to support: a creator-defined recipient cap, post-creation recipient replacement (with co-creator approval voting), and weighted recipient shares that are recalculated on replacement.
Acceptance Criteria
InvoiceOptionsacceptsmax_recipients: Option<u32>—create_invoicepanics with"exceeds max recipients"if violatedpropose_recipient_replacement(proposer: Address, invoice_id: u64, old_recipient: Address, new_recipient: Address)— stores proposal in persistent storage, requires proposer to be a co-creator or creatorapprove_recipient_replacement(approver: Address, invoice_id: u64, old_recipient: Address)— records approval; executes replacement when approval count >=required_signatures(reuses existing co-signer threshold)amountsslot of the old recipient; any already-claimed amounts are preserved and non-claimable by the new recipientPendingdrip_duration(stream invoices are immutable)get_invoicereflects the updated recipients list after replacementtest_recipient_replacement_requires_quorum— replacement blocked until threshold mettest_recipient_replacement_preserves_claimed_amounts— already-claimed slot is not re-claimabletest_recipient_replacement_blocked_on_released_invoicetest_recipient_cap_enforced_at_creationContext
sign_release(~line 1794 inlib.rs)claimedVec on Invoice tracks which recipients have claimedInvoiceExtintypes.rsis the right place for proposal storage referencessymbol_short!(max 9 chars)