From fbf3b4bad7f985fac1cbd69e4c18bb5dcf42d6ee Mon Sep 17 00:00:00 2001 From: jay-dee7 Date: Thu, 20 May 2021 23:42:35 +0530 Subject: [PATCH] Added AccountKeeper wrapper for provider module Signed-off-by: jay-dee7 --- x/provider/keeper/alias.go | 6 ++++++ x/provider/keeper/keeper.go | 5 +++++ x/swap/simulation/params.go | 4 ++-- x/vpn/keeper/keeper.go | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/x/provider/keeper/alias.go b/x/provider/keeper/alias.go index 28ea0114..2c2fb39e 100644 --- a/x/provider/keeper/alias.go +++ b/x/provider/keeper/alias.go @@ -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) } diff --git a/x/provider/keeper/keeper.go b/x/provider/keeper/keeper.go index c234fd72..77bb08cf 100644 --- a/x/provider/keeper/keeper.go +++ b/x/provider/keeper/keeper.go @@ -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 { @@ -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) } diff --git a/x/swap/simulation/params.go b/x/swap/simulation/params.go index 2a3d9844..843b36dd 100644 --- a/x/swap/simulation/params.go +++ b/x/swap/simulation/params.go @@ -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) }), } } diff --git a/x/vpn/keeper/keeper.go b/x/vpn/keeper/keeper.go index be0757fb..40dabe89 100644 --- a/x/vpn/keeper/keeper.go +++ b/x/vpn/keeper/keeper.go @@ -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)