Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement referral logic (partly done, to implement TIMEFRAME) #6

Open
jellegerbrandy opened this issue Apr 17, 2016 · 2 comments
Open

Comments

@jellegerbrandy
Copy link
Contributor

jellegerbrandy commented Apr 17, 2016

https://trello.com/c/XvBbXnjS/1-specify-referral-logic

x% out of reputation and tokens awarded to referral in time frame y from registration on top of ...
x = 10%, y = 1 month.
In a further version x can depend inversely on some measure of engagement such as the amount of reputation/tokens created via contributions.

Todo for this:

  • extend User model with a "referrer" - which is the id of the user that has given the referral
  • create_user should get an optional referrer argument
  • need to check that the referrer is an existing user in the DB, upon creation of the new user and in every action involving the referrer.
  • (the API should be correspondingly extended)
  • add contract parameters:
  1. referral_reward_fraction - this is the fraction of the referred user's gained reputation or tokens that should be rewarded to the referrer.
  2. referral_timeframe - this is the time frame in which after a new user has been created following a referral the referrer will be rewarded for the referred user's consensused contributions.
  • caclulate payout to referrer when user is awarded tokens and reputation following a consensused contribution.
    if time_since_referred_user_created <= referral_timeframe
    referrer_reputation_reward = referral_reward_fraction * earned_reputation
    referrer_token_reward = referral_reward_fraction * earned_tokens
  • it should be noted that what the referrer gets is not at the expense of the referred, i.e. the referred does not need to pay the referrer.

neet to update pseudocode:

In pseudocode:

def create_evaluation(...):
      ...
     reward_previous_evaluations
     reward_contributor

     for user in previous_evaluators + [contributor]:
          user_rep_reward_delta  = soething # the rewards the user has gotten as a contributor or prev evaluator
          if datetime.now() - user.creation_time <= self.REFERAL_TIMEFRAME:
             if user.referrer:
                   user.referrer += self.REFERAL_REWARD * user_rep_reward_delta
     # and hte same for evaluation
@jellegerbrandy jellegerbrandy changed the title implement referall logic implement referral logic Apr 17, 2016
@elad-shtilerman
Copy link
Contributor

  • question: when does the payout happen? proposal: on any call to create_evaluation, also these payouts are calculated an assigned (up to Y days after the referred user was created)
  • answer in the first version, we want the inviters to get x% only out of rewards for consensused contirbutions and not from earned reputation during evaluations.
  • question: how are the payout calculated? Is it: referrer gets 10% of all payouts of the referral? And which payouts count?
  • answer so only payouts for consensused contributions count.
  • question: we have one value for X, or we want to have an "x" for tokens and one for rep?
  • answer: for the first working version we can leave it at a uniform 10% for both token and rep and afterwards refine it.

@jellegerbrandy
Copy link
Contributor Author

this is implemented now, but without taking into account the TIMEFRAME

@jellegerbrandy jellegerbrandy changed the title implement referral logic implement referral logic (partly done, to implement TIMEFRAME) Apr 25, 2016
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

No branches or pull requests

2 participants