github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/distribution/spec/02_state.md (about) 1 <!-- 2 order: 2 3 --> 4 5 # State 6 7 ## FeePool 8 9 All globally tracked parameters for distribution are stored within 10 `FeePool`. Rewards are collected and added to the reward pool and 11 distributed to validators/delegators from here. 12 13 Note that the reward pool holds decimal coins (`DecCoins`) to allow 14 for fractions of coins to be received from operations like inflation. 15 When coins are distributed from the pool they are truncated back to 16 `sdk.Coins` which are non-decimal. 17 18 - FeePool: `0x00 -> amino(FeePool)` 19 20 ```go 21 // coins with decimal 22 type DecCoins []DecCoin 23 24 type DecCoin struct { 25 Amount sdk.Dec 26 Denom string 27 } 28 29 type FeePool struct { 30 TotalValAccumUpdateHeight int64 // last height which the total validator accum was updated 31 TotalValAccum sdk.Dec // total valdator accum held by validators 32 Pool DecCoins // funds for all validators which have yet to be withdrawn 33 CommunityPool DecCoins // pool for community funds yet to be spent 34 } 35 ``` 36 37 ## Validator Distribution 38 39 Validator distribution information for the relevant validator is updated each time: 40 41 1. delegation amount to a validator is updated, 42 2. a validator successfully proposes a block and receives a reward, 43 3. any delegator withdraws from a validator, or 44 4. the validator withdraws it's commission. 45 46 - ValidatorDistInfo: `0x02 | ValOperatorAddr -> amino(validatorDistribution)` 47 48 ```go 49 type ValidatorDistInfo struct { 50 FeePoolWithdrawalHeight int64 // last height this validator withdrew from the global fee pool 51 Pool DecCoins // rewards owed to delegators, commission has already been charged (includes proposer reward) 52 PoolCommission DecCoins // commission collected by this validator (pending withdrawal) 53 54 TotalDelAccumUpdateHeight int64 // last height which the total delegator accum was updated 55 TotalDelAccum sdk.Dec // total proposer pool accumulation factor held by delegators 56 } 57 ``` 58 59 ## Delegation Distribution 60 61 Each delegation distribution only needs to record the height at which it last 62 withdrew fees. Because a delegation must withdraw fees each time it's 63 properties change (aka bonded tokens etc.) its properties will remain constant 64 and the delegator's _accumulation_ factor can be calculated passively knowing 65 only the height of the last withdrawal and its current properties. 66 67 - DelegationDistInfo: `0x02 | DelegatorAddr | ValOperatorAddr -> amino(delegatorDist)` 68 69 ```go 70 type DelegationDistInfo struct { 71 WithdrawalHeight int64 // last time this delegation withdrew rewards 72 } 73 ```