Skip to content

Commit

Permalink
fix: Change usage of account keeper in lockup module, incentives modu…
Browse files Browse the repository at this point in the history
…le (#755)

* Change usage of account keeper in lockup module, incentives module

* Remove deref from lockup keeper initialization
  • Loading branch information
mattverse authored Jan 13, 2022
1 parent b180be9 commit 3f1ff44
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,14 @@ func (app *OsmosisApp) InitNormalKeepers() {

app.LockupKeeper = lockupkeeper.NewKeeper(
appCodec, keys[lockuptypes.StoreKey],
// TODO: Visit why this needs to be deref'd
*app.AccountKeeper,
app.AccountKeeper,
app.BankKeeper)

app.EpochsKeeper = epochskeeper.NewKeeper(appCodec, keys[epochstypes.StoreKey])

app.IncentivesKeeper = incentiveskeeper.NewKeeper(
appCodec, keys[incentivestypes.StoreKey],
app.GetSubspace(incentivestypes.ModuleName),
*app.AccountKeeper,
app.BankKeeper, app.LockupKeeper, app.EpochsKeeper)

mintKeeper := mintkeeper.NewKeeper(
Expand Down
5 changes: 1 addition & 4 deletions x/incentives/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/osmosis-labs/osmosis/x/incentives/types"
"github.com/tendermint/tendermint/libs/log"
Expand All @@ -17,13 +16,12 @@ type Keeper struct {
storeKey sdk.StoreKey
paramSpace paramtypes.Subspace
hooks types.IncentiveHooks
ak authkeeper.AccountKeeper
bk types.BankKeeper
lk types.LockupKeeper
ek types.EpochKeeper
}

func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, ak authkeeper.AccountKeeper, bk types.BankKeeper, lk types.LockupKeeper, ek types.EpochKeeper) *Keeper {
func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, bk types.BankKeeper, lk types.LockupKeeper, ek types.EpochKeeper) *Keeper {
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
}
Expand All @@ -32,7 +30,6 @@ func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Sub
cdc: cdc,
storeKey: storeKey,
paramSpace: paramSpace,
ak: ak,
bk: bk,
lk: lk,
ek: ek,
Expand Down
5 changes: 2 additions & 3 deletions x/lockup/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/osmosis-labs/osmosis/x/lockup/types"
)

Expand All @@ -18,12 +17,12 @@ type Keeper struct {

hooks types.LockupHooks

ak authkeeper.AccountKeeper
ak types.AccountKeeper
bk types.BankKeeper
}

// NewKeeper returns an instance of Keeper
func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak authkeeper.AccountKeeper, bk types.BankKeeper) *Keeper {
func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper) *Keeper {
return &Keeper{
cdc: cdc,
storeKey: storeKey,
Expand Down
5 changes: 5 additions & 0 deletions x/lockup/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

type AccountKeeper interface {
GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI
}

// BankKeeper defines the expected interface needed to retrieve account balances.
type BankKeeper interface {
GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
Expand Down

0 comments on commit 3f1ff44

Please sign in to comment.