The Graph Protocol. How to calculate your rewards for delegation?

The economic model of The Graph is complicated and has a lot of nuances. That’s why Ryabina published a series of “How it works” guides.

You might have missed our previous blog posts, “The Graph Network launch. How to delegate?” and “Graph Network. Fee Cut and Rewards Cut: How It Works.” In this article we describe the distribution of rewards to Delegators.

What you should know when delegate your GRT:

  • You pay a one-time fee equal 0,5% of all your stake for delegating and these tokens are burnt.
  • When delegating you get shares of Indexer’s pool. Quantity of shares received is determined by Delegation Exchange Rate, which is the ratio of the sum of total delegations and rewards to total delegations.

EXAMPLES.

CASE 1. Ryabina was already delegated with 10 tokens and 0 reward is accumulated. Alice delegates 1 token. In this situation Delegation Exchange Rate = 1 and Alice gets 1 share. She has 1/11 of the Delegation pool.

CASE 2. Ryabina was already delegated with 10 tokens and there is accumulated reward — 1 token. Alice delegates 1 token. In this situation Delegation Exchange Rate = 1.1 and Alice gets ~0.91 shares. She has 1/12 of the Delegation pool. Thus Alice can’t undelegate rewards share that was accumulated in the pool before she came.

  • Delegator can withdraw its shares from the pool by call Undelegate method any time, but all undelegated assets will be locked for 28 days. This period is equal to the max lifetime of allocation, because the delegator’s withdrawal decision must not have an impact on the indexing process.

How to calculate the amount you can withdraw from the pool:

{
delegator (id: “Your Delegator Address (Lock Contract Address) only in lower case”) {
id
stakes {
personalExchangeRate
shareAmount
indexer {
id
delegationExchangeRate
delegatorShares
delegatedTokens
delegatorParameterCooldown
lastDelegationParameterUpdate
}
}
}
}

As a result you get a list of all delegations of the account. Rewards are calculated separately for each stake based on a formula:

(delegatedTokens * shareAmount / delegatorShares) / 1000000000000000000

delegatedTokens — total quantity of tokens in the pool for the moment including all delegations and rewards

shareAmount — personal shares of Delegator

delegatorShares — total quantity of pool shares

The result should be the same as figures on https://network.thegraph.com/dashboard/ where you can compare it with the initial (previous) figure of your delegation. Remember that when delegating, you pay a one-time fee equal 0,5% of your stake.

There also can be find Indexer’s current exchange rate (delegationExchangeRate) and exchange rate of Delegator when entering the pool (personalExchangeRate.)

NB! Indexer can change its fee on delegator’s rewards (fee/rewards cut)!

Make sure that you delegate your assets to the reliable Indexer: it should be a well-known team that values its reputation and wouldn’t change fees unreasonably and unexpectedly or its Cooldown period is high and there is no technical way to change its parameters often.

Indexer’s Cooldown can be get from:

  • the query pointed above using the parameters delegatorParameterCooldown and lastDelegationParameterUpdate (both are measured in block quantity)
  • on the network.thegraph.com: remaining Cooldown is indicated in the delegation menu.

Ryabina indexer’s addresses:
1). graph-node-1-cp0x-hosted-by-ryabina.eth: 0xbb784d9b398271b7a64f975bebde869409691915
2). graph-node-1-cp0x-hosted-by-ryabina.eth: 0x8a1729fe84c53c231c7ae53a5bec3f6e9953cb4b
3). ryabina.eth: 0x9238584c74e5fa445a8f72a4d4ef4699dd783852

4). makingcash-hosted-by-ryabina.eth:
0x55f3dcdaf0b73f7f0c761a9070d8865f37986e2c

Sincerely yours, Ryabina🍒

If you have any questions do not hesitate to contact the Rybina team via Telegram or e-mail: info@ryabina.io

Validator on awesome networks