Skip to content

Add a batch buy function allowing a single transaction to purchase keys for up to 5 different creators #758

Description

@Chucks1093

Summary

Buying keys from multiple creators requires a separate transaction per creator. A batch_buy function accepting a vec of (key_id, quantity) pairs and processing all purchases atomically would reduce the number of transactions users need to sign.

Scope

  • Add a batch_buy(orders: Vec<(BytesN<32>, u32)>) function
  • Validate that the vec contains between 1 and 5 entries
  • Process each buy using the existing bonding curve logic in sequence
  • If any single buy fails (e.g. circuit breaker, lockup), panic the entire transaction
  • Emit a batch_buy_completed event listing all (key_id, quantity, price_paid) tuples

Acceptance Criteria

  • batch_buy with 5 valid orders processes all successfully
  • More than 5 orders panics with BatchSizeExceeded
  • Failure in any single order rolls back the entire batch
  • batch_buy_completed event lists all processed orders
  • Total XLM deducted matches the sum of all individual order costs

ETA: 24 hours


Coordinate on Telegram

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions