Skip to content

feat: fix creator key cooldown - #1043

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Stanley-Owoh:fix-creator-key-cooldown-877
Oct 17, 2026
Merged

Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Stanley-Owoh:fix-creator-key-cooldown-877

Conversation

@Stanley-Owoh

Copy link
Copy Markdown
Contributor

Summary

Implement server-side buy cooldown enforcement middleware for creator key purchases to prevent wallets from purchasing the same key again before the configured cooldown period expires.

The middleware checks the wallet's cooldown status before allowing a purchase to proceed, uses Redis for efficient cooldown tracking, and falls back to a database check if Redis is unavailable.

Changes Made

  • Cooldown enforcement: Check whether a wallet is still within its cooldown period before processing a creator key purchase.
  • Redis-based tracking: Store cooldown expiry timestamps in Redis using a key composed of the wallet address and creator key ID.
  • Configurable cooldown duration: Read the cooldown duration for each creator key from its contract metadata.
  • Rate-limit response: Reject purchases during an active cooldown with HTTP 429 Too Many Requests, including cooldown_expires_at in the response.
  • Cooldown initialization: Set the appropriate cooldown expiry after a successful purchase.
  • Database fallback: Fall back to checking the database for existing cooldown information when Redis is unavailable, ensuring cooldown enforcement remains reliable.

Acceptance Criteria

  • Purchase requests are rejected with HTTP 429 when the wallet is within its cooldown period.
  • Rejection responses include the cooldown_expires_at timestamp.
  • Cooldown expiry is set correctly after a successful purchase.
  • Cooldown duration is retrieved from the creator key's contract metadata.
  • Database fallback is supported when Redis fails.

Expected Outcome

Creator key purchases are protected by consistent server-side cooldown enforcement, preventing wallets from bypassing configured purchase restrictions while maintaining reliable behavior during Redis failures.

Closes #877

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Stanley-Owoh 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 bed254f into accesslayerorg:main Oct 17, 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 buy cooldown enforcement middleware for creator key purchases

2 participants