Skip to content

Implement dynamic recipient management with cap, replacement, and weighted voting #163

@Kingsman-99

Description

@Kingsman-99

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

  • InvoiceOptions accepts max_recipients: Option<u32>create_invoice panics with "exceeds max recipients" if violated
  • Add propose_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 creator
  • Add approve_recipient_replacement(approver: Address, invoice_id: u64, old_recipient: Address) — records approval; executes replacement when approval count >= required_signatures (reuses existing co-signer threshold)
  • On replacement execution: the new recipient inherits the exact amounts slot of the old recipient; any already-claimed amounts are preserved and non-claimable by the new recipient
  • Replacement is blocked if invoice status is not Pending
  • Replacement is blocked if the invoice uses drip_duration (stream invoices are immutable)
  • get_invoice reflects the updated recipients list after replacement
  • Test test_recipient_replacement_requires_quorum — replacement blocked until threshold met
  • Test test_recipient_replacement_preserves_claimed_amounts — already-claimed slot is not re-claimable
  • Test test_recipient_replacement_blocked_on_released_invoice
  • Test test_recipient_cap_enforced_at_creation

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)

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or requestgood first issueGood for newcomersgrantfoxIssue for GrantFox program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions