Skip to content

Commit

Permalink
fix(inflation): fix default inflation allocation params (#1688)
Browse files Browse the repository at this point in the history
* fix: fix default inflation allocation

* chore: changelog

* fix: fix tests

---------

Co-authored-by: Unique Divine <[email protected]>
  • Loading branch information
2 people authored and k-yang committed Dec 8, 2023
1 parent ef399b4 commit a1f0844
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1670](https://github.com/NibiruChain/nibiru/pull/1670) - feat(inflation): Make inflation polynomial
* [#1695](https://github.com/NibiruChain/nibiru/pull/1695) - feat(inflation): add events for inflation distribution

### Bug Fixes

* [#1688](https://github.com/NibiruChain/nibiru/pull/1688) - fix(inflation): make default inflation allocation follow tokenomics

## [v1.0.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.0.0)

### Features
Expand Down
7 changes: 0 additions & 7 deletions x/inflation/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,27 +161,20 @@ func TestPeriodChangesSkippedEpochsAfterEpochEnd(t *testing.T) {

// Perform Epoch Hooks
futureCtx := ctx.WithBlockTime(time.Now().Add(time.Minute))
fmt.Println("tc.height", tc.height)
nibiruApp.EpochsKeeper.BeforeEpochStart(futureCtx, tc.epochIdentifier, tc.height)
nibiruApp.EpochsKeeper.AfterEpochEnd(futureCtx, tc.epochIdentifier, tc.height)

skippedEpochs := nibiruApp.InflationKeeper.NumSkippedEpochs.Peek(ctx)
period := nibiruApp.InflationKeeper.CurrentPeriod.Peek(ctx)

if tc.periodChanges {
fmt.Println("periodChanges", tc.periodChanges)
newProvision := nibiruApp.InflationKeeper.GetEpochMintProvision(ctx)

expectedProvision := types.CalculateEpochMintProvision(
nibiruApp.InflationKeeper.GetParams(ctx),
period,
)

fmt.Println("periodChanges", tc.periodChanges)
fmt.Println("newProvision", newProvision)
fmt.Println("expectedProvision", expectedProvision)
fmt.Println("originalProvision", originalProvision)

require.Equal(t, expectedProvision, newProvision)
// mint provisions will change
require.NotEqual(t, newProvision, originalProvision)
Expand Down
24 changes: 12 additions & 12 deletions x/inflation/keeper/inflation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ func TestMintAndAllocateInflation(t *testing.T) {
{
name: "pass",
coinsToMint: sdk.NewCoin(denoms.NIBI, sdk.NewInt(1_000_000)),
expectedStakingAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(278_000)),
expectedStrategicAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(100_000)),
expectedCommunityAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(622_000)),
expectedStakingRewardsBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(278_000)),
expectedStrategicReservesBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(100_000)),
expectedCommunityPoolBalance: sdk.NewDecCoins(sdk.NewDecCoin(denoms.NIBI, sdk.NewInt(622_000))),
expectedStakingAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(277_572)),
expectedStrategicAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(370_837)),
expectedCommunityAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(351_591)),
expectedStakingRewardsBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(277_572)),
expectedStrategicReservesBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(370_837)),
expectedCommunityPoolBalance: sdk.NewDecCoins(sdk.NewDecCoin(denoms.NIBI, sdk.NewInt(351_591))),
rootAccount: "nibi1qyqf35fkhn73hjr70442fctpq8prpqr9ysj9sn",
},
{
Expand All @@ -59,12 +59,12 @@ func TestMintAndAllocateInflation(t *testing.T) {
{
name: "pass - no root account",
coinsToMint: sdk.NewCoin(denoms.NIBI, sdk.NewInt(1_000_000)),
expectedStakingAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(278_000)),
expectedStrategicAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(100_000)),
expectedCommunityAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(622_000)),
expectedStakingRewardsBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(278_000)),
expectedStrategicReservesBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(100_000)),
expectedCommunityPoolBalance: sdk.NewDecCoins(sdk.NewDecCoin(denoms.NIBI, sdk.NewInt(622_000))),
expectedStakingAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(277_572)),
expectedStrategicAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(370_837)),
expectedCommunityAmt: sdk.NewCoin(denoms.NIBI, sdk.NewInt(351_591)),
expectedStakingRewardsBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(277_572)),
expectedStrategicReservesBalance: sdk.NewCoin(denoms.NIBI, sdk.NewInt(370_837)),
expectedCommunityPoolBalance: sdk.NewDecCoins(sdk.NewDecCoin(denoms.NIBI, sdk.NewInt(351_591))),
rootAccount: "",
},
}
Expand Down
6 changes: 3 additions & 3 deletions x/inflation/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ var (
sdk.MustNewDecFromStr("18063678.8582418"),
}
DefaultInflationDistribution = InflationDistribution{
StakingRewards: sdk.NewDecWithPrec(27_8, 3), // 27.8%
CommunityPool: sdk.NewDecWithPrec(62_20, 4), // 62.20%
StrategicReserves: sdk.NewDecWithPrec(10, 2), // 10%
CommunityPool: sdk.NewDecWithPrec(35_159141, 8), // 35.159141%
StakingRewards: sdk.NewDecWithPrec(27_757217, 8), // 27.757217%
StrategicReserves: sdk.NewDecWithPrec(37_083642, 8), // 37.083642%
}
DefaultEpochsPerPeriod = uint64(30)
DefaultPeriodsPerYear = uint64(12)
Expand Down

0 comments on commit a1f0844

Please sign in to comment.