Skip to content

Commit

Permalink
chore(inflation)!: remove x/inflation module (#1667)
Browse files Browse the repository at this point in the history
* chore(inflation): remove x/inflation and inflation proto files

* fix: wasmbinding imports

* chore(inflation): remove inflation from app keepers

* update changelog
  • Loading branch information
k-yang authored Nov 7, 2023
1 parent db04996 commit c55185f
Show file tree
Hide file tree
Showing 34 changed files with 27 additions and 6,381 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1617](https://github.com/NibiruChain/nibiru/pull/1617) - fix(app)!: non-nil snapshot manager is not guaranteed in testapp
* [#1645](https://github.com/NibiruChain/nibiru/pull/1645) - fix(tokenfactory)!: token supply in bank keeper must be correct after MsgBurn.
* [#1646](https://github.com/NibiruChain/nibiru/pull/1646) - feat(wasmbinding)!: whitelisted stargate queries for QueryRequest::Stargate: auth, bank, gov, tokenfactory, epochs, inflation, oracle, sudo, devgas
* [#1667](https://github.com/NibiruChain/nibiru/pull/1667) - chore(inflation)!: unwire x/inflation

### Improvements

Expand Down
33 changes: 8 additions & 25 deletions app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ import (
epochskeeper "github.com/NibiruChain/nibiru/x/epochs/keeper"
epochstypes "github.com/NibiruChain/nibiru/x/epochs/types"
"github.com/NibiruChain/nibiru/x/genmsg"
"github.com/NibiruChain/nibiru/x/inflation"
inflationkeeper "github.com/NibiruChain/nibiru/x/inflation/keeper"
inflationtypes "github.com/NibiruChain/nibiru/x/inflation/types"
oracle "github.com/NibiruChain/nibiru/x/oracle"
oraclekeeper "github.com/NibiruChain/nibiru/x/oracle/keeper"
oracletypes "github.com/NibiruChain/nibiru/x/oracle/types"
Expand Down Expand Up @@ -164,7 +161,6 @@ type AppKeepers struct {
// ---------------
EpochsKeeper epochskeeper.Keeper
OracleKeeper oraclekeeper.Keeper
InflationKeeper inflationkeeper.Keeper
SudoKeeper keeper.Keeper
DevGasKeeper devgaskeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
Expand Down Expand Up @@ -203,7 +199,6 @@ func initStoreKeys() (
// nibiru x/ keys
oracletypes.StoreKey,
epochstypes.StoreKey,
inflationtypes.StoreKey,
sudotypes.StoreKey,
wasmtypes.StoreKey,
devgastypes.StoreKey,
Expand Down Expand Up @@ -350,14 +345,8 @@ func (app *NibiruApp) InitKeepers(
appCodec, keys[sudotypes.StoreKey],
)

app.InflationKeeper = inflationkeeper.NewKeeper(
appCodec, keys[inflationtypes.StoreKey], app.GetSubspace(inflationtypes.ModuleName),
app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.stakingKeeper, app.SudoKeeper, authtypes.FeeCollectorName,
)

app.EpochsKeeper.SetHooks(
epochstypes.NewMultiEpochHooks(
app.InflationKeeper.Hooks(),
app.OracleKeeper.Hooks(),
),
)
Expand Down Expand Up @@ -567,7 +556,6 @@ func (app *NibiruApp) initAppModules(
// Nibiru modules
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper, app.SudoKeeper),
epochs.NewAppModule(appCodec, app.EpochsKeeper),
inflation.NewAppModule(app.InflationKeeper, app.AccountKeeper, *app.stakingKeeper),
sudo.NewAppModule(appCodec, app.SudoKeeper),
genmsg.NewAppModule(app.MsgServiceRouter()),

Expand Down Expand Up @@ -634,7 +622,6 @@ func orderedModuleNames() []string {
// Native x/ Modules
epochstypes.ModuleName,
oracletypes.ModuleName,
inflationtypes.ModuleName,
sudotypes.ModuleName,

// --------------------------------------------------------------------
Expand Down Expand Up @@ -748,7 +735,6 @@ func ModuleBasicManager() module.BasicManager {
// native x/
oracle.AppModuleBasic{},
epochs.AppModuleBasic{},
inflation.AppModuleBasic{},
sudo.AppModuleBasic{},
wasm.AppModuleBasic{},
devgas.AppModuleBasic{},
Expand All @@ -760,16 +746,14 @@ func ModuleBasicManager() module.BasicManager {

func ModuleAccPerms() map[string][]string {
return map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
inflationtypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
oracletypes.ModuleName: {},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: {},

authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
oracletypes.ModuleName: {},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: {},
epochstypes.ModuleName: {},
sudotypes.ModuleName: {},
common.TreasuryPoolModuleAccount: {},
Expand All @@ -794,7 +778,6 @@ func initParamsKeeper(
paramsKeeper.Subspace(crisistypes.ModuleName)
// Nibiru core params keepers | x/
paramsKeeper.Subspace(epochstypes.ModuleName)
paramsKeeper.Subspace(inflationtypes.ModuleName)
// ibc params keepers
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
Expand Down
36 changes: 0 additions & 36 deletions proto/nibiru/inflation/v1/genesis.proto

This file was deleted.

52 changes: 0 additions & 52 deletions proto/nibiru/inflation/v1/inflation.proto

This file was deleted.

119 changes: 0 additions & 119 deletions proto/nibiru/inflation/v1/query.proto

This file was deleted.

14 changes: 7 additions & 7 deletions wasmbinding/stargate_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

devgas "github.com/NibiruChain/nibiru/x/devgas/v1/types"
epochs "github.com/NibiruChain/nibiru/x/epochs/types"
inflation "github.com/NibiruChain/nibiru/x/inflation/types"
oracle "github.com/NibiruChain/nibiru/x/oracle/types"
sudotypes "github.com/NibiruChain/nibiru/x/sudo/types"
tokenfactory "github.com/NibiruChain/nibiru/x/tokenfactory/types"
Expand Down Expand Up @@ -110,13 +109,14 @@ func WasmAcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries {
"/nibiru.epochs.v1.Query/EpochInfos": new(epochs.QueryEpochInfosResponse),
"/nibiru.epochs.v1.Query/CurrentEpoch": new(epochs.QueryCurrentEpochResponse),

// TODO: for post v1
// nibiru inflation
"/nibiru.inflation.v1.Query/Period": new(inflation.QueryPeriodResponse),
"/nibiru.inflation.v1.Query/EpochMintProvision": new(inflation.QueryEpochMintProvisionResponse),
"/nibiru.inflation.v1.Query/SkippedEpochs": new(inflation.QuerySkippedEpochsResponse),
"/nibiru.inflation.v1.Query/CirculatingSupply": new(inflation.QueryCirculatingSupplyResponse),
"/nibiru.inflation.v1.Query/InflationRate": new(inflation.QueryInflationRateResponse),
"/nibiru.inflation.v1.Query/Params": new(inflation.QueryParamsResponse),
// "/nibiru.inflation.v1.Query/Period": new(inflation.QueryPeriodResponse),
// "/nibiru.inflation.v1.Query/EpochMintProvision": new(inflation.QueryEpochMintProvisionResponse),
// "/nibiru.inflation.v1.Query/SkippedEpochs": new(inflation.QuerySkippedEpochsResponse),
// "/nibiru.inflation.v1.Query/CirculatingSupply": new(inflation.QueryCirculatingSupplyResponse),
// "/nibiru.inflation.v1.Query/InflationRate": new(inflation.QueryInflationRateResponse),
// "/nibiru.inflation.v1.Query/Params": new(inflation.QueryParamsResponse),

// nibiru oracle
"/nibiru.oracle.v1.Query/ExchangeRate": new(oracle.QueryExchangeRateResponse),
Expand Down
2 changes: 0 additions & 2 deletions wasmbinding/stargate_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

devgas "github.com/NibiruChain/nibiru/x/devgas/v1/types"
epochs "github.com/NibiruChain/nibiru/x/epochs/types"
inflation "github.com/NibiruChain/nibiru/x/inflation/types"
oracle "github.com/NibiruChain/nibiru/x/oracle/types"
sudotypes "github.com/NibiruChain/nibiru/x/sudo/types"
tokenfactory "github.com/NibiruChain/nibiru/x/tokenfactory/types"
Expand All @@ -41,7 +40,6 @@ func TestWasmAcceptedStargateQueries(t *testing.T) {
queryServiceDescriptions := []grpc.ServiceDesc{
epochs.GrpcQueryServiceDesc(),
devgas.GrpcQueryServiceDesc(),
inflation.GrpcQueryServiceDesc(),
oracle.GrpcQueryServiceDesc(),
sudotypes.GrpcQueryServiceDesc(),
tokenfactory.GrpcQueryServiceDesc(),
Expand Down
10 changes: 5 additions & 5 deletions x/common/testutil/action/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/NibiruChain/nibiru/app"
inflationtypes "github.com/NibiruChain/nibiru/x/inflation/types"
tokenfactorytypes "github.com/NibiruChain/nibiru/x/tokenfactory/types"
)

type fundAccount struct {
Expand All @@ -17,12 +17,12 @@ func FundAccount(account sdk.AccAddress, amount sdk.Coins) Action {
}

func (c fundAccount) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) {
err := app.BankKeeper.MintCoins(ctx, inflationtypes.ModuleName, c.Amount)
err := app.BankKeeper.MintCoins(ctx, tokenfactorytypes.ModuleName, c.Amount)
if err != nil {
return ctx, err, true
}

err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, inflationtypes.ModuleName, c.Account, c.Amount)
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, tokenfactorytypes.ModuleName, c.Account, c.Amount)
if err != nil {
return ctx, err, true
}
Expand All @@ -40,12 +40,12 @@ func FundModule(module string, amount sdk.Coins) Action {
}

func (c fundModule) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) {
err := app.BankKeeper.MintCoins(ctx, inflationtypes.ModuleName, c.Amount)
err := app.BankKeeper.MintCoins(ctx, tokenfactorytypes.ModuleName, c.Amount)
if err != nil {
return ctx, err, true
}

err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, inflationtypes.ModuleName, c.Module, c.Amount)
err = app.BankKeeper.SendCoinsFromModuleToModule(ctx, tokenfactorytypes.ModuleName, c.Module, c.Amount)
if err != nil {
return ctx, err, true
}
Expand Down
Loading

0 comments on commit c55185f

Please sign in to comment.