-
Notifications
You must be signed in to change notification settings - Fork 33
optimization: Batch event emissions for multi-hop trades #90
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave program
Description
Description
When a user executes a 3-hop trade (e.g., Asset A -> Asset B -> Asset C), our current logic emits a separate SwapEvent for every single hop.
Publishing multiple events to the Stellar ledger in a single transaction burns unnecessary gas and forces our indexer to reconstruct the final trade manually.
We need to aggregate the overall input and final output into a single, unified MultiHopSwap event.
This saves users money on ledger rent and simplifies our backend data architecture.
Requirements
- Define a new event topic
Symbol("MultiHopSwap"). - In the
swap_exact_tokens_for_tokensfunction, track the initialamount_inand the finalamount_out. - Publish a single event at the very end of the routing loop instead of inside the loop.
- Ensure the event payload includes the full
Vec<Address>path that the trade took.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave program