Skip to content

feat(contracts): implement content license registry with purchase and revocation (#397, #398) - #414

Closed
nuvoraxis wants to merge 1 commit into
MindFlowInteractive:mainfrom
nuvoraxis:feat/397-398-content-license-purchase-revocation
Closed

nuvoraxis wants to merge 1 commit into
MindFlowInteractive:mainfrom
nuvoraxis:feat/397-398-content-license-purchase-revocation

Conversation

@nuvoraxis

Copy link
Copy Markdown

Summary of Changes

This Pull Request provides a comprehensive, production-grade Soroban smart contract for Puzzle Content Licensing across Stages 1 and 2, fulfilling all acceptance criteria for both #397 and #398:

  1. Versioned License Terms Registry (Stage 1 - Content License Registry #397):

    • Implements LicenseTerms structure supporting FreeToPlay, PaidPerPlay, and RemixAllowed.
    • Creator-only registration enforcing immutable historical versions: each update increments version while preserving historical records.
    • Terms specify fee token, fee amount, validity duration, revocation policy, and refund rules.
    • Exposes read functions for get_current_terms and get_terms_by_version.
  2. License Purchase with Creator Fee Routing (Stage 2 - Content License Purchase and Revocation #398):

    • purchase_license: allows players to purchase licenses under current puzzle terms.
    • Automatically transfers stated fee amount to the puzzle creator via soroban_sdk::token::Client.
    • Records LicenseGrant bound strictly to the specific terms version bought.
    • Supports duration-based expiry calculation.
  3. Policy-Based Revocation with Automated Refunds (Stage 2 - Content License Purchase and Revocation #398):

    • revoke_license: creator can revoke an active license grant only if the terms under which it was purchased allow revocation (RevocationNotAllowed error otherwise).
    • If terms mandate refund on revocation, the contract automatically transfers the purchase fee back from creator to player.
    • Prevents double-revocation (AlreadyRevoked error).
    • View function is_license_active validates non-revoked and non-expired state.
  4. Testing & Tooling:

    • 5/5 unit tests in src/test.rs passing with 100% success (covering immutability, versioning, purchases with payment, policy-enforced revocation, refunds, and expiration).
    • Clean workspace integration in root Cargo.toml.
    • Architectural documentation in contracts/content_license/README.md.

Closes #397
Closes #398

… revocation (MindFlowInteractive#397, MindFlowInteractive#398)

- Add modular Soroban smart contract in contracts/content_license
- Implement versioned immutable license terms registry with creator authentication
- Support configurable license terms: FreeToPlay, PaidPerPlay, and RemixAllowed
- Support token fee specification, validity duration, revocation policy, and refund rules
- Implement purchase_license: pays creator stated fee and creates immutable license grant bound to terms version bought
- Implement revoke_license: creator-only revocation strictly enforcing terms policy (disallowing if terms prohibit)
- Implement automatic fee refund to player on revocation when terms require
- Implement license validity view is_license_active checking revocation and expiration
- Add unit test suite in src/test.rs covering terms immutability, purchase with payment, revocation policy, refunds, and expiration
- Add README.md documentation and workspace entry in Cargo.toml

Closes MindFlowInteractive#397
Closes MindFlowInteractive#398
@Mkalbani Mkalbani closed this Nov 22, 2026
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.

Content License Purchase and Revocation Content License Registry

2 participants