Skip to content

feat(creator-keys): add atomic bundle purchase for multiple keys (#1057) - #1083

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
KingDavid9999:fixes-issue-#1057
Oct 18, 2026
Merged

Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
KingDavid9999:fixes-issue-#1057

Conversation

@KingDavid9999

Copy link
Copy Markdown
Contributor

Add bundle_buy and get_bundle_quote so a buyer can purchase several
creator keys in one transaction that succeeds or reverts as a unit.

  • bundle_buy(buyer, items: [{key_id, amount, max_price}]) runs every
    item through the shared buy logic; any failing item, including one
    that exceeds its max_price, reverts the whole bundle
  • Emit BundleExecuted with a per-item breakdown (key_id, amount,
    price_paid) and the total cost
  • get_bundle_quote(items) returns estimated cost and price impact
    (bps) per item, plus the total
  • Reject bundles with more than 10 items (BundleSizeExceeded)
  • Add BundleItemUnfilled so a partial fill caused by a supply or
    wallet cap reverts the bundle instead of succeeding short

Refactor buy_keys_with_ref_and_slip into a public wrapper that calls
require_auth and an internal buy_keys_core that returns the keys
bought and total price. Behavior of existing buy paths is unchanged.

Tests: bundle_buy.rs covers full success, event breakdown, revert on
slippage / unregistered key / supply cap, quote vs execution
accuracy, price impact, and the 10-item limit.

Closes #1057

…esslayerorg#1057)

Add bundle_buy and get_bundle_quote so a buyer can purchase several
creator keys in one transaction that succeeds or reverts as a unit.

- bundle_buy(buyer, items: [{key_id, amount, max_price}]) runs every
  item through the shared buy logic; any failing item, including one
  that exceeds its max_price, reverts the whole bundle
- Emit BundleExecuted with a per-item breakdown (key_id, amount,
  price_paid) and the total cost
- get_bundle_quote(items) returns estimated cost and price impact
  (bps) per item, plus the total
- Reject bundles with more than 10 items (BundleSizeExceeded)
- Add BundleItemUnfilled so a partial fill caused by a supply or
  wallet cap reverts the bundle instead of succeeding short

Refactor buy_keys_with_ref_and_slip into a public wrapper that calls
require_auth and an internal buy_keys_core that returns the keys
bought and total price. Behavior of existing buy paths is unchanged.

Tests: bundle_buy.rs covers full success, event breakdown, revert on
slippage / unregistered key / supply cap, quote vs execution
accuracy, price impact, and the 10-item limit.

Closes accesslayerorg#1057
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@KingDavid9999 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! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit 1f5cf83 into accesslayerorg:main Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build atomic bundle purchase contract for multiple creator keys in one transaction

2 participants