testutil

package
v0.0.0-...-853bff8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewInternalEVMAddressFromString

func MustNewInternalEVMAddressFromString(addrStr string) types.InternalEVMAddress

MustNewInternalEVMAddressFromString returns a new InternalEVMAddress from a hex string. This will panic if the input hex string is invalid.

func RandomEvmAccount

func RandomEvmAccount() (common.Address, *ethsecp256k1.PrivKey)

func RandomEvmAddress

func RandomEvmAddress() common.Address

func RandomInternalEVMAddress

func RandomInternalEVMAddress() types.InternalEVMAddress

Types

type Suite

type Suite struct {
	suite.Suite

	App            app.TestApp
	Ctx            sdk.Context
	Address        common.Address
	BankKeeper     bankkeeper.Keeper
	AccountKeeper  authkeeper.AccountKeeper
	Keeper         keeper.Keeper
	EvmBankKeeper  keeper.EvmBankKeeper
	Addrs          []sdk.AccAddress
	EvmModuleAddr  sdk.AccAddress
	QueryClient    types.QueryClient
	QueryClientEvm evmtypes.QueryClient
	Key1           *ethsecp256k1.PrivKey
	Key1Addr       types.InternalEVMAddress
	Key2           *ethsecp256k1.PrivKey
}

func (*Suite) Commit

func (suite *Suite) Commit()

func (*Suite) DeployERC20

func (suite *Suite) DeployERC20() types.InternalEVMAddress

func (*Suite) EventsContains

func (suite *Suite) EventsContains(events sdk.Events, expectedEvent sdk.Event)

EventsContains asserts that the expected event is in the provided events

func (*Suite) EventsDoNotContain

func (suite *Suite) EventsDoNotContain(events sdk.Events, eventType string)

EventsDoNotContain asserts that the event is **not** is in the provided events

func (*Suite) FundAccountWithBlack

func (suite *Suite) FundAccountWithBlack(addr sdk.AccAddress, coins sdk.Coins)

func (*Suite) FundModuleAccountWithBlack

func (suite *Suite) FundModuleAccountWithBlack(moduleName string, coins sdk.Coins)

func (*Suite) GetERC20BalanceOf

func (suite *Suite) GetERC20BalanceOf(
	contractAbi abi.ABI,
	contractAddr types.InternalEVMAddress,
	accountAddr types.InternalEVMAddress,
) *big.Int

func (*Suite) GetEvents

func (suite *Suite) GetEvents() sdk.Events

GetEvents returns emitted events on the sdk context

func (*Suite) MintFeeCollector

func (suite *Suite) MintFeeCollector(coins sdk.Coins)

func (*Suite) ModuleBalance

func (suite *Suite) ModuleBalance(denom string) sdk.Int

func (*Suite) QueryContract

func (suite *Suite) QueryContract(
	contractAbi abi.ABI,
	from common.Address,
	fromKey *ethsecp256k1.PrivKey,
	contract types.InternalEVMAddress,
	method string,
	args ...interface{},
) ([]interface{}, error)

func (*Suite) SendTx

func (suite *Suite) SendTx(
	contractAddr types.InternalEVMAddress,
	from common.Address,
	signerKey *ethsecp256k1.PrivKey,
	transferData []byte,
) (*evmtypes.MsgEthereumTxResponse, error)

SendTx submits a transaction to the block.

func (*Suite) SetupTest

func (suite *Suite) SetupTest()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL