• A refers B to deva via referral link
  • send a % for karma purchase by B via stripe / usdc to A
  • deva creators set a referral % to send to referrers
    • for 12000 paid interactions by B, A receives the % profit margin set by Deva Creator
  • show notification everytime karma is received
  • leaderboard
  • ore nft for refers raffle
  • gem mint %?
  • ore nft raffles are based on levels for invites

Referral System Specification

Introduction

  1. Referral system is designed to incentivize the users to invite their friends to the platform for a monetary benefit
  2. It also incentivizes a new user to use a referral link for free credits ( karma ) on the platform.
  3. Referral can only happen once on sign-up, and gamifies it by having a leaderboard to create competition & incentives based on the levels
  4. Users can earn a % of the profit margin for interactions done by the referred users upto 12000 interactions

Referral Economics

  1. When user B uses the referral link of user A to sign up:
    • % of the karma purchase made by user B (through stripe / usdc) is sent to user A as a referral bonus.
    • note: the exact % has to be discussed
  2. upto 12,000 (refer to earn enabled) deva interactions made by the referred user (user B):
    • User A (referrer) recieves karma calculated as a % of the profit margin of the deva creator.
    • The deva creator gets 50% of the profit from what user A pays for the interaction, of which they can choose to give a % to the referrer

System Features

  • Each user has a unique referral link associated with their account.
  • Users can easily copy and share this link.
  • ❗abandoned for alpha invites

Email Invites (❗for alpha invites only )

  • Each user is given a limited number of email invites.
  • Users can send invites directly from the app to their friends’ email addresses.
  • Pre-Unwaitlist the invites emails
  • We can send invites and grant user more invites through retool.

Referral Tracking

  • The total number of users referred by a user is stored.
  • The total number of paid interactions by the referred users is stored.
  • Leaderboard data for karma earned via referrals and users invited is stored.

Karma Bonus Allocation

  • For every karma purchase by the referred user, the referrer gets a percentage as a bonus.
  • For every 12,000 paid interactions by the referred user, the referrer receives a bonus based on the set percentage of the profit margin.

Notifications

  • An aggregated notification is sent to the referrer per day on how much they’ve earned from each referral
  • example:
    • your referral @jinay has had 36 deva interaction and you receive 4000 karma
    • your referral @dhravyya has had 36 deva interaction and you receive 4000 karma

Referral System Table

why it needs it’s own table? my reasoning is that a separate referral table would be a good idea to keep track of referral relations and relevant statistics without cluttering the main user table.

User ( Human ) modifications:

  • referred_by - userid of the user who referred
    • null | user_id
    • redudant but easier to access
  • first_karma_purchase_done - default false, true after the first purchase of karma
    • check if true while allotting % share for referred_by
  • total_referred_users - number of people referred
    • note: will this be needed? cuz we can just query referrals table for referred_id and get the count
  • email_invites_left to store the number of invites a user can still send.

Karma modifications:

  • transaction_type new enum values: REFERRAL_KARMA_SHARE, REFERRAL_DEVA_SHARE

Referrals

  • id
  • referrer_id - the user who referred and who will receive the karma
  • referred_user_id - the user who was referred
  • total_deva_interactions - (0-12000) incremental value for the check during karma profit split on deva request

Deva

  • profit margin:
    • referral_profit_percent: 0-100 to store the % given to the referrer from the creator’s share

Dev tasks or functions to update/write

  • sendEmailInvite
    • deduct one from email_invites_left
    • unwaitlist the invited user and register them ( creating the referral relation )
  • registerUser
    • if link has referral code, create a new row with referral data
  • purchaseKarma
    • check if first purchase and if user was referred by someone
      • if yes, send % of karma to be received to referred_by
      • call rewardReferredOnPurchase
  • rewardReferrerOnPurchase
    • input: referrer_id, referred_user_id, purchase_amount
    • updates karma balances for referrer based on purchase amount and the reward %
  • deva interaction
    • update karma balance
    • if refer to earn enabled, get % set by the creator from referral_profit_percent and update referrer karma balance
    • log deva interaction
  • getUserReferralStats
    • will be used in leaderboard™ and Ore NFT raffle system™
    • fetches all referral stats
      • total referred
      • karma earned from referrals etc
  • grantMoreInvites (retool util function)
    • can grant more email invites to a user
    • update the email_invites_left for that user