Skip to content

Minimum Recipient Count Enforcement Per Invoice #526

Description

@Kingsman-99

Description

An invoice with a single recipient is effectively a direct payment and does not benefit from the splitting infrastructure. The contract should enforce a configurable minimum number of recipients per invoice to ensure the feature is used appropriately.

Technical Context

Store MinRecipientsPerInvoice: u32 in storage::instance in contracts/split/src/lib.rs. In create_invoice, count the entries in the recipients vector and compare against the minimum. Return TooFewRecipients { found: u32, min: u32 } (new error in types.rs) when below threshold. Admin method set_min_recipients allows updating the floor.

Acceptance Criteria

  • Invoices with fewer recipients than the minimum are rejected with TooFewRecipients
  • MinRecipientsPerInvoice defaults to 2 at deployment
  • Admin can lower the minimum to 1 for single-recipient use cases
  • TooFewRecipients error carries both found and min values for client display
  • MinRecipientsUpdated(new_min) event is emitted from events.rs on admin change
  • All CI checks (cargo build --target wasm32-unknown-unknown, cargo test, cargo clippy) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions