diff --git a/x/distribution/module.go b/x/distribution/module.go index eb7de978c6d1..b04590168eab 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -22,6 +22,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" + "github.com/cosmos/cosmos-sdk/x/distribution/client/rest" + "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + "github.com/cosmos/cosmos-sdk/x/distribution/simulation" + "github.com/cosmos/cosmos-sdk/x/distribution/types" ) // ConsensusVersion defines the current x/distribution module consensus version. @@ -97,14 +102,23 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { types.RegisterMsgServer(registrar, keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(registrar, keeper.NewQuerier(am.keeper)) - return nil + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + stakingKeeper types.StakingKeeper } -// RegisterMigrations registers the distribution module's migrations. -func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { - m := keeper.NewMigrator(am.keeper) - if err := mr.Register(types.ModuleName, 1, m.Migrate1to2); err != nil { - return fmt.Errorf("failed to migrate x/%s from version 1 to 2: %w", types.ModuleName, err) +// NewAppModule creates a new AppModule object +func NewAppModule( + cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + stakingKeeper: stakingKeeper, } if err := mr.Register(types.ModuleName, 2, m.Migrate2to3); err != nil { diff --git a/x/slashing/module.go b/x/slashing/module.go index 8fbd57939533..b0836be79231 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -21,6 +21,11 @@ import ( "github.com/cosmos/cosmos-sdk/simsx" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" + "github.com/cosmos/cosmos-sdk/x/slashing/client/rest" + "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + "github.com/cosmos/cosmos-sdk/x/slashing/simulation" + "github.com/cosmos/cosmos-sdk/x/slashing/types" ) // ConsensusVersion defines the current x/slashing module consensus version. @@ -103,8 +108,20 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error { m := keeper.NewMigrator(am.keeper, am.stakingKeeper.ValidatorAddressCodec()) - if err := mr.Register(types.ModuleName, 1, m.Migrate1to2); err != nil { - return fmt.Errorf("failed to migrate x/%s from version 1 to 2: %w", types.ModuleName, err) + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + stakingKeeper types.StakingKeeper +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) AppModule { + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + accountKeeper: ak, + bankKeeper: bk, + stakingKeeper: sk, } if err := mr.Register(types.ModuleName, 2, m.Migrate2to3); err != nil {