teamzednode / gingerbread

Dashboard for Tezos Bakers
https://gingerbread.zednode.com
MIT License
13 stars 2 forks source link

Add Rewards page #3

Open rloomba opened 5 years ago

rloomba commented 5 years ago

display rewards for a specific cycle

similar to tzscan rewards page

image

rohitverma007 commented 5 years ago

Here's how I am planning on retrieving the delegator info via the rpc:

Let me know how if I am missing anything

rloomba commented 5 years ago

@rohitverma007 there are some slight nuances to the baking process, there's a FAQ here that summarizes up the process pretty nicely: https://tzbake.com/index.php/baking-explained/

The delegation is made somewhere in the middle of the current cycle (3 days), if you remember there are 16 roll snapshots taken in each cycle, so depending on where the cycle is right now, the delegation may not be recorded in some of the previous roll snapshots of the current cycle. Now here it gets tricky, when baking rights are being calculated, one of these 16 roll snapshots is chosen randomly ! so if you are unlucky and one of the roll snapshots is chosen that your delegation is not recorded in , you would lose the profit of that cycle (3 days) completely.

Snapshots are taken every 256 blocks, and then one of those snapshots is randomly chosen, so I'm not sure just picking the first block of the cycle would be accurate?

I think it might be best to potentially split the reward logic into two parts(and maybe make this evident in the UI as well):

  1. actual rewards received for past cycles
  2. "predicted" rewards for cycles that haven't been backed yet. We could take an average of the balance over these 16 snapshots?

Re: 1, Is there an RPC endpoint to show what the actual rewards were for a previously baked cycle? or maybe it tells us which specific snapshot was used? Once we have that we can get the delegate data, and then query the required info from the contract

rloomba commented 5 years ago

Ok @rohitverma007 let's go with two pages: