Repository navigation
Implement subscription contract for recurring creator key access - #1131
Conversation
|
@funds0033-cmyk 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! 🚀 |
|
1 similar comment
|
367853b to
ffc7943
Compare
Implemented a Soroban smart contract for recurring subscription payments to access creator-gated content, featuring automatic expiration calculation, seamless renewal extensions, and on-chain event emissions. Core Contract Methods: - subscribe(key_id, duration_days): Locks the subscription fee and sets the expiry timestamp based on the requested duration - renew_subscription(key_id): Extends the subscription expiry relative to the existing expiry timestamp - get_subscription(wallet, key_id): View function returning the active status flag, expiry timestamp, and calculated days_remaining - check_subscription(wallet, key_id): On-chain access control check queried by gated content contracts to verify valid subscriber status Event Emission: - Emits SubscriptionCreated and SubscriptionRenewed events containing wallet, key ID, and timestamp metadata Acceptance Criteria Verification: - subscribe sets correct expiry timestamp for duration - renew_subscription extends expiry correctly from current expiry - check_subscription returns false after expiry timestamp - get_subscription returns accurate days_remaining at any point - Both events emitted with correct wallet, key, and timestamp data Addresses issue accesslayerorg#1074 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ffc7943 to
a6ba621
Compare
✅ PR Ready for ReviewDue to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging. This PR has passed all automated checks:
Next step: Please share this PR link in our Telegram group so a maintainer can review and merge it: https://t.me/c/accesslayerorg/8514 |
-## Summary
Implemented a Soroban smart contract for recurring subscription payments to access creator-gated content, featuring automatic expiration calculation, seamless renewal extensions, and on-chain event emissions[cite: 15].
What Was Implemented
Core Contract Methods (
accesslayer-contracts):subscribe(key_id, duration_days): Locks the subscription fee and sets the expiry timestamp based on the requested duration[cite: 15].renew_subscription(key_id): Extends the subscription expiry relative to the existing expiry timestamp[cite: 15].get_subscription(wallet, key_id): View function returning the active status flag, expiry timestamp, and calculateddays_remaining[cite: 15].check_subscription(wallet, key_id): On-chain access control check queried by gated content contracts to verify valid subscriber status[cite: 15].Event Emission:
SubscriptionCreatedandSubscriptionExpiredevents containing wallet, key ID, and timestamp metadata[cite: 15].Acceptance Criteria Verification
subscribesets correct expiry timestamp for duration[cite: 15]renew_subscriptionextends expiry correctly from current expiry[cite: 15]check_subscriptionreturns false after expiry timestamp[cite: 15]get_subscriptionreturns accuratedays_remainingat any point[cite: 15]Closes #1074