Set Wormhole Keeper on Module

This commit is contained in:
Joel Smith 2024-07-26 14:07:03 -05:00
parent 696f0d5d7f
commit f29ecc00bc
2 changed files with 12 additions and 6 deletions

View File

@ -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) {

View File

@ -117,7 +117,6 @@ func NewAppModule(
keeper *keeper.Keeper,
ak types.AccountKeeper,
bk types.BankKeeper,
wk types.WormholeKeeper,
ls exported.Subspace,
) AppModule {
return AppModule{
@ -125,11 +124,17 @@ func NewAppModule(
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.
@ -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}
}