Skip to content

feat: implement transfer_subscription for ownership transition#528

Merged
orunganiekan merged 3 commits into
SiLioLabs:masterfrom
Abdullahi-Code9:feature/contract-40-transfer-subscription
Jun 27, 2026
Merged

feat: implement transfer_subscription for ownership transition#528
orunganiekan merged 3 commits into
SiLioLabs:masterfrom
Abdullahi-Code9:feature/contract-40-transfer-subscription

Conversation

@Abdullahi-Code9

Copy link
Copy Markdown
Contributor

Closes #495

Summary

Implements transfer_subscription as described in issue #495 (CONTRACT-40).

Changes

contract/src/errors.rs

  • Added SubscriptionAlreadyActive = 21 error variant
  • Added MerchantFrozen = 22 error variant

contract/src/events.rs

  • Added publish_subscription_transferred(env, old_user, new_user) emitting sub_transferred event

contract/src/lib.rs

  • Implemented transfer_subscription(env, user, new_user) with:
    • Contract pause check
    • Auth requirement on original user
    • Validation that caller has an active subscription
    • Validation that new user does not already have an active subscription
    • Storage move from old key to new key
    • TTL refresh on new user's subscription
    • Event emission

contract/src/test.rs

  • Added test_transfer_subscription_succeeds — verifies data is correctly moved to new user and removed from old user
  • Added test_transfer_subscription_to_active_user_panics — verifies transfer to an already-active address panics

Test Result

124/124 tests passing, 0 failing

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Abdullahi-Code9 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

@orunganiekan orunganiekan merged commit 6f25ae4 into SiLioLabs:master Jun 27, 2026
0 of 2 checks 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.

## [CONTRACT-40] Implement transfer_subscription Ownership Transition

2 participants