testutil

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: LGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.

The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/xpladev/ethermint/blob/main/LICENSE

Index

Constants

View Source
const (
	// TestnetChainID defines the Evmos EIP155 chain ID for testnet
	TestnetChainID = "ethermint_9000"
	// BaseDenom defines the Evmos mainnet denomination
	BaseDenom = "aphoton"
)

Variables

This section is empty.

Functions

func BroadcastTxBytes

func BroadcastTxBytes(app *app.EthermintApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci.ResponseDeliverTx, error)

BroadcastTxBytes encodes a transaction and calls DeliverTx on the app.

func CheckEthTx

func CheckEthTx(
	appEvmos *app.EthermintApp,
	priv cryptotypes.PrivKey,
	msgs ...sdk.Msg,
) (abci.ResponseCheckTx, error)

CheckEthTx checks a Ethereum tx for a given set of msgs

func CheckEthTxResponse

func CheckEthTxResponse(r abci.ResponseDeliverTx, cdc codec.Codec) (*evm.MsgEthereumTxResponse, error)

CheckEthTxResponse checks that the transaction was executed successfully

func CheckTx

func CheckTx(
	ctx sdk.Context,
	appEvmos *app.EthermintApp,
	priv cryptotypes.PrivKey,
	gasPrice *sdkmath.Int,
	msgs ...sdk.Msg,
) (abci.ResponseCheckTx, error)

CheckTx checks a cosmos tx for a given set of msgs

func Commit

Commit commits a block at a given time. Reminder: At the end of each Tendermint Consensus round the following methods are run

  1. BeginBlock
  2. DeliverTx
  3. EndBlock
  4. Commit

func Delegate

func Delegate(
	ctx sdk.Context,
	appEvmos *app.EthermintApp,
	priv *ethsecp256k1.PrivKey,
	delegateAmount sdk.Coin,
	validator stakingtypes.Validator,
) (abci.ResponseDeliverTx, error)

Delegate delivers a delegate tx

func DeliverEthTx

func DeliverEthTx(
	appEvmos *app.EthermintApp,
	priv cryptotypes.PrivKey,
	msgs ...sdk.Msg,
) (abci.ResponseDeliverTx, error)

DeliverEthTx generates and broadcasts a Cosmos Tx populated with MsgEthereumTx messages. If a private key is provided, it will attempt to sign all messages with the given private key, otherwise, it will assume the messages have already been signed.

func DeliverTx

func DeliverTx(
	ctx sdk.Context,
	appEvmos *app.EthermintApp,
	priv cryptotypes.PrivKey,
	gasPrice *sdkmath.Int,
	msgs ...sdk.Msg,
) (abci.ResponseDeliverTx, error)

DeliverTx delivers a cosmos tx for a given set of msgs

func DeployContract

func DeployContract(
	ctx sdk.Context,
	evmosApp *app.EthermintApp,
	priv cryptotypes.PrivKey,
	queryClientEvm evm.QueryClient,
	contract evm.CompiledContract,
	constructorArgs ...interface{},
) (common.Address, error)

DeployContract deploys a contract with the provided private key, compiled contract data and constructor arguments

func DeployContractWithFactory

func DeployContractWithFactory(
	ctx sdk.Context,
	evmosApp *app.EthermintApp,
	priv cryptotypes.PrivKey,
	factoryAddress common.Address,
) (common.Address, abci.ResponseDeliverTx, error)

DeployContractWithFactory deploys a contract using a contract factory with the provided factoryAddress

func FundAccount

func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error

FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!

func FundModuleAccount

func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error

FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address. This should be used for testing purposes only!

func NewHeader

func NewHeader(
	height int64,
	blockTime time.Time,
	chainID string,
	proposer sdk.ConsAddress,
	appHash,
	validatorHash []byte,
) tmproto.Header

NewHeader creates a new Tendermint header for testing purposes.

func SubmitProposal

func SubmitProposal(
	ctx sdk.Context,
	appEvmos *app.EthermintApp,
	pk *ethsecp256k1.PrivKey,
	content govv1beta1.Content,
	eventNum int,
) (id uint64, err error)

SubmitProposal delivers a submit proposal tx for a given gov content. Depending on the content type, the eventNum needs to specify submit_proposal event.

func Vote

func Vote(
	ctx sdk.Context,
	appEvmos *app.EthermintApp,
	priv *ethsecp256k1.PrivKey,
	proposalID uint64,
	voteOption govv1beta1.VoteOption,
) (abci.ResponseDeliverTx, error)

Vote delivers a vote tx with the VoteOption "yes"

Types

This section is empty.

Directories

Path Synopsis
// Copyright 2021 Evmos Foundation // This file is part of Evmos' Ethermint library.
// Copyright 2021 Evmos Foundation // This file is part of Evmos' Ethermint library.

Jump to

Keyboard shortcuts

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