vacp2p / staking-reward-streamer

MIT License
0 stars 0 forks source link

Adding rewards per block with premint #50

Open mart1n-xyz opened 1 month ago

mart1n-xyz commented 1 month ago

Description

Main changes:

Checklist

Ensure you completed all of the steps below before submitting your pull request:

mart1n-xyz commented 1 month ago

This relates to the debate on total supply and some implementation details of the desirable UX. I wanted to show that

  1. we can have a system that updates balances in real time without the need for a transaction / state update while reward tokens are readily available in the contract (alternative is they can be minted on the go before any state update - actually may be a more elegant approach)
  2. the sacrifices to produce this (setting rewardsPerBlock ahead) are actually practical - one can preset the contract for a desirable period where the total rewards distributed can be result of "some formula" that is a function of, say, the total supply in the previous period (as Cyp suggested in the call). I'd say it is not practical to change setup or send rewards to the contract every block.
  3. with this system, one can determine the minted supply either based on staking contract stake and compute the other 2/3 allocations or, the other way, use arbitrary number to be minted and distributed via staking. So, anything goes. Obviously, this is incompatible with XP=MP
mart1n-xyz commented 1 month ago

If setting rewardsPerBlock in advance is not desirable, the contract can have epoch: any rewards that arrived in previous epoch determine the rewardsPerBlock in the current epoch (past_rewards/blocks_in_epoch).