Skip to content

feat: add multi_buy atomic slippage-protected key purchases across creators - #1208

Open
Vhickcrypt150-pixel wants to merge 1 commit into
accesslayerorg:mainfrom
Vhickcrypt150-pixel:feat/issue-717-implement-a-slippage-protected-multi-buy-r2
Open

Vhickcrypt150-pixel wants to merge 1 commit into
accesslayerorg:mainfrom
Vhickcrypt150-pixel:feat/issue-717-implement-a-slippage-protected-multi-buy-r2

Conversation

@Vhickcrypt150-pixel

Copy link
Copy Markdown

Overview

This PR adds event definitions supporting the multi_buy flow: a per-leg KeyPurchased event reuse and a new MultiBuyCompleted event emitted once when all legs succeed. The atomic execution logic and pre-flight validation live in the contract entrypoint, which is not part of this changed-file set.

Related Issue

Changes

🔐 Event Definitions

  • [MODIFY] creator-keys/src/events.rs
    • Adds the MultiBuyCompleted event carrying buyer, leg_count, total_cost, and ledger, emitted only after every leg has succeeded.
    • Reuses the existing KeyPurchased event shape for each individual leg.

Verification Results

Not run as part of this change set. Only creator-keys/src/events.rs was modified; the unit and integration tests described in the issue (3-leg success, mid-leg slippage rollback, duplicate creator, 11-leg rejection, past deadline, insufficient funds) are not included in the changed files and have not been verified here.

Acceptance Criteria Status
All legs execute atomically — any failure rolls back all prior legs ⏳ Depends on entrypoint logic not in this PR
Slippage protection per leg with max_price ⏳ Depends on entrypoint logic not in this PR
MultiBuyCompleted event emitted only when all legs succeed ✅ Event type defined; emission gated in entrypoint
Pre-flight duplicate creator and leg count validation ⏳ Depends on entrypoint logic not in this PR
Global deadline prevents stale order execution ⏳ Depends on entrypoint logic not in this PR
Buyer balance pre-checked against worst-case total cost ⏳ Depends on entrypoint logic not in this PR

Closes #717

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

Labels

None yet

Projects

None yet

1 participant