evm: fix keeper tests (#516)

* evm: fix keeper tests

* rm func

* fix
This commit is contained in:
Federico Kunze Küllmer 2021-09-02 10:42:55 +02:00 committed by GitHub
parent 7f70429ac2
commit 22623a4090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,11 +14,8 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/tharsis/ethermint/app"
@ -150,13 +147,6 @@ func (suite *KeeperTestSuite) DoSetupTest(t require.TestingT) {
suite.clientCtx = client.Context{}.WithTxConfig(encodingConfig.TxConfig)
suite.ethSigner = ethtypes.LatestSignerForChainID(suite.app.EvmKeeper.ChainID())
suite.appCodec = encodingConfig.Marshaler
// mint some tokens to coinbase address
_, bankKeeper := suite.initKeepersWithmAccPerms()
require.NoError(t, err)
initCoin := sdk.NewCoins(sdk.NewCoin(suite.EvmDenom(), testTokens))
err = simapp.FundAccount(bankKeeper, suite.ctx, acc.GetAddress(), initCoin)
require.NoError(t, err)
}
func (suite *KeeperTestSuite) SetupTest() {
@ -187,24 +177,6 @@ func (suite *KeeperTestSuite) Commit() {
suite.queryClient = types.NewQueryClient(queryHelper)
}
// initKeepersWithmAccPerms construct a bank keeper that can mint tokens out of thin air
func (suite *KeeperTestSuite) initKeepersWithmAccPerms() (authkeeper.AccountKeeper, bankkeeper.BaseKeeper) {
maccPerms := app.GetMaccPerms()
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
maccPerms[authtypes.Minter] = []string{authtypes.Minter}
authKeeper := authkeeper.NewAccountKeeper(
suite.appCodec, suite.app.GetKey(types.StoreKey), suite.app.GetSubspace(types.ModuleName),
authtypes.ProtoBaseAccount, maccPerms,
)
keeper := bankkeeper.NewBaseKeeper(
suite.appCodec, suite.app.GetKey(types.StoreKey), authKeeper,
suite.app.GetSubspace(types.ModuleName), map[string]bool{},
)
return authKeeper, keeper
}
// DeployTestContract deploy a test erc20 contract and returns the contract address
func (suite *KeeperTestSuite) DeployTestContract(t require.TestingT, owner common.Address, supply *big.Int) common.Address {
ctx := sdk.WrapSDKContext(suite.ctx)