Skip to content

Commit

Permalink
remove ModuleBasics
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jul 18, 2024
1 parent edacdde commit 456b40e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 38 deletions.
38 changes: 1 addition & 37 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ import (
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"

// chain-main imports

Expand Down Expand Up @@ -171,40 +169,6 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic([]govclient.ProposalHandler{
paramsclient.ProposalHandler,
}),
params.AppModuleBasic{},
slashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
solomachine.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
nfttransfer.AppModuleBasic{},
authzmodule.AppModuleBasic{},
groupmodule.AppModuleBasic{},
vesting.AppModuleBasic{},
ica.AppModuleBasic{},
icaauthmodule.AppModuleBasic{},
ibcfee.AppModuleBasic{},
supply.AppModuleBasic{},
chainmain.AppModuleBasic{},
nft.AppModuleBasic{},
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
Expand Down Expand Up @@ -1009,7 +973,7 @@ func (app *ChainApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register grpc-gateway routes for all modules.
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register swagger API from root so that other applications can override easily
if apiConfig.Swagger {
Expand Down
9 changes: 8 additions & 1 deletion app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package app
import (
"encoding/json"

"cosmossdk.io/log"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
)

// The genesis state of the blockchain is represented here as a map of raw json
Expand All @@ -17,5 +20,9 @@ type GenesisState map[string]json.RawMessage

// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
return ModuleBasics.DefaultGenesis(cdc)
tempApp := New(
log.NewNopLogger(), dbm.NewMemDB(), nil, true,
simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome),
)
return tempApp.BasicModuleManager.DefaultGenesis(cdc)
}

0 comments on commit 456b40e

Please sign in to comment.