Skip to content

Commit

Permalink
Set Wormhole Keeper on Module
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Jul 26, 2024
1 parent 696f0d5 commit f29ecc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion x/staking/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ func NewKeeper(
}

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

func (k Keeper) IsConsensusGuardian(ctx sdk.Context, addr sdk.ValAddress) (bool, error) {
Expand Down
15 changes: 10 additions & 5 deletions x/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,24 @@ func NewAppModule(
keeper *keeper.Keeper,
ak types.AccountKeeper,
bk types.BankKeeper,
wk types.WormholeKeeper,
ls exported.Subspace,
) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
accountKeeper: ak,
bankKeeper: bk,
wormholeKeeper: wk,
wormholeKeeper: nil,
legacySubspace: ls,
}
}

// SetWormholeKeeper sets the wormhole keeper
func (am AppModule) SetWormholeKeeper(whk types.WormholeKeeper) AppModule {
am.wormholeKeeper = whk
return am
}

var _ appmodule.AppModule = AppModule{}

// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
Expand Down Expand Up @@ -238,10 +243,10 @@ func ProvideModule(in StakingInputs) StakingOutputs {
in.AccountKeeper,
in.BankKeeper,
authority.String(),
)
k.SetWormholekeeper(in.WormholeKeeper)
).SetWormholekeeper(in.WormholeKeeper)

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

Expand Down

0 comments on commit f29ecc0

Please sign in to comment.