Skip to content

Commit

Permalink
Refactor Staking Initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Jul 26, 2024
1 parent b0d283f commit 696f0d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
19 changes: 12 additions & 7 deletions x/staking/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func NewKeeper(
key storetypes.StoreKey,
ak types.AccountKeeper,
bk types.BankKeeper,
wk types.WormholeKeeper,
authority string,
) *Keeper {
// ensure bonded and not bonded module accounts are set
Expand All @@ -55,15 +54,21 @@ func NewKeeper(
}

return &Keeper{
storeKey: key,
cdc: cdc,
authKeeper: ak,
bankKeeper: bk,
hooks: nil,
authority: authority,
storeKey: key,
cdc: cdc,
authKeeper: ak,
bankKeeper: bk,
wormholeKeeper: nil,
hooks: nil,
authority: authority,
}
}

// / SetWormholekeeper sets the wormhole keeper
func (k *Keeper) SetWormholekeeper(whk types.WormholeKeeper) {
k.wormholeKeeper = whk
}

func (k Keeper) IsConsensusGuardian(ctx sdk.Context, addr sdk.ValAddress) (bool, error) {
return k.wormholeKeeper.IsConsensusGuardian(ctx, addr)
}
Expand Down
1 change: 0 additions & 1 deletion x/staking/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func (s *KeeperTestSuite) SetupTest() {
key,
accountKeeper,
bankKeeper,
nil,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
keeper.SetParams(ctx, stakingtypes.DefaultParams())
Expand Down
3 changes: 2 additions & 1 deletion x/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ func ProvideModule(in StakingInputs) StakingOutputs {
in.Key,
in.AccountKeeper,
in.BankKeeper,
in.WormholeKeeper,
authority.String(),
)
k.SetWormholekeeper(in.WormholeKeeper)

m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.WormholeKeeper, in.LegacySubspace)
return StakingOutputs{StakingKeeper: k, Module: m}
}
Expand Down

0 comments on commit 696f0d5

Please sign in to comment.