cosmos-sdk/docs/spec/distribution/end_block.md

39 lines
1.7 KiB
Markdown
Raw Normal View History

# End Block
At each endblock, the fees received are allocated to the proposer, community fund,
2018-10-14 23:34:01 -07:00
and global pool. When the validator is the proposer of the round, that
validator (and their delegators) receives between 1% and 5% of fee rewards, the
2018-08-08 12:03:43 -07:00
reserve community tax is then charged, then the remainder is distributed
proportionally by voting power to all bonded validators independent of whether
they voted (social distribution). Note the social distribution is applied to
proposer validator in addition to the proposer reward.
The amount of proposer reward is calculated from pre-commits Tendermint
messages in order to incentivize validators to wait and include additional
pre-commits in the block. All provision rewards are added to a provision reward
pool which validator holds individually
(`ValidatorDistribution.ProvisionsRewardPool`).
```
2018-10-19 11:36:00 -07:00
func AllocateTokens(feesCollected sdk.Coins, feePool FeePool, proposer ValidatorDistribution,
sumPowerPrecommitValidators, totalBondedTokens, communityTax,
proposerCommissionRate sdk.Dec)
feesCollectedDec = MakeDecCoins(feesCollected)
proposerReward = feesCollectedDec * (0.01 + 0.04
* sumPowerPrecommitValidators / totalBondedTokens)
commission = proposerReward * proposerCommissionRate
proposer.PoolCommission += commission
proposer.Pool += proposerReward - commission
communityFunding = feesCollectedDec * communityTax
2018-09-05 16:15:15 -07:00
feePool.CommunityFund += communityFunding
poolReceived = feesCollectedDec - proposerReward - communityFunding
2018-09-05 16:15:15 -07:00
feePool.Pool += poolReceived
SetValidatorDistribution(proposer)
2018-09-05 16:15:15 -07:00
SetFeePool(feePool)
```