Description
Some fundraising invoices should only release if a minimum number of unique contributors participated, preventing a single whale from silently funding an invoice that was intended for broad community participation. This issue adds min_contributors: Option<u32> to invoices with enforcement at release time.
Technical Context
Add min_contributors: Option<u32> to the Invoice struct in types.rs and a contributor_count_key(invoice_id) -> u32 storage entry in lib.rs. Increment the counter in pay_invoice only for first-time payers on that invoice (check payment_exists_key(invoice_id, payer)). In release_invoice, if min_contributors is set and contributor_count < min_contributors, panic with InsufficientContributors.
Acceptance Criteria
Description
Some fundraising invoices should only release if a minimum number of unique contributors participated, preventing a single whale from silently funding an invoice that was intended for broad community participation. This issue adds
min_contributors: Option<u32>to invoices with enforcement at release time.Technical Context
Add
min_contributors: Option<u32>to theInvoicestruct intypes.rsand acontributor_count_key(invoice_id) -> u32storage entry inlib.rs. Increment the counter inpay_invoiceonly for first-time payers on that invoice (checkpayment_exists_key(invoice_id, payer)). Inrelease_invoice, ifmin_contributorsis set andcontributor_count < min_contributors, panic withInsufficientContributors.Acceptance Criteria
create_invoiceaccepts optionalmin_contributorsrelease_invoicepanics withInsufficientContributorsif count below thresholdget_contributor_count(env, invoice_id) -> u32view function exposedmin_contributorsrelease with no count check (existing behaviour)