Skip to content

Implement invoice payment pooling #121

@Kingsman-99

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

Processing payments across many invoices individually wastes Stellar transaction fees. This issue adds pool_pay() accepting a Vec of (invoice_id, amount) pairs — all token transfers are batched into the minimum number of contract calls, reducing total fee cost for multi-invoice payers.

Technical Context

Involves lib.rs — new pool_pay(env, payer: Address, payments: Vec<(u64, i128)>). Require payer auth once. Compute total amount across all payments. Transfer total from payer to contract in one token_client.transfer(). Then distribute to each invoice using internal accounting without additional token transfers.

Acceptance Criteria

  • Single token transfer from payer regardless of number of invoices
  • Each invoice funded updated correctly
  • Any invalid payment (wrong status, over limit) reverts entire call
  • Auto-release triggers on any invoice that becomes fully funded
  • Test pools 3 invoice payments and verifies all funded amounts correct
  • All existing cargo tests pass
  • cargo clippy passes with zero warnings

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 pts

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