Skip to content

feat: add key subscription tiers with on-chain access gating - #1199

Open
Ecruise-hub wants to merge 3 commits into
accesslayerorg:mainfrom
Ecruise-hub:feat/issue-1179-add-key-subscription-tier-management-with
Open

Ecruise-hub wants to merge 3 commits into
accesslayerorg:mainfrom
Ecruise-hub:feat/issue-1179-add-key-subscription-tier-management-with

Conversation

@Ecruise-hub

Copy link
Copy Markdown
Contributor

Overview

This PR adds subscription tier management to the key contract, letting creators define access tiers with per-tier fees and expiry periods, and exposing an on-chain subscription check that external contracts can query. Subscription fees are credited to the creator earnings ledger, and renewals extend from the current expiry rather than from now.

Related Issue

Changes

📈 Subscription Tier Management

  • [MODIFY] creator-keys/src/events.rs

    • Adds event emissions for tier creation and subscription activity so tier config and subscription state changes are observable on-chain.
  • [MODIFY] creator-keys/src/curve_subscriptions_swaps.rs

    • Implements create_tier(key_id, tier_id, fee_per_period, period_seconds, label) to store tier configuration.
    • Implements subscribe(key_id, tier_id) to transfer the tier fee and record a subscription with an expiry timestamp.
    • Implements is_subscribed(key_id, wallet, tier_id) to return whether a wallet is within an active subscription window.
    • Renewal extends expiry from max(now, current_expiry) + period_seconds.
    • Credits subscription fees to the creator earnings ledger.

Verification Results

cargo test -p creator-keys
✅ tier creation, subscribe, is_subscribed, renewal, and earnings credit paths covered
Acceptance Criteria Status
Tier creation stores correct fee and period configuration ✅ create_tier persists fee, period, and label
subscribe transfers correct fee and records accurate expiry ✅ Fee transferred and expiry set from period
is_subscribed returns true only within active subscription window ✅ Returns bool based on current expiry
Renewal extends expiry correctly from current expiry, not from now ✅ Extends from max(now, current_expiry)
Subscription fees credited accurately to creator earnings ✅ Fees credited to creator earnings ledger

Closes #1179

@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@Ecruise-hub 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

Copy link
Copy Markdown
Member

⚠️ Merge Conflict Detected

This PR currently has a merge conflict and cannot be merged until it is resolved.

Please rebase or merge the latest changes from the base branch into your branch and push again.

1 similar comment
@Chucks1093

Copy link
Copy Markdown
Member

⚠️ Merge Conflict Detected

This PR currently has a merge conflict and cannot be merged until it is resolved.

Please rebase or merge the latest changes from the base branch into your branch and push again.

Ecruise-hub added a commit to Ecruise-hub/accesslayer-contracts that referenced this pull request Oct 24, 2026
Ecruise-hub added a commit to Ecruise-hub/accesslayer-contracts that referenced this pull request Oct 24, 2026
@Ecruise-hub
Ecruise-hub force-pushed the feat/issue-1179-add-key-subscription-tier-management-with branch from f4d8782 to 0c1172d Compare October 24, 2026 10:12
Ecruise-hub added a commit to Ecruise-hub/accesslayer-contracts that referenced this pull request Oct 24, 2026
@Ecruise-hub
Ecruise-hub force-pushed the feat/issue-1179-add-key-subscription-tier-management-with branch from 0c1172d to fcc6afd Compare October 24, 2026 10:13
@Ecruise-hub
Ecruise-hub force-pushed the feat/issue-1179-add-key-subscription-tier-management-with branch from fcc6afd to 55bfeaf Compare October 24, 2026 11:28
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 key subscription tier management with access gating on-chain

2 participants