Skip to content

Commit

Permalink
Added wrapper for AccountKeeper in node module
Browse files Browse the repository at this point in the history
Signed-off-by: jay-dee7 <[email protected]>
  • Loading branch information
jay-dee7 committed May 19, 2021
1 parent 678c0d0 commit 6b57b0d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion x/node/keeper/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
hubtypes "github.com/sentinel-official/hub/types"
)

// AccountKeeper Wrapper
func (k *Keeper) GetAccount(ctx sdk.Context, address sdk.AccAddress) authtypes.AccountI {
return k.account.GetAccount(ctx, address)
}

func (k *Keeper) FundCommunityPool(ctx sdk.Context, from sdk.AccAddress, coin sdk.Coin) error {
return k.distribution.FundCommunityPool(ctx, sdk.NewCoins(coin), from)
}
Expand Down
5 changes: 5 additions & 0 deletions x/node/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Keeper struct {
distribution expected.DistributionKeeper
provider expected.ProviderKeeper
plan expected.PlanKeeper
account expected.AccountKeeper
}

func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, params paramstypes.Subspace) Keeper {
Expand All @@ -42,6 +43,10 @@ func (k *Keeper) WithPlanKeeper(keeper expected.PlanKeeper) {
k.plan = keeper
}

func (k *Keeper) WithAccountKeeper(keeper expected.AccountKeeper) {
k.account = keeper
}

func (k *Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+types.ModuleName)
}
Expand Down
1 change: 1 addition & 0 deletions x/vpn/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, paramsKeeper paramsk
nodeKeeper.WithDistributionKeeper(distributionKeeper)
nodeKeeper.WithProviderKeeper(&providerKeeper)
nodeKeeper.WithPlanKeeper(&planKeeper)
nodeKeeper.WithAccountKeeper(&accountKeeper)

planKeeper.WithProviderKeeper(&providerKeeper)
planKeeper.WithNodeKeeper(&nodeKeeper)
Expand Down

0 comments on commit 6b57b0d

Please sign in to comment.