-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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 referralcreate_user should get an optionalreferrerargument- 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:
referral_reward_fraction - this is the fraction of the referred user's gained reputation or tokens that should be rewarded to the referrer.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
Metadata
Metadata
Assignees
Labels
No labels