x/bank: remove alias.go usage (#6439)
* x/bank: remove alias.go usage * Fix simd_test.go
This commit is contained in:
+8
-6
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
+10
-10
@@ -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
|
||||
|
||||
+2
-2
@@ -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{}},
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user