From 24b9be0ef841303a2e2b6f60042b5da3b74af2ef Mon Sep 17 00:00:00 2001 From: dauTT <30392990+dauTT@users.noreply.github.com> Date: Mon, 15 Jun 2020 01:06:16 +0200 Subject: [PATCH] x/bank: remove alias.go usage (#6439) * x/bank: remove alias.go usage * Fix simd_test.go --- client/tx/tx_test.go | 6 +-- simapp/app.go | 14 ++--- simapp/cmd/simd/genaccounts.go | 10 ++-- simapp/cmd/simd/main.go | 8 +-- simapp/cmd/simd/testnet.go | 20 +++---- simapp/sim_test.go | 4 +- simapp/test_helpers.go | 10 ++-- tests/cli/simd_test.go | 4 +- x/auth/signing/amino/amino_test.go | 4 +- x/auth/signing/handler_map_test.go | 4 +- x/bank/alias.go | 75 --------------------------- x/bank/genesis.go | 17 +++--- x/bank/keeper/grpc_query_test.go | 5 +- x/bank/keeper/keeper_test.go | 16 +++--- x/bank/keeper/querier_test.go | 5 +- x/bank/module.go | 24 ++++----- x/capability/keeper/keeper_test.go | 20 +++---- x/crisis/handler_test.go | 4 +- x/distribution/keeper/querier_test.go | 4 +- x/evidence/keeper/keeper_test.go | 4 +- x/gov/genesis_test.go | 3 +- x/ibc-transfer/handler_test.go | 4 +- x/ibc-transfer/keeper/relay_test.go | 4 +- x/slashing/app_test.go | 4 +- x/staking/app_test.go | 4 +- x/staking/genesis_test.go | 4 +- x/staking/handler_test.go | 4 +- x/staking/keeper/slash_test.go | 4 +- x/staking/keeper/validator_test.go | 4 +- 29 files changed, 110 insertions(+), 183 deletions(-) delete mode 100644 x/bank/alias.go diff --git a/client/tx/tx_test.go b/client/tx/tx_test.go index f12916de569c..5440060a63bb 100644 --- a/client/tx/tx_test.go +++ b/client/tx/tx_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) func NewTestTxGenerator() client.TxGenerator { @@ -86,7 +86,7 @@ func TestBuildSimTx(t *testing.T) { WithMemo("memo"). WithChainID("test-chain") - msg := bank.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) bz, err := tx.BuildSimTx(txf, msg) require.NoError(t, err) require.NotNil(t, bz) @@ -101,7 +101,7 @@ func TestBuildUnsignedTx(t *testing.T) { WithMemo("memo"). WithChainID("test-chain") - msg := bank.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) + msg := banktypes.NewMsgSend(sdk.AccAddress("from"), sdk.AccAddress("to"), nil) tx, err := tx.BuildUnsignedTx(txf, msg) require.NoError(t, err) require.NotNil(t, tx) diff --git a/simapp/app.go b/simapp/app.go index e2527ce21dde..4825e949cfdb 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -20,6 +20,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/capability" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" @@ -137,7 +139,7 @@ type SimApp struct { // keepers AccountKeeper auth.AccountKeeper - BankKeeper bank.Keeper + BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper @@ -176,7 +178,7 @@ func NewSimApp( bApp.SetAppVersion(version.Version) keys := sdk.NewKVStoreKeys( - auth.StoreKey, bank.StoreKey, stakingtypes.StoreKey, + auth.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, @@ -198,7 +200,7 @@ func NewSimApp( // init params keeper and subspaces app.ParamsKeeper = paramskeeper.NewKeeper(appCodec, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) app.subspaces[auth.ModuleName] = app.ParamsKeeper.Subspace(auth.DefaultParamspace) - app.subspaces[bank.ModuleName] = app.ParamsKeeper.Subspace(bank.DefaultParamspace) + app.subspaces[banktypes.ModuleName] = app.ParamsKeeper.Subspace(banktypes.DefaultParamspace) app.subspaces[stakingtypes.ModuleName] = app.ParamsKeeper.Subspace(stakingkeeper.DefaultParamspace) app.subspaces[minttypes.ModuleName] = app.ParamsKeeper.Subspace(minttypes.DefaultParamspace) app.subspaces[distrtypes.ModuleName] = app.ParamsKeeper.Subspace(distrtypes.DefaultParamspace) @@ -218,8 +220,8 @@ func NewSimApp( app.AccountKeeper = auth.NewAccountKeeper( appCodec, keys[auth.StoreKey], app.subspaces[auth.ModuleName], auth.ProtoBaseAccount, maccPerms, ) - app.BankKeeper = bank.NewBaseKeeper( - appCodec, keys[bank.StoreKey], app.AccountKeeper, app.subspaces[bank.ModuleName], app.BlacklistedAccAddrs(), + app.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.subspaces[banktypes.ModuleName], app.BlacklistedAccAddrs(), ) stakingKeeper := stakingkeeper.NewKeeper( appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.subspaces[stakingtypes.ModuleName], @@ -323,7 +325,7 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. app.mm.SetOrderInitGenesis( - capabilitytypes.ModuleName, auth.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, bank.ModuleName, + capabilitytypes.ModuleName, auth.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, banktypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, ibchost.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, ibctransfertypes.ModuleName, ) diff --git a/simapp/cmd/simd/genaccounts.go b/simapp/cmd/simd/genaccounts.go index d6812e960675..1de165d8c57a 100644 --- a/simapp/cmd/simd/genaccounts.go +++ b/simapp/cmd/simd/genaccounts.go @@ -21,7 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/types" authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" ) @@ -88,7 +88,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa // create concrete account type based on input parameters var genAccount types.GenesisAccount - balances := bank.Balance{Address: addr, Coins: coins.Sort()} + balances := banktypes.Balance{Address: addr, Coins: coins.Sort()} baseAccount := auth.NewBaseAccount(addr, nil, 0, 0) if !vestingAmt.IsZero() { baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) @@ -140,16 +140,16 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa appState[auth.ModuleName] = authGenStateBz - bankGenState := bank.GetGenesisStateFromAppState(depCdc, appState) + bankGenState := banktypes.GetGenesisStateFromAppState(depCdc, appState) bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Balances = bank.SanitizeGenesisBalances(bankGenState.Balances) + bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) bankGenStateBz, err := cdc.MarshalJSON(bankGenState) if err != nil { return fmt.Errorf("failed to marshal bank genesis state: %w", err) } - appState[bank.ModuleName] = bankGenStateBz + appState[banktypes.ModuleName] = bankGenStateBz appStateJSON, err := cdc.MarshalJSON(appState) if err != nil { diff --git a/simapp/cmd/simd/main.go b/simapp/cmd/simd/main.go index 3d45869b6ba9..646595a3368e 100644 --- a/simapp/cmd/simd/main.go +++ b/simapp/cmd/simd/main.go @@ -19,7 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" ) @@ -47,16 +47,16 @@ func main() { rootCmd.AddCommand( genutilcli.InitCmd(ctx, cdc, simapp.ModuleBasics, simapp.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(ctx, cdc, bank.GenesisBalancesIterator{}, simapp.DefaultNodeHome), + genutilcli.CollectGenTxsCmd(ctx, cdc, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome), genutilcli.MigrateGenesisCmd(ctx, cdc), genutilcli.GenTxCmd( ctx, cdc, simapp.ModuleBasics, staking.AppModuleBasic{}, - bank.GenesisBalancesIterator{}, simapp.DefaultNodeHome, simapp.DefaultCLIHome, + banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome, simapp.DefaultCLIHome, ), genutilcli.ValidateGenesisCmd(ctx, cdc, simapp.ModuleBasics), AddGenesisAccountCmd(ctx, cdc, appCodec, simapp.DefaultNodeHome, simapp.DefaultCLIHome), flags.NewCompletionCmd(rootCmd, true), - testnetCmd(ctx, cdc, simapp.ModuleBasics, bank.GenesisBalancesIterator{}), + testnetCmd(ctx, cdc, simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(cdc)) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) diff --git a/simapp/cmd/simd/testnet.go b/simapp/cmd/simd/testnet.go index 048f4850f14b..96b94e2df0ae 100644 --- a/simapp/cmd/simd/testnet.go +++ b/simapp/cmd/simd/testnet.go @@ -29,7 +29,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -46,7 +46,7 @@ var ( // get cmd to initialize all files for tendermint testnet and application func testnetCmd(ctx *server.Context, cdc codec.JSONMarshaler, - mbm module.BasicManager, genBalIterator bank.GenesisBalancesIterator, + mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator, ) *cobra.Command { cmd := &cobra.Command{ @@ -106,7 +106,7 @@ const nodeDirPerm = 0755 // Initialize the testnet func InitTestnet( cmd *cobra.Command, config *tmconfig.Config, cdc codec.JSONMarshaler, - mbm module.BasicManager, genBalIterator bank.GenesisBalancesIterator, + mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator, outputDir, chainID, minGasPrices, nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress string, numValidators int, ) error { @@ -124,7 +124,7 @@ func InitTestnet( var ( genAccounts []authtypes.GenesisAccount - genBalances []bank.Balance + genBalances []banktypes.Balance genFiles []string ) @@ -203,7 +203,7 @@ func InitTestnet( sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), } - genBalances = append(genBalances, bank.Balance{Address: addr, Coins: coins.Sort()}) + genBalances = append(genBalances, banktypes.Balance{Address: addr, Coins: coins.Sort()}) genAccounts = append(genAccounts, auth.NewBaseAccount(addr, nil, 0, 0)) valTokens := sdk.TokensFromConsensusPower(100) @@ -258,7 +258,7 @@ func InitTestnet( func initGenFiles( cdc codec.JSONMarshaler, mbm module.BasicManager, chainID string, - genAccounts []authtypes.GenesisAccount, genBalances []bank.Balance, + genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, genFiles []string, numValidators int, ) error { @@ -272,11 +272,11 @@ func initGenFiles( appGenState[auth.ModuleName] = cdc.MustMarshalJSON(authGenState) // set the balances in the genesis state - var bankGenState bank.GenesisState - cdc.MustUnmarshalJSON(appGenState[bank.ModuleName], &bankGenState) + var bankGenState banktypes.GenesisState + cdc.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState) bankGenState.Balances = genBalances - appGenState[bank.ModuleName] = cdc.MustMarshalJSON(bankGenState) + appGenState[banktypes.ModuleName] = cdc.MustMarshalJSON(bankGenState) appGenStateJSON, err := codec.MarshalJSONIndent(cdc, appGenState) if err != nil { @@ -302,7 +302,7 @@ func collectGenFiles( cdc codec.JSONMarshaler, config *tmconfig.Config, chainID string, monikers, nodeIDs []string, valPubKeys []crypto.PubKey, numValidators int, outputDir, nodeDirPrefix, nodeDaemonHome string, - genBalIterator bank.GenesisBalancesIterator, + genBalIterator banktypes.GenesisBalancesIterator, ) error { var appState json.RawMessage diff --git a/simapp/sim_test.go b/simapp/sim_test.go index 720511aa9459..c2da7af2696b 100644 --- a/simapp/sim_test.go +++ b/simapp/sim_test.go @@ -18,7 +18,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" @@ -157,7 +157,7 @@ func TestAppImportExport(t *testing.T) { {app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}}, {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}}, {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}}, - {app.keys[bank.StoreKey], newApp.keys[bank.StoreKey], [][]byte{bank.BalancesPrefix}}, + {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, {app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}}, {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}}, {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index 7b17fe743044..39b384aae302 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -20,7 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) // DefaultConsensusParams defines the default Tendermint consensus params used in @@ -69,7 +69,7 @@ func Setup(isCheckTx bool) *SimApp { // SetupWithGenesisAccounts initializes a new SimApp with the provided genesis // accounts and possible balances. -func SetupWithGenesisAccounts(genAccs []auth.GenesisAccount, balances ...bank.Balance) *SimApp { +func SetupWithGenesisAccounts(genAccs []auth.GenesisAccount, balances ...banktypes.Balance) *SimApp { db := dbm.NewMemDB() app := NewSimApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0) @@ -84,8 +84,8 @@ func SetupWithGenesisAccounts(genAccs []auth.GenesisAccount, balances ...bank.Ba totalSupply = totalSupply.Add(b.Coins...) } - bankGenesis := bank.NewGenesisState(bank.DefaultGenesisState().SendEnabled, balances, totalSupply) - genesisState[bank.ModuleName] = app.Codec().MustMarshalJSON(bankGenesis) + bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().SendEnabled, balances, totalSupply) + genesisState[banktypes.ModuleName] = app.Codec().MustMarshalJSON(bankGenesis) stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState) if err != nil { @@ -157,7 +157,7 @@ func AddTestAddrsFromPubKeys(app *SimApp, ctx sdk.Context, pubKeys []crypto.PubK func setTotalSupply(app *SimApp, ctx sdk.Context, accAmt sdk.Int, totalAccounts int) { totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt.MulRaw(int64(totalAccounts)))) prevSupply := app.BankKeeper.GetSupply(ctx) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(prevSupply.GetTotal().Add(totalSupply...))) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(prevSupply.GetTotal().Add(totalSupply...))) } // AddTestAddrs constructs and returns accNum amount of accounts with an diff --git a/tests/cli/simd_test.go b/tests/cli/simd_test.go index 2be36dc8e93a..9d87602a26c1 100644 --- a/tests/cli/simd_test.go +++ b/tests/cli/simd_test.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/tests/cli" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) func TestCLISimdCollectGentxs(t *testing.T) { @@ -103,7 +103,7 @@ func TestCLISimdAddGenesisAccount(t *testing.T) { appCodec := std.NewAppCodec(f.Cdc, interfaceRegistry) accounts := auth.GetGenesisStateFromAppState(appCodec, genesisState).Accounts - balances := bank.GetGenesisStateFromAppState(f.Cdc, genesisState).Balances + balances := banktypes.GetGenesisStateFromAppState(f.Cdc, genesisState).Balances balancesSet := make(map[string]sdk.Coins) for _, b := range balances { diff --git a/x/auth/signing/amino/amino_test.go b/x/auth/signing/amino/amino_test.go index 3e073ae881af..7faa937f31b4 100644 --- a/x/auth/signing/amino/amino_test.go +++ b/x/auth/signing/amino/amino_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/cosmos/cosmos-sdk/x/auth/signing/amino" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { @@ -29,7 +29,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { } memo := "foo" msgs := []sdk.Msg{ - &bank.MsgSend{ + &banktypes.MsgSend{ FromAddress: addr1, ToAddress: addr2, Amount: coins, diff --git a/x/auth/signing/handler_map_test.go b/x/auth/signing/handler_map_test.go index 9c8d516eebed..9e964693b616 100644 --- a/x/auth/signing/handler_map_test.go +++ b/x/auth/signing/handler_map_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/cosmos/cosmos-sdk/x/auth/signing/amino" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) func MakeTestHandlerMap() signing.SignModeHandler { @@ -38,7 +38,7 @@ func TestHandlerMap_GetSignBytes(t *testing.T) { } memo := "foo" msgs := []sdk.Msg{ - &bank.MsgSend{ + &banktypes.MsgSend{ FromAddress: addr1, ToAddress: addr2, Amount: coins, diff --git a/x/bank/alias.go b/x/bank/alias.go deleted file mode 100644 index 2f488253397c..000000000000 --- a/x/bank/alias.go +++ /dev/null @@ -1,75 +0,0 @@ -package bank - -import ( - "github.com/cosmos/cosmos-sdk/x/bank/keeper" - "github.com/cosmos/cosmos-sdk/x/bank/types" -) - -const ( - QueryBalance = types.QueryBalance - QueryAllBalances = types.QueryAllBalances - DefaultParamspace = types.DefaultParamspace - DefaultSendEnabled = types.DefaultSendEnabled - - EventTypeTransfer = types.EventTypeTransfer - AttributeKeyRecipient = types.AttributeKeyRecipient - AttributeKeySender = types.AttributeKeySender - AttributeValueCategory = types.AttributeValueCategory - - ModuleName = types.ModuleName - StoreKey = types.StoreKey - RouterKey = types.RouterKey - QuerierRoute = types.QuerierRoute -) - -var ( - RegisterInvariants = keeper.RegisterInvariants - NonnegativeBalanceInvariant = keeper.NonnegativeBalanceInvariant - NewBaseKeeper = keeper.NewBaseKeeper - NewBaseSendKeeper = keeper.NewBaseSendKeeper - NewBaseViewKeeper = keeper.NewBaseViewKeeper - RegisterCodec = types.RegisterCodec - ErrNoInputs = types.ErrNoInputs - ErrNoOutputs = types.ErrNoOutputs - ErrInputOutputMismatch = types.ErrInputOutputMismatch - ErrSendDisabled = types.ErrSendDisabled - NewGenesisState = types.NewGenesisState - DefaultGenesisState = types.DefaultGenesisState - SanitizeGenesisBalances = types.SanitizeGenesisBalances - GetGenesisStateFromAppState = types.GetGenesisStateFromAppState - NewMsgSend = types.NewMsgSend - NewMsgMultiSend = types.NewMsgMultiSend - NewInput = types.NewInput - NewOutput = types.NewOutput - ValidateInputsOutputs = types.ValidateInputsOutputs - ParamKeyTable = types.ParamKeyTable - NewQueryBalanceRequest = types.NewQueryBalanceRequest - NewQueryAllBalancesRequest = types.NewQueryAllBalancesRequest - ModuleCdc = types.ModuleCdc - ParamStoreKeySendEnabled = types.ParamStoreKeySendEnabled - BalancesPrefix = types.BalancesPrefix - AddressFromBalancesStore = types.AddressFromBalancesStore - AllInvariants = keeper.AllInvariants - TotalSupply = keeper.TotalSupply - NewSupply = types.NewSupply - DefaultSupply = types.DefaultSupply -) - -type ( - BaseKeeper = keeper.BaseKeeper - SendKeeper = keeper.SendKeeper - BaseSendKeeper = keeper.BaseSendKeeper - ViewKeeper = keeper.ViewKeeper - BaseViewKeeper = keeper.BaseViewKeeper - Balance = types.Balance - MsgSend = types.MsgSend - MsgMultiSend = types.MsgMultiSend - Input = types.Input - Output = types.Output - QueryBalanceRequest = types.QueryBalanceRequest - QueryAllBalancesRequest = types.QueryAllBalancesRequest - GenesisBalancesIterator = types.GenesisBalancesIterator - Keeper = keeper.Keeper - GenesisState = types.GenesisState - Supply = types.Supply -) diff --git a/x/bank/genesis.go b/x/bank/genesis.go index 18f8d19fdb3f..89e3e9525eb4 100644 --- a/x/bank/genesis.go +++ b/x/bank/genesis.go @@ -4,16 +4,17 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/cosmos/cosmos-sdk/x/bank/types" ) // InitGenesis initializes the bank module's state from a given genesis state. -func InitGenesis(ctx sdk.Context, keeper Keeper, genState GenesisState) { +func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, genState types.GenesisState) { keeper.SetSendEnabled(ctx, genState.SendEnabled) var totalSupply sdk.Coins - genState.Balances = SanitizeGenesisBalances(genState.Balances) + genState.Balances = types.SanitizeGenesisBalances(genState.Balances) for _, balance := range genState.Balances { if err := keeper.ValidateBalance(ctx, balance.Address); err != nil { panic(err) @@ -30,11 +31,11 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, genState GenesisState) { genState.Supply = totalSupply } - keeper.SetSupply(ctx, NewSupply(genState.Supply)) + keeper.SetSupply(ctx, types.NewSupply(genState.Supply)) } // ExportGenesis returns the bank module's genesis state. -func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState { +func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { balancesSet := make(map[string]sdk.Coins) keeper.IterateAllBalances(ctx, func(addr sdk.AccAddress, balance sdk.Coin) bool { @@ -42,7 +43,7 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState { return false }) - balances := []Balance{} + balances := []types.Balance{} for addrStr, coins := range balancesSet { addr, err := sdk.AccAddressFromBech32(addrStr) @@ -50,17 +51,17 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState { panic(fmt.Errorf("failed to convert address from string: %w", err)) } - balances = append(balances, Balance{ + balances = append(balances, types.Balance{ Address: addr, Coins: coins, }) } - return NewGenesisState(keeper.GetSendEnabled(ctx), balances, keeper.GetSupply(ctx).GetTotal()) + return types.NewGenesisState(keeper.GetSendEnabled(ctx), balances, keeper.GetSupply(ctx).GetTotal()) } // ValidateGenesis performs basic validation of supply genesis data returning an // error for any failed validation criteria. -func ValidateGenesis(data GenesisState) error { +func ValidateGenesis(data types.GenesisState) error { return types.NewSupply(data.Supply).ValidateBasic() } diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index fe85170abd5e..e25f2a6ac364 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -73,7 +72,7 @@ func (suite *IntegrationTestSuite) TestQueryAllBalances() { func (suite *IntegrationTestSuite) TestQueryTotalSupply() { app, ctx := suite.app, suite.ctx - expectedTotalSupply := bank.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) + expectedTotalSupply := types.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) queryHelper := baseapp.NewQueryServerTestHelper(ctx) @@ -92,7 +91,7 @@ func (suite *IntegrationTestSuite) TestQueryTotalSupplyOf() { test1Supply := sdk.NewInt64Coin("test1", 4000000) test2Supply := sdk.NewInt64Coin("test2", 700000000) - expectedTotalSupply := bank.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) + expectedTotalSupply := types.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) queryHelper := baseapp.NewQueryServerTestHelper(ctx) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index ed1fa4a558d9..3be4cdd4c83c 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -13,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - "github.com/cosmos/cosmos-sdk/x/bank" + "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -46,7 +46,7 @@ func newBarCoin(amt int64) sdk.Coin { } // nolint: interfacer -func getCoinsByName(ctx sdk.Context, bk bank.Keeper, ak types.AccountKeeper, moduleName string) sdk.Coins { +func getCoinsByName(ctx sdk.Context, bk keeper.Keeper, ak types.AccountKeeper, moduleName string) sdk.Coins { moduleAddress := ak.GetModuleAddress(moduleName) macc := ak.GetAccount(ctx, moduleAddress) if macc == nil { @@ -104,9 +104,9 @@ func (suite *IntegrationTestSuite) TestSupply_SendCoins() { appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName), auth.ProtoBaseAccount, maccPerms, ) - keeper := bank.NewBaseKeeper( + keeper := keeper.NewBaseKeeper( appCodec, app.GetKey(types.StoreKey), authKeeper, - app.GetSubspace(bank.ModuleName), make(map[string]bool), + app.GetSubspace(types.ModuleName), make(map[string]bool), ) baseAcc := authKeeper.NewAccountWithAddress(ctx, auth.NewModuleAddress("baseAcc")) @@ -167,9 +167,9 @@ func (suite *IntegrationTestSuite) TestSupply_MintCoins() { appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName), auth.ProtoBaseAccount, maccPerms, ) - keeper := bank.NewBaseKeeper( + keeper := keeper.NewBaseKeeper( appCodec, app.GetKey(types.StoreKey), authKeeper, - app.GetSubspace(bank.ModuleName), make(map[string]bool), + app.GetSubspace(types.ModuleName), make(map[string]bool), ) authKeeper.SetModuleAccount(ctx, burnerAcc) @@ -221,9 +221,9 @@ func (suite *IntegrationTestSuite) TestSupply_BurnCoins() { appCodec, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName), auth.ProtoBaseAccount, maccPerms, ) - keeper := bank.NewBaseKeeper( + keeper := keeper.NewBaseKeeper( appCodec, app.GetKey(types.StoreKey), authKeeper, - app.GetSubspace(bank.ModuleName), make(map[string]bool), + app.GetSubspace(types.ModuleName), make(map[string]bool), ) suite.Require().NoError(keeper.SetBalances(ctx, burnerAcc.GetAddress(), initCoins)) diff --git a/x/bank/keeper/querier_test.go b/x/bank/keeper/querier_test.go index 74e909a680c2..f7225f98dbe1 100644 --- a/x/bank/keeper/querier_test.go +++ b/x/bank/keeper/querier_test.go @@ -7,7 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/cosmos/cosmos-sdk/x/bank/types" ) @@ -86,7 +85,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryAllBalances() { func (suite *IntegrationTestSuite) TestQuerier_QueryTotalSupply() { app, ctx := suite.app, suite.ctx - expectedTotalSupply := bank.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) + expectedTotalSupply := types.NewSupply(sdk.NewCoins(sdk.NewInt64Coin("test", 400000000))) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) req := abci.RequestQuery{ @@ -115,7 +114,7 @@ func (suite *IntegrationTestSuite) TestQuerier_QueryTotalSupplyOf() { test1Supply := sdk.NewInt64Coin("test1", 4000000) test2Supply := sdk.NewInt64Coin("test2", 700000000) - expectedTotalSupply := bank.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) + expectedTotalSupply := types.NewSupply(sdk.NewCoins(test1Supply, test2Supply)) app.BankKeeper.SetSupply(ctx, expectedTotalSupply) req := abci.RequestQuery{ diff --git a/x/bank/module.go b/x/bank/module.go index 65cd34f6c0fd..d6cc3786576f 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -37,22 +37,22 @@ type AppModuleBasic struct { } // Name returns the bank module's name. -func (AppModuleBasic) Name() string { return ModuleName } +func (AppModuleBasic) Name() string { return types.ModuleName } // RegisterCodec registers the bank module's types for the given codec. -func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { RegisterCodec(cdc) } +func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { types.RegisterCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the bank // module. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage { - return cdc.MustMarshalJSON(DefaultGenesisState()) + return cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the bank module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, bz json.RawMessage) error { - var data GenesisState + var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %w", ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } return ValidateGenesis(data) @@ -84,14 +84,14 @@ func (AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegist type AppModule struct { AppModuleBasic - keeper Keeper + keeper keeper.Keeper accountKeeper types.AccountKeeper } func (am AppModule) RegisterQueryService(grpc.Server) {} // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Marshaler, keeper Keeper, accountKeeper types.AccountKeeper) AppModule { +func NewAppModule(cdc codec.Marshaler, keeper keeper.Keeper, accountKeeper types.AccountKeeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, @@ -100,7 +100,7 @@ func NewAppModule(cdc codec.Marshaler, keeper Keeper, accountKeeper types.Accoun } // Name returns the bank module's name. -func (AppModule) Name() string { return ModuleName } +func (AppModule) Name() string { return types.ModuleName } // RegisterInvariants registers the bank module invariants. func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { @@ -109,11 +109,11 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { // Route returns the message routing key for the bank module. func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(RouterKey, NewHandler(am.keeper)) + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) } // QuerierRoute returns the bank module's querier route name. -func (AppModule) QuerierRoute() string { return RouterKey } +func (AppModule) QuerierRoute() string { return types.RouterKey } // NewQuerierHandler returns the bank module sdk.Querier. func (am AppModule) NewQuerierHandler() sdk.Querier { @@ -123,7 +123,7 @@ func (am AppModule) NewQuerierHandler() sdk.Querier { // InitGenesis performs genesis initialization for the bank module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState GenesisState + var genesisState types.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) InitGenesis(ctx, am.keeper, genesisState) return []abci.ValidatorUpdate{} @@ -166,7 +166,7 @@ func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { // RegisterStoreDecoder registers a decoder for supply module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - sdr[StoreKey] = simulation.NewDecodeStore(am.keeper) + sdr[types.StoreKey] = simulation.NewDecodeStore(am.keeper) } // WeightedOperations returns the all the gov module operations with their respective weights. diff --git a/x/capability/keeper/keeper_test.go b/x/capability/keeper/keeper_test.go index 450380b8f1d2..a09c704b7f28 100644 --- a/x/capability/keeper/keeper_test.go +++ b/x/capability/keeper/keeper_test.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/capability/keeper" "github.com/cosmos/cosmos-sdk/x/capability/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func (suite *KeeperTestSuite) TestInitializeAndSeal() { - sk := suite.keeper.ScopeToModule(bank.ModuleName) + sk := suite.keeper.ScopeToModule(banktypes.ModuleName) caps := make([]*types.Capability, 5) // Get Latest Index before creating new ones to sychronize indices correctly @@ -73,7 +73,7 @@ func (suite *KeeperTestSuite) TestInitializeAndSeal() { } func (suite *KeeperTestSuite) TestNewCapability() { - sk := suite.keeper.ScopeToModule(bank.ModuleName) + sk := suite.keeper.ScopeToModule(banktypes.ModuleName) cap, err := sk.NewCapability(suite.ctx, "transfer") suite.Require().NoError(err) @@ -104,7 +104,7 @@ func (suite *KeeperTestSuite) TestOriginalCapabilityKeeper() { } func (suite *KeeperTestSuite) TestAuthenticateCapability() { - sk1 := suite.keeper.ScopeToModule(bank.ModuleName) + sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) cap1, err := sk1.NewCapability(suite.ctx, "transfer") @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestAuthenticateCapability() { } func (suite *KeeperTestSuite) TestClaimCapability() { - sk1 := suite.keeper.ScopeToModule(bank.ModuleName) + sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) cap, err := sk1.NewCapability(suite.ctx, "transfer") @@ -159,7 +159,7 @@ func (suite *KeeperTestSuite) TestClaimCapability() { } func (suite *KeeperTestSuite) TestGetOwners() { - sk1 := suite.keeper.ScopeToModule(bank.ModuleName) + sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) sk3 := suite.keeper.ScopeToModule("foo") @@ -172,7 +172,7 @@ func (suite *KeeperTestSuite) TestGetOwners() { suite.Require().NoError(sk2.ClaimCapability(suite.ctx, cap, "transfer")) suite.Require().NoError(sk3.ClaimCapability(suite.ctx, cap, "transfer")) - expectedOrder := []string{bank.ModuleName, "foo", stakingtypes.ModuleName} + expectedOrder := []string{banktypes.ModuleName, "foo", stakingtypes.ModuleName} // Ensure all scoped keepers can get owners for _, sk := range sks { owners, ok := sk.GetOwners(suite.ctx, "transfer") @@ -198,7 +198,7 @@ func (suite *KeeperTestSuite) TestGetOwners() { suite.Require().Nil(err, "could not release capability") // new expected order and scoped capabilities - expectedOrder = []string{bank.ModuleName, stakingtypes.ModuleName} + expectedOrder = []string{banktypes.ModuleName, stakingtypes.ModuleName} sks = []keeper.ScopedKeeper{sk1, sk2} // Ensure all scoped keepers can get owners @@ -224,7 +224,7 @@ func (suite *KeeperTestSuite) TestGetOwners() { } func (suite *KeeperTestSuite) TestReleaseCapability() { - sk1 := suite.keeper.ScopeToModule(bank.ModuleName) + sk1 := suite.keeper.ScopeToModule(banktypes.ModuleName) sk2 := suite.keeper.ScopeToModule(stakingtypes.ModuleName) cap1, err := sk1.NewCapability(suite.ctx, "transfer") @@ -251,7 +251,7 @@ func (suite *KeeperTestSuite) TestReleaseCapability() { } func (suite KeeperTestSuite) TestRevertCapability() { - sk := suite.keeper.ScopeToModule(bank.ModuleName) + sk := suite.keeper.ScopeToModule(banktypes.ModuleName) ms := suite.ctx.MultiStore() diff --git a/x/crisis/handler_test.go b/x/crisis/handler_test.go index 564b888e3650..21e92512f89f 100644 --- a/x/crisis/handler_test.go +++ b/x/crisis/handler_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" "github.com/cosmos/cosmos-sdk/x/crisis/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -39,7 +39,7 @@ func createTestApp() (*simapp.SimApp, sdk.Context, []sdk.AccAddress) { feePool := distrtypes.InitialFeePool() feePool.CommunityPool = sdk.NewDecCoinsFromCoins(sdk.NewCoins(constantFee)...) app.DistrKeeper.SetFeePool(ctx, feePool) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(sdk.Coins{})) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(sdk.Coins{})) addrs := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(10000)) diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index 1b6f42973c80..f4cca58e1243 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/staking" @@ -112,7 +112,7 @@ func getQueriedCommunityPool(t *testing.T, ctx sdk.Context, cdc *codec.Codec, qu func TestQueries(t *testing.T) { cdc := codec.New() types.RegisterCodec(cdc) - bank.RegisterCodec(cdc) + banktypes.RegisterCodec(cdc) app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) diff --git a/x/evidence/keeper/keeper_test.go b/x/evidence/keeper/keeper_test.go index 411b5d38d24f..9f1d9ef6fdd9 100644 --- a/x/evidence/keeper/keeper_test.go +++ b/x/evidence/keeper/keeper_test.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/evidence/exported" "github.com/cosmos/cosmos-sdk/x/evidence/keeper" "github.com/cosmos/cosmos-sdk/x/evidence/types" @@ -122,7 +122,7 @@ func (suite *KeeperTestSuite) populateValidators(ctx sdk.Context) { // add accounts and set total supply totalSupplyAmt := initAmt.MulRaw(int64(len(valAddresses))) totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupplyAmt)) - suite.app.BankKeeper.SetSupply(ctx, bank.NewSupply(totalSupply)) + suite.app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(totalSupply)) for _, addr := range valAddresses { _, err := suite.app.BankKeeper.AddCoins(ctx, sdk.AccAddress(addr), initCoins) diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index ba6d5a1f9af4..7e67d21fbc5b 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -12,6 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -57,7 +58,7 @@ func TestImportExportQueues(t *testing.T) { genesisState := simapp.NewDefaultGenesisState() genesisState[auth.ModuleName] = app.AppCodec().MustMarshalJSON(authGenState) - genesisState[bank.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState) + genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState) genesisState[types.ModuleName] = app.AppCodec().MustMarshalJSON(govGenState) stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState) diff --git a/x/ibc-transfer/handler_test.go b/x/ibc-transfer/handler_test.go index 350e76e659b5..21436a17f899 100644 --- a/x/ibc-transfer/handler_test.go +++ b/x/ibc-transfer/handler_test.go @@ -14,7 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" transfer "github.com/cosmos/cosmos-sdk/x/ibc-transfer" "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types" connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" @@ -113,7 +113,7 @@ func (suite *HandlerTestSuite) TestHandleMsgTransfer() { suite.Require().Nil(res, "%+v", res) // incorrect denom prefix msg = types.NewMsgTransfer(testPort1, testChannel1, testPrefixedCoins1, testAddr1, testAddr2.String(), 110, 0) - suite.chainA.App.BankKeeper.SetSupply(ctx, bank.NewSupply(testPrefixedCoins1)) + suite.chainA.App.BankKeeper.SetSupply(ctx, banktypes.NewSupply(testPrefixedCoins1)) _ = suite.chainA.App.BankKeeper.SetBalances(ctx, testAddr1, testPrefixedCoins1) res, err = handler(ctx, msg) diff --git a/x/ibc-transfer/keeper/relay_test.go b/x/ibc-transfer/keeper/relay_test.go index edb49363e0d5..43a3125e1268 100644 --- a/x/ibc-transfer/keeper/relay_test.go +++ b/x/ibc-transfer/keeper/relay_test.go @@ -4,7 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types" connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection" channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" @@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() { }, true, true}, {"successful transfer from external chain", prefixCoins, func() { - suite.chainA.App.BankKeeper.SetSupply(suite.chainA.GetContext(), bank.NewSupply(prefixCoins)) + suite.chainA.App.BankKeeper.SetSupply(suite.chainA.GetContext(), banktypes.NewSupply(prefixCoins)) _, err := suite.chainA.App.BankKeeper.AddCoins(suite.chainA.GetContext(), testAddr1, prefixCoins) suite.Require().NoError(err) suite.chainA.CreateClient(suite.chainB) diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index 400c5b712eef..07495cc8224e 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -46,7 +46,7 @@ func TestSlashingMsgs(t *testing.T) { Address: addr1, } accs := authtypes.GenesisAccounts{acc1} - balances := []bank.Balance{ + balances := []banktypes.Balance{ { Address: addr1, Coins: sdk.Coins{genCoin}, diff --git a/x/staking/app_test.go b/x/staking/app_test.go index 6cc5a2083160..11d5fefdf448 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -47,7 +47,7 @@ func TestStakingMsgs(t *testing.T) { acc1 := &auth.BaseAccount{Address: addr1} acc2 := &auth.BaseAccount{Address: addr2} accs := auth.GenesisAccounts{acc1, acc2} - balances := []bank.Balance{ + balances := []banktypes.Balance{ { Address: addr1, Coins: sdk.Coins{genCoin}, diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index 17d011cd0ed4..fdd580bc6026 100644 --- a/x/staking/genesis_test.go +++ b/x/staking/genesis_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -29,7 +29,7 @@ func bootstrapGenesisTest(t *testing.T, power int64, numAddrs int) (*simapp.SimA require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(totalSupply)) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(totalSupply)) return app, ctx, addrDels } diff --git a/x/staking/handler_test.go b/x/staking/handler_test.go index 7358c8e46f73..9c8404269848 100644 --- a/x/staking/handler_test.go +++ b/x/staking/handler_test.go @@ -15,7 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -34,7 +34,7 @@ func bootstrapHandlerGenesisTest(t *testing.T, power int64, numAddrs int, accAmo require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(totalSupply)) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(totalSupply)) return app, ctx, addrDels, addrVals } diff --git a/x/staking/keeper/slash_test.go b/x/staking/keeper/slash_test.go index 9aa9e751fe7a..d6f1e06a7e86 100644 --- a/x/staking/keeper/slash_test.go +++ b/x/staking/keeper/slash_test.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -38,7 +38,7 @@ func bootstrapSlashTest(t *testing.T, power int64) (*simapp.SimApp, sdk.Context, require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(totalSupply)) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(totalSupply)) for i := int64(0); i < numVals; i++ { validator := types.NewValidator(addrVals[i], PKs[i], types.Description{}) diff --git a/x/staking/keeper/validator_test.go b/x/staking/keeper/validator_test.go index d532a4ee173d..ce34b0d23439 100644 --- a/x/staking/keeper/validator_test.go +++ b/x/staking/keeper/validator_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -29,7 +29,7 @@ func bootstrapValidatorTest(t *testing.T, power int64, numAddrs int) (*simapp.Si require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) - app.BankKeeper.SetSupply(ctx, bank.NewSupply(totalSupply)) + app.BankKeeper.SetSupply(ctx, banktypes.NewSupply(totalSupply)) return app, ctx, addrDels, addrVals }