How Do Subscriptions Work

This page details the mechanics of subscriptions within DegenHive, highlighting value propositions for subscribers and the control admins retain over their subscriber base.

When a HiveProfile is minted, the subscription costs are set to 0 updatable by the admin of the profile.

We form the struct AccessRecord, which contains a Unique HiveProfile Object ID, Access type and current price, and the timestamp for the next due payment.

```move
    /// - subscriber & subscribed_to: address - Address of the subscriber and the user subscribed to
    /// - is_active: bool - Boolean value indicating if the subscription is active or not
    /// - init_timestamp: u64 - Timestamp at which the subscription was initiated
    /// - access_type: u64 - Type of subscription: Tiered subscription - worker bee (base level access) | Drone Bee (mid level access) | queen bee (top level access)
    /// - access_cost: u64 - Cost of the subscription in HIVE gems
    /// - next_payment_timestamp: u64 - Timestamp at which the next payment is due
    /// - total_paid: u64 - Total amount paid for the subscription
    /// - to_unsubscribe: bool - If the user wants to unsubscribe at the end of this usbcription period
```
   struct AccessRecord has copy, store {
        subscriber: address, 
        subscribed_to: address,
        is_active: bool,
        init_timestamp: u64,
        // Tiered subscription - worker bee (base level access) 
        //      | Drone Bee (mid level access) | queen bee (top level access)
        // 1 =  worker bee
        // 2 =  drone bee
        // 3 =  queen bee
        // 4 = lifetime subscription (free)
        // 5 = to be canceleed 
        access_type: u8,
        access_cost: u64,
        next_payment_timestamp: u64,
        total_paid: u64,
        to_unsubscribe: bool
    }

Every HiveProfile thus has two lists of these structs, one for their subscriptions and one for their subscribers.


Subscription in HiveProfile

Each HiveProfile has the following structures associated with it

NameTypeDescription

subscription_plan

Table<u8, u64>

Stores (type <> price) for available access level pack.

subscribers_list

LinkedTable<address, SubscriptionRecord>

Stores the list of HiveProfile addresses subscribed to the user

subscriptions_list

LinkedTable<address, SubscriptionRecord>

Stores the list of HiveProfile addresses the user has subscribed to

Last updated