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

(Feature) Top delegates #39

Merged
merged 28 commits into from
Jul 2, 2019
Merged

(Feature) Top delegates #39

merged 28 commits into from
Jul 2, 2019

Conversation

Agupane
Copy link
Contributor

@Agupane Agupane commented Jun 11, 2019

Depends on #41
Depends on #42
Closes #58

Description

Let the user to get the top "x" transcoders based on their ROI value

ROI Calculation:

Represent the amount of LPT that a delegator will obtain each round he bonds to a delegator.
The return of investments (ROI) is calculated always for the next round. It's calculated using a totalBonded stake of 1000, so, it's the value that a delegator will obtain for the next round is he bonds 1000 LPT to that transcoder

ROI = rewardsToDelegatorsForNextRound*delegatorParticipationInBondedStakeRatio

RewardsToDelegatorsForNextRound = delegateRewardsForNextRound * (1-delegateRewardCut)

DelegateRewardsForNextRound = mintedTokensForNextRound * delegateParticipationInTotalBonded

Example:

http://localhost:4040/api/delegates/top/5

Result:
[
    {
        "id": "0xf1ee89810f4441b025d2d42ff58a0cdc4d797310",
        "totalStake": "692281940372333711643",
        "roi": "80.98202110272603210234"
    },
    {
        "id": "0xcfa2a70fdf74ebda788eeb1498425ceb0630e1cb",
        "totalStake": "5088712707818879776558",
        "roi": "58.92400408443955878542"
    },
    {
        "id": "0x345551571c5ef20111c6168b9a498dfb836e7c09",
        "totalStake": "41434955154102026869031",
        "roi": "5.31439249639314928832"
    },
    {
        "id": "0xdac817294c0c87ca4fa1895ef4b972eade99f2fd",
        "totalStake": "48559774660215370973441",
        "roi": "4.47921732786657223192"
    },
    {
        "id": "0xbd91c9df3c30f0e43b19b1dd05888cf9b647b781",
        "totalStake": "83835447024235519002350",
        "roi": "3.62773631538480508463"
    }
]

@Agupane Agupane added the Blocked Blocked by something external to the team label Jun 11, 2019
@Agupane Agupane self-assigned this Jun 11, 2019
@Agupane Agupane added the invalid This doesn't seem right label Jun 19, 2019
@Agupane Agupane changed the base branch from master to development June 24, 2019 18:31
# Conflicts:
#	server/delegate/delegate.controller.js
#	server/helpers/delegate.js
Fixs sorting of top delegates
Fixs inflationRate fn call
@Agupane Agupane removed the invalid This doesn't seem right label Jun 25, 2019
@Agupane Agupane removed the Blocked Blocked by something external to the team label Jun 25, 2019
…gateService

Fixs topDelegates calculation
Adds getDelegateRewards and getDelegateTotalStake functions on delegateService
Adds check of active transcoder in getRegisteredDelegates
Removes units conversions on protocol.js file, should be done outside
Adds null parameter on tokenAmountInUnits
@Agupane Agupane changed the base branch from development to feature/sdk-graphql-refactoring June 25, 2019 19:43
@Agupane Agupane changed the base branch from feature/sdk-graphql-refactoring to development June 25, 2019 19:44
@mariano-aguero
Copy link
Contributor

@Agupane I think we need to do:

  • Fix the build
  • Fix the conflicts
  • Try to rebase the/merge development

Agupane and others added 5 commits July 2, 2019 09:39
# Conflicts:
#	server/helpers/services/delegateService.js

Fixs wrong method getDelegate call
@mariano-aguero mariano-aguero merged commit d41432c into development Jul 2, 2019
@mariano-aguero mariano-aguero deleted the feature/topDelegates branch July 2, 2019 14:29
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

Successfully merging this pull request may close these issues.

Calculate TOP Delegates
2 participants