onflow/flow-core-contracts

Update Staking Contract to Use Transaction Fees for Staking Rewards

joshuahannan opened this issue · 2 comments

Issue To Be Solved

Flow rewards are meant to include transaction fees, so we need a way to move the transaction fees from the FlowFees contract to the staking contract so they can be used instead of minting even more tokens and burning the fees. It allows for a more direct transfer.

Suggest A Solution

  • Figure out where the FlowFees.Administrator resource is
  • Organize for the FlowFees.Administrator to be moved to the staking contract account
  • In the payRewards function, using the Fees admin resource to withdraw all the fees that have accumulated in the fees vault
  • Ensure that all of the fees tokens are used before any more tokens are minted
  • Maybe mint all the extra tokens in one batch instead of individually for each staker

cc @laynelafrance @Kay-Zee

@joshuahannan in addition, @Kay-Zee pointed out that this should include the automation of rewards as it's currently hard coded. Would you like me to make a separate issue for that? It would include calculating rewards rather than taking an input and then reducing the mint by the amount fees contribute to the payout pool for that epoch.

We could include that also, but I was told that for this version of epochs, we weren't going to automate rewards calculation and payment yet. Has that changed?