Closed bianyunjian closed 1 year ago
● Gross Inflation breakout: ○ Proportion (quantity) of gross inflation to collators ○ Proportion (quantity) of gross inflation to stakers ○ Proportion (quantity) of gross inflation to parachain bond reserve
以时间作为查询条件
查询该时间点处的blockNumber
查询该blockNumber的 hash
查询在该blockNumber处的 totalIssuance
balances.totalIssuance()
得到inflation = totalIssuance - 10亿
根据分配比例和公式得出 inflation to parachain bond reserve = 30% * inflation
这两个需要处理 (inflation to collators ,inflation to stakers ), 因为收集人的奖励比例是两部分构成: 固定的20% + 浮动的奖励池比例。 我们可以通过Staking的数据库计算得到 Staking发的奖励 ( Collators 总奖励, Delegators总奖励 )(在指定的blockNumber之前的) Delegators总奖励 ==> inflation to stakers
inflation to collators = inflation - ( inflation to parachain bond reserve ) - ( inflation to stakers )
注意,通过这种方式计算出, 会有一定的误差,因为 Staking的奖励是 延迟两个round发的( 12 小时 ), 但应该差不离,在可接受范围内.
1.时间是查询条件, 输入的一个时间点, 比如 2022-05-01
开发环境 Staking 数据库 dev-moonbeam-staking, 从线上克隆下来的
nflation info:
For Moonriver, inflation is (https://github.com/PureStake/moonbeam/blob/c39a717e2501a3470ae589c52daaa51786189cce/node/service/src/chain_spec/moonriver.rs#L186-L196): 4% for a min staked MOVR of 100_000 5% for an ideal staked MOVR of 200_000 5% for a max staked MOVR of 200_000
For Moonbeam, inflation is (https://github.com/PureStake/moonbeam/blob/c39a717e2501a3470ae589c52daaa51786189cce/node/service/src/chain_spec/moonbeam.rs#L184-L198): 4% for a min staked GLMR of 1_000_000 5% for an ideal staked GLMR of 2_000_000 5% for a max staked GLMR of 2_000_000
Gross Inflation breakout:
[x] Proportion (quantity) of gross inflation to collators
[x] Proportion (quantity) of gross inflation to stakers
[x] Proportion (quantity) of gross inflation to parachain bond reserve
actually the gross inflation is used by staking reward, we can get these data from staking database. we can calculate the inflation by the reward and distribution formula.
how the staking reward be distributed? refer to: https://docs.moonbeam.network/learn/features/staking/#reward-distribution