Skip to content

Commit

Permalink
Added AccountKeeper wrapper for provider 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 20, 2021
1 parent 87507c5 commit fbf3b4b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions x/provider/keeper/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/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)
}
5 changes: 5 additions & 0 deletions x/provider/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Keeper struct {
key sdk.StoreKey
params paramstypes.Subspace
distribution expected.DistributionKeeper
account expected.AccountKeeper
}

func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, params paramstypes.Subspace) Keeper {
Expand All @@ -32,6 +33,10 @@ func (k *Keeper) WithDistributionKeeper(keeper expected.DistributionKeeper) {
k.distribution = 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
4 changes: 2 additions & 2 deletions x/swap/simulation/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (
func ParamChanges(r *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{
sdksimulation.NewSimParamChange(types.ModuleName, string(types.KeySwapDenom), func(r *rand.Rand) string {
return fmt.Sprintf("%s", GetRandomSwapDenom(r))
return GetRandomSwapDenom(r)
}),
sdksimulation.NewSimParamChange(types.ModuleName, string(types.KeySwapEnabled), func(r *rand.Rand) string {
return fmt.Sprintf("%v", GetRandomSwapEnabled(r))
}),
sdksimulation.NewSimParamChange(types.ModuleName, string(types.KeyApproveBy), func(r *rand.Rand) string {
return fmt.Sprintf("%s", GetRandomApproveBy(r))
return GetRandomApproveBy(r)
}),
}
}
1 change: 1 addition & 0 deletions x/vpn/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, paramsKeeper paramsk
depositKeeper.WithBankKeeper(bankKeeper)

providerKeeper.WithDistributionKeeper(distributionKeeper)
providerKeeper.WithAccountKeeper(accountKeeper)

nodeKeeper.WithDistributionKeeper(distributionKeeper)
nodeKeeper.WithProviderKeeper(&providerKeeper)
Expand Down

0 comments on commit fbf3b4b

Please sign in to comment.