Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

substitute staking module #283

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"

stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
Expand All @@ -89,6 +90,7 @@
ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
customstaking "github.com/notional-labs/composable/v6/custom/staking"
"github.com/spf13/cast"
icq "github.com/strangelove-ventures/async-icq/v7"
icqtypes "github.com/strangelove-ventures/async-icq/v7/types"
Expand Down Expand Up @@ -356,7 +358,7 @@
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
customstaking.NewAppModule(appCodec, *&app.Customstaking, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),

Check failure on line 361 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

SA4001: *&x will be simplified to x. It will not copy x. (staticcheck)
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (

stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
customstaking "github.com/notional-labs/composable/v6/custom/staking/keeper"

"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
Expand Down Expand Up @@ -116,6 +117,7 @@ type AppKeepers struct {
BankKeeper custombankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
Customstaking customstaking.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
Expand Down
12 changes: 6 additions & 6 deletions custom/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"github.com/cosmos/cosmos-sdk/types/module"
stakingmodule "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/staking/exported"
"github.com/cosmos/cosmos-sdk/x/staking/keeper"

Check failure on line 10 in custom/staking/module.go

View workflow job for this annotation

GitHub Actions / lint

ST1019: package "github.com/cosmos/cosmos-sdk/x/staking/keeper" is being imported more than once (stylecheck)
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

Check failure on line 11 in custom/staking/module.go

View workflow job for this annotation

GitHub Actions / lint

ST1019(related information): other import of "github.com/cosmos/cosmos-sdk/x/staking/keeper" (stylecheck)
"github.com/cosmos/cosmos-sdk/x/staking/types"

// custombankkeeper "github.com/notional-labs/composable/v6/custom/bank/keeper"
Expand All @@ -18,13 +18,13 @@
// AppModule wraps around the bank module and the bank keeper to return the right total supply
type AppModule struct {
stakingmodule.AppModule
keeper keeper.Keeper
keeper customstakingkeeper.Keeper
subspace exported.Subspace
}

// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, ss exported.Subspace) AppModule {
stakingModule := stakingmodule.NewAppModule(cdc, &keeper, accountKeeper, bankKeeper, ss)
func NewAppModule(cdc codec.Codec, keeper customstakingkeeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, ss exported.Subspace) AppModule {
stakingModule := stakingmodule.NewAppModule(cdc, &keeper.Keeper, accountKeeper, bankKeeper, ss)
return AppModule{
AppModule: stakingModule,
keeper: keeper,
Expand All @@ -37,11 +37,11 @@
// when trying to force this custom keeper into a bankkeeper.BaseKeeper
func (am AppModule) RegisterServices(cfg module.Configurator) {
// types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper))
types.RegisterMsgServer(cfg.MsgServer(), customstakingkeeper.NewMsgServerImpl(am.keeper))
querier := keeper.Querier{Keeper: &am.keeper}
types.RegisterMsgServer(cfg.MsgServer(), customstakingkeeper.NewMsgServerImpl(am.keeper.Keeper))
querier := keeper.Querier{Keeper: &am.keeper.Keeper}
types.RegisterQueryServer(cfg.QueryServer(), querier)

m := stakingkeeper.NewMigrator(&am.keeper, am.subspace)
m := stakingkeeper.NewMigrator(&am.keeper.Keeper, am.subspace)
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {
panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err))
}
Expand Down
Loading