def calculate_token_distributions(geyser, geyserMock: BadgerGeyserMock, snapshotStartTime, periodEndTime): """ Tokens to Distribute: - get all distribution tokens - for each token, determine how many tokens will be distritbuted between the times specified - ((timeInClaimPeriod / totalTime) * initialLocked) """ digg = interface.IDigg(digg_token) distributionTokens = geyser.getDistributionTokens() for token in distributionTokens: geyserMock.add_distribution_token(token) unlockSchedules = geyser.getUnlockSchedulesFor(token) for schedule in unlockSchedules: if rewards_config.debug: console.log(schedule) console.print("Adding Unlock Schedule", token, schedule) modified = schedule if token == digg_token: # TEST: Convert to shares # diggSharesValue = schedule[0] modified = schedule # diggFragmentsValue = digg.sharesToFragments(diggSharesValue) # modified = (diggFragmentsValue, schedule[1], schedule[2], schedule[3]) geyserMock.add_unlock_schedule(token, modified) tokenDistributions = geyserMock.calc_token_distributions_in_range( snapshotStartTime, periodEndTime) userDistributions = geyserMock.calc_user_distributions(tokenDistributions) geyserMock.tokenDistributions = tokenDistributions geyserMock.userDistributions = userDistributions geyserMock.printState(userDistributions) return userDistributions
def calculate_token_distributions(geyser, geyserMock: BadgerGeyserMock, snapshotStartTime, periodEndTime): """ Tokens to Distribute: - get all distribution tokens - for each token, determine how many tokens will be distritbuted between the times specified - ((timeInClaimPeriod / totalTime) * initialLocked) """ distributionTokens = geyser.getDistributionTokens() for token in distributionTokens: geyserMock.add_distribution_token(token) unlockSchedules = geyser.getUnlockSchedulesFor(token) for schedule in unlockSchedules: console.log(schedule) geyserMock.add_unlock_schedule(token, schedule) tokenDistributions = geyserMock.calc_token_distributions_in_range( snapshotStartTime, periodEndTime) userDistributions = geyserMock.calc_user_distributions(tokenDistributions) geyserMock.tokenDistributions = tokenDistributions geyserMock.userDistributions = userDistributions # geyserMock.printState() return userDistributions