Skip to content

feat: add per-wallet buy cooldown (#issue) - #852

Merged
Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
Moh-dakai:feat/per-wallet-buy-cooldown
Sep 5, 2026
Merged

feat: add per-wallet buy cooldown (#issue)#852
Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
Moh-dakai:feat/per-wallet-buy-cooldown

Conversation

@Moh-dakai

Copy link
Copy Markdown
Contributor

What was added in this single commit:

  • CooldownError enum with CooldownActive, CooldownTooLong, NotRegistered
  • MAX_BUY_COOLDOWN_LEDGERS = 720
  • LastBuyLedger and BuyCooldown DataKey variants + storage accessors
  • Cooldown enforcement inside buy_key (check before settlement, emit cooldown_blocked event, return CooldownActive)
  • last_buy_ledger written on every successful buy
  • set_buy_cooldown and get_buy_cooldown entrypoints
  • CooldownBlockedEvent + cooldown_blocked_topics in events.rs
  • Full test suite in tests/buy_cooldown.rs covering all 5 acceptance criteria

closes #830

ELKorede and others added 5 commits September 4, 2026 17:52
- Add CooldownError enum (CooldownActive, CooldownTooLong, NotRegistered)
- Add MAX_BUY_COOLDOWN_LEDGERS constant (720 ledgers ≈ 1 hour)
- Add LastBuyLedger(Address, Address) and BuyCooldown(Address) DataKey variants
- Add constants::storage::last_buy_ledger() and buy_cooldown() accessors
- Enforce cooldown in buy_key: rejects with CooldownActive and emits
  cooldown_blocked event (wallet, creator_id, ledgers_remaining)
- Write last_buy_ledger on every successful buy
- Add set_buy_cooldown entrypoint (creator-only, 0–720 range)
- Add get_buy_cooldown read-only view
- Add CooldownBlockedEvent and cooldown_blocked_topics to events.rs
- Add full integration test suite in tests/buy_cooldown.rs covering all ACs
- Add CooldownActive = 36 to ContractError enum (was missing, gap between 35 and 37)
- Remove duplicate RoyaltyConfig and CurveExponent from DataKey enum
- Add missing DataKey variants: StakePosition, StakingRewardsPool,
  CreatedAtLedger, LaunchPenaltyBps, StakeUnlockLedger, TotalStaked, AuctionConfig
- Remove duplicate holder_cap_bps and last_buy_timestamp storage fns
- Add missing storage fns: total_staked, stake_unlock_ledger, auction_config
- Add AuctionPurchaseEvent and auction_purchase_topics to events.rs
@Chucks1093
Chucks1093 merged commit 3968e58 into accesslayerorg:main Sep 5, 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.

Add a cooldown period between consecutive buys by the same wallet to prevent bot-driven accumulation

3 participants