onflow/flow-core-contracts

EPOCHS: Decouple reward payment from end of epoch

Closed this issue · 0 comments

Issue To Be Solved

Need to be able to calculate rewards for an epoch and pay at separate times

Suggest A Solution

  • Change payRewards to calculateRewards and have it return a dictionary mapping nodes and delegators to their reward amounts
  • Add a payRewards function to the the epoch contract to pay rewards to all the nodes from the previous epoch
  • Add a function to scale the rewards of a staker if needed for slashing an such
  • Add a function to scale all the rewards of all stakers in case the epoch was short or long
  • Only store staking information for the previous epoch