blockly minting (#2825)
* update mechanism to use average block time * correctly sets accum height for zero-delegations * update Decimal Format() * clip withdrawal tokens * PositiveDelegationInvariant * DelegatorSharesInvariant * DelAccumInvariants
This commit is contained in:
committed by
Jae Kwon
parent
4c36b0fe05
commit
7cb1ba625e
@@ -1,18 +1,18 @@
|
||||
# Begin-Block
|
||||
|
||||
## Inflation
|
||||
Inflation occurs at the beginning of each block, however minting parameters
|
||||
are only calculated once per hour.
|
||||
|
||||
Inflation occurs at the beginning of each block.
|
||||
## NextInflationRate
|
||||
|
||||
### NextInflation
|
||||
The target annual inflation rate is recalculated at the first block of each new
|
||||
hour. The inflation is also subject to a rate change (positive or negative)
|
||||
depending on the distance from the desired ratio (67%). The maximum rate change
|
||||
possible is defined to be 13% per year, however the annual inflation is capped
|
||||
as between 7% and 20%.
|
||||
|
||||
The target annual inflation rate is recalculated for each provisions cycle. The
|
||||
inflation is also subject to a rate change (positive or negative) depending on
|
||||
the distance from the desired ratio (67%). The maximum rate change possible is
|
||||
defined to be 13% per year, however the annual inflation is capped as between
|
||||
7% and 20%.
|
||||
|
||||
NextInflation(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
|
||||
```
|
||||
NextInflationRate(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
|
||||
inflationRateChangePerYear = (1 - bondedRatio/params.GoalBonded) * params.InflationRateChange
|
||||
inflationRateChange = inflationRateChangePerYear/hrsPerYr
|
||||
|
||||
@@ -26,3 +26,25 @@ NextInflation(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
|
||||
}
|
||||
|
||||
return inflation
|
||||
```
|
||||
|
||||
## NextAnnualProvisions
|
||||
|
||||
Calculate the annual provisions based on current total supply and inflation
|
||||
rate. This parameter is calculated once per block.
|
||||
|
||||
```
|
||||
NextAnnualProvisions(params Params, totalSupply sdk.Dec) (provisions sdk.Dec) {
|
||||
return Inflation * totalSupply
|
||||
```
|
||||
|
||||
## BlockProvision
|
||||
|
||||
Calculate the provisions generated for each block based on current
|
||||
annual provisions
|
||||
|
||||
```
|
||||
BlockProvision(params Params) sdk.Coin {
|
||||
provisionAmt = AnnualProvisions/ params.BlocksPerYear
|
||||
return sdk.NewCoin(params.MintDenom, provisionAmt.Truncate())
|
||||
```
|
||||
|
||||
@@ -8,8 +8,9 @@ The minter is a space for holding current inflation information.
|
||||
|
||||
```golang
|
||||
type Minter struct {
|
||||
InflationLastTime time.Time // block time which the last inflation was processed
|
||||
Inflation sdk.Dec // current annual inflation rate
|
||||
LastUpdate time.Time // time which the last update was made to the minter
|
||||
Inflation sdk.Dec // current annual inflation rate
|
||||
AnnualProvisions sdk.Dec // current annual exptected provisions
|
||||
}
|
||||
```
|
||||
|
||||
@@ -26,6 +27,7 @@ type Params struct {
|
||||
InflationMax sdk.Dec // maximum inflation rate
|
||||
InflationMin sdk.Dec // minimum inflation rate
|
||||
GoalBonded sdk.Dec // goal of percent bonded atoms
|
||||
BlocksPerYear uint64 // expected blocks per year
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user