Repository navigation
feat: add atomic slippage-protected multi_buy for creator keys - #1082
Open
Vhickcrypt150-pixel wants to merge 1 commit into
Conversation
|
@Vhickcrypt150-pixel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a slippage-protected
multi_buyfunction that atomically purchases keys across multiple creators in a single Soroban transaction with all-or-nothing semantics. It adds the new event types needed for per-leg and completion events, plus unit/integration tests covering the atomicity, validation, and slippage guarantees described in the issue.Related Issue
Changes
🔀 Multi-Buy Events
creator-keys/src/events.rsKeyPurchasedevent (reusing the existing single-buy event format) and a singleMultiBuyCompletedevent carryingbuyer,leg_count,total_cost, andledger.MultiBuyCompletedemitted only after all legs succeed.🧪 Tests
creator-keys/src/test_issues.rsmax_price— all three creators' supplies increment and events are emitted.max_price— all three creators' supplies remain unchanged (full rollback).duplicate_creator.too_many_legs.global_deadline_ledgerin the past — panics withdeadline_passed.insufficient_fundsbefore any supply is mutated.Verification Results
max_pricemax_priceMultiBuyCompletedevent emitted only when all legs succeedduplicate_creatorandtoo_many_legspanics covereddeadline_passedpanic coveredinsufficient_fundspanic before any supply mutationCloses #717