Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove store type aliases #10295

Merged
merged 23 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update bank/
  • Loading branch information
iverc committed Oct 3, 2021
commit f4cde8e0243841cb9bab0d56f950017a0abe49d3
5 changes: 3 additions & 2 deletions x/bank/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
Expand Down Expand Up @@ -52,7 +53,7 @@ type BaseKeeper struct {

ak types.AccountKeeper
cdc codec.BinaryCodec
storeKey sdk.StoreKey
storeKey storetypes.StoreKey
paramSpace paramtypes.Subspace
}

Expand Down Expand Up @@ -89,7 +90,7 @@ func (k BaseKeeper) GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.P
// by using a SendCoinsFromModuleToAccount execution.
func NewBaseKeeper(
cdc codec.BinaryCodec,
storeKey sdk.StoreKey,
storeKey storetypes.StoreKey,
ak types.AccountKeeper,
paramSpace paramtypes.Subspace,
blockedAddrs map[string]bool,
Expand Down
5 changes: 3 additions & 2 deletions x/bank/keeper/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
Expand Down Expand Up @@ -37,15 +38,15 @@ type BaseSendKeeper struct {

cdc codec.BinaryCodec
ak types.AccountKeeper
storeKey sdk.StoreKey
storeKey storetypes.StoreKey
paramSpace paramtypes.Subspace

// list of addresses that are restricted from receiving transactions
blockedAddrs map[string]bool
}

func NewBaseSendKeeper(
cdc codec.BinaryCodec, storeKey sdk.StoreKey, ak types.AccountKeeper, paramSpace paramtypes.Subspace, blockedAddrs map[string]bool,
cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak types.AccountKeeper, paramSpace paramtypes.Subspace, blockedAddrs map[string]bool,
) BaseSendKeeper {

return BaseSendKeeper{
Expand Down
5 changes: 3 additions & 2 deletions x/bank/keeper/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
Expand Down Expand Up @@ -34,12 +35,12 @@ type ViewKeeper interface {
// BaseViewKeeper implements a read only keeper implementation of ViewKeeper.
type BaseViewKeeper struct {
cdc codec.BinaryCodec
storeKey sdk.StoreKey
storeKey storetypes.StoreKey
ak types.AccountKeeper
}

// NewBaseViewKeeper returns a new BaseViewKeeper.
func NewBaseViewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, ak types.AccountKeeper) BaseViewKeeper {
func NewBaseViewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, ak types.AccountKeeper) BaseViewKeeper {
return BaseViewKeeper{
cdc: cdc,
storeKey: storeKey,
Expand Down
3 changes: 2 additions & 1 deletion x/bank/migrations/v043/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v043
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
v040auth "github.com/cosmos/cosmos-sdk/x/auth/migrations/v040"
v040bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v040"
Expand Down Expand Up @@ -76,7 +77,7 @@ func migrateBalanceKeys(store sdk.KVStore) {
// - Change balances prefix to 1 byte
// - Change supply to be indexed by denom
// - Prune balances & supply with zero coins (ref: https://github.com/cosmos/cosmos-sdk/pull/9229)
func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec) error {
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
store := ctx.KVStore(storeKey)
migrateBalanceKeys(store)

Expand Down
3 changes: 2 additions & 1 deletion x/bank/migrations/v045/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v045
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
v043 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v043"
Expand All @@ -15,7 +16,7 @@ import (
// - Migrate coin storage to save only amount.
// - Add an additional reverse index from denomination to address.
// - Remove duplicate denom from denom metadata store key.
func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec) error {
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
store := ctx.KVStore(storeKey)
err := addDenomReverseIndex(store, cdc)
if err != nil {
Expand Down