Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Aug 31, 2023
1 parent f269603 commit 1c662a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func NewNibiruApp(
skipGenesisInvariants := cast.ToBool(
appOpts.Get(crisis.FlagSkipGenesisInvariants))

app.InitModuleManager(encodingConfig, skipGenesisInvariants)
app.initModuleManager(encodingConfig, skipGenesisInvariants)

// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
Expand Down
29 changes: 9 additions & 20 deletions app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (app *NibiruApp) InitKeepers(
appCodec,
keys[banktypes.StoreKey],
app.AccountKeeper,
BlockedAddresses(),
blockedAddresses(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.stakingKeeper = stakingkeeper.NewKeeper(
Expand Down Expand Up @@ -478,7 +478,7 @@ func (app *NibiruApp) InitKeepers(
return wasmConfig
}

func (app *NibiruApp) AppModules(
func (app *NibiruApp) initAppModules(
encodingConfig EncodingConfig,
skipGenesisInvariants bool,
) []module.AppModule {
Expand Down Expand Up @@ -595,22 +595,10 @@ func orderedModuleNames() []string {
}
}

// GetMaccPerms returns a copy of the module account permissions
//
// NOTE: This is solely to be used for testing purposes.
func GetMaccPerms() map[string][]string {
dupMaccPerms := make(map[string][]string)
for k, v := range maccPerms {
dupMaccPerms[k] = v
}

return dupMaccPerms
}

// BlockedAddresses returns all the app's blocked account addresses.
func BlockedAddresses() map[string]bool {
// blockedAddresses returns all the app's blocked account addresses.
func blockedAddresses() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range GetMaccPerms() {
for acc := range maccPerms {
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}

Expand All @@ -620,22 +608,23 @@ func BlockedAddresses() map[string]bool {
return modAccAddrs
}

// InitModuleManager Load all the modules and stores them in the module manager
// initModuleManager Load all the modules and stores them in the module manager
// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
func (app *NibiruApp) InitModuleManager(
func (app *NibiruApp) initModuleManager(
encodingConfig EncodingConfig,
skipGenesisInvariants bool,
) {
app.mm = module.NewManager(
app.AppModules(encodingConfig, skipGenesisInvariants)...,
app.initAppModules(encodingConfig, skipGenesisInvariants)...,
)

// Init module orders for hooks and genesis
orderedModules := orderedModuleNames()
app.mm.SetOrderBeginBlockers(orderedModules...)
app.mm.SetOrderEndBlockers(orderedModules...)
app.mm.SetOrderInitGenesis(orderedModules...)
app.mm.SetOrderExportGenesis(orderedModules...)

// Uncomment if you want to set a custom migration order here.
// app.mm.SetOrderMigrations(custom order)
Expand Down
15 changes: 0 additions & 15 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
Expand Down Expand Up @@ -79,19 +77,6 @@ func (CrisisModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(genState)
}

// MintModule defines a custom wrapper around the x/mint module's
// AppModuleBasic implementation to provide custom default genesis state.
type MintModule struct {
mint.AppModuleBasic
}

// DefaultGenesis returns custom Nibiru x/mint module genesis state.
func (MintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := minttypes.DefaultGenesisState()
genState.Params.MintDenom = BondDenom
return cdc.MustMarshalJSON(genState)
}

// GovModule defines a custom wrapper around the x/gov module's
// AppModuleBasic implementation to provide custom default genesis state.
type GovModule struct {
Expand Down

0 comments on commit 1c662a2

Please sign in to comment.