Documentation
¶
Index ¶
- func CheckError(err error, logCheckArgs testutil.LogCheckArgs) error
- type CallArgs
- type ContractDeploymentData
- type CosmosTxArgs
- type IntegrationTxFactory
- func (tf *IntegrationTxFactory) CallContractAndCheckLogs(priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs, ...) (abcitypes.ExecTxResult, *evmtypes.MsgEthereumTxResponse, error)
- func (tf *IntegrationTxFactory) DeployContract(priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, ...) (common.Address, error)
- func (tf *IntegrationTxFactory) EstimateGasLimit(from *common.Address, txArgs *evmtypes.EvmTxArgs) (uint64, error)
- func (tf *IntegrationTxFactory) ExecuteContractCall(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs) (abcitypes.ExecTxResult, error)
- func (tf *IntegrationTxFactory) ExecuteEthTx(priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (abcitypes.ExecTxResult, error)
- func (tf *IntegrationTxFactory) GenerateContractCallArgs(txArgs evmtypes.EvmTxArgs, callArgs CallArgs) (evmtypes.EvmTxArgs, error)
- func (tf *IntegrationTxFactory) GenerateDefaultTxTypeArgs(sender common.Address, txType int) (evmtypes.EvmTxArgs, error)
- func (tf *IntegrationTxFactory) GenerateDeployContractArgs(from common.Address, txArgs evmtypes.EvmTxArgs, ...) (evmtypes.EvmTxArgs, error)
- func (tf *IntegrationTxFactory) GenerateGethCoreMsg(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (core.Message, error)
- func (tf *IntegrationTxFactory) GenerateMsgEthereumTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (evmtypes.MsgEthereumTx, error)
- func (tf *IntegrationTxFactory) GenerateSignedEthTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (signing.Tx, error)
- func (tf *IntegrationTxFactory) GenerateSignedMsgEthereumTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (evmtypes.MsgEthereumTx, error)
- func (tf *IntegrationTxFactory) GetEvmTransactionResponseFromTxResult(txResult abcitypes.ExecTxResult) (*evmtypes.MsgEthereumTxResponse, error)
- func (tf *IntegrationTxFactory) SignMsgEthereumTx(privKey cryptotypes.PrivKey, msgEthereumTx evmtypes.MsgEthereumTx) (evmtypes.MsgEthereumTx, error)
- type TxFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func CheckError(err error, logCheckArgs testutil.LogCheckArgs) error
CheckError is a helper function to check if the error is the expected one.
Types ¶
type CallArgs ¶
type CallArgs struct { // ContractABI is the ABI of the contract to call. ContractABI abi.ABI // MethodName is the name of the method to call. MethodName string // Args are the arguments to pass to the method. Args []interface{} }
CallArgs is a struct to define all relevant data to call a smart contract.
type ContractDeploymentData ¶
type ContractDeploymentData struct { // Contract is the compiled contract to deploy. Contract evmtypes.CompiledContract // ConstructorArgs are the arguments to pass to the constructor. ConstructorArgs []interface{} }
ContractDeploymentData is a struct to define all relevant data to deploy a smart contract.
type CosmosTxArgs ¶
type CosmosTxArgs struct { // ChainID is the chain's id in cosmos format, e.g. 'evmos_9000-1' ChainID string // Gas to be used on the tx Gas uint64 // GasPrice to use on tx GasPrice *sdkmath.Int // Fees is the fee to be used on the tx (amount and denom) Fees sdktypes.Coins // FeeGranter is the account address of the fee granter FeeGranter sdktypes.AccAddress // Msgs slice of messages to include on the tx Msgs []sdktypes.Msg }
CosmosTxArgs contains the params to create a cosmos tx
type IntegrationTxFactory ¶
type IntegrationTxFactory struct { commonfactory.CoreTxFactory // contains filtered or unexported fields }
IntegrationTxFactory is a helper struct to build and broadcast transactions to the network on integration tests. This is to simulate the behavior of a real user.
func (*IntegrationTxFactory) CallContractAndCheckLogs ¶
func (tf *IntegrationTxFactory) CallContractAndCheckLogs( priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs, logCheckArgs testutil.LogCheckArgs, ) (abcitypes.ExecTxResult, *evmtypes.MsgEthereumTxResponse, error)
CallContractAndCheckLogs is a helper function to call a contract and check the logs using the integration test utilities.
It returns the Cosmos Tx response, the decoded Ethereum Tx response and an error. This error value is nil, if the expected logs are found and the VM error is the expected one, should one be expected.
func (*IntegrationTxFactory) DeployContract ¶
func (tf *IntegrationTxFactory) DeployContract( priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, deploymentData ContractDeploymentData, ) (common.Address, error)
DeployContract deploys a contract with the provided private key, compiled contract data and constructor arguments. TxArgs Input and Nonce fields are overwritten.
func (*IntegrationTxFactory) EstimateGasLimit ¶
func (tf *IntegrationTxFactory) EstimateGasLimit(from *common.Address, txArgs *evmtypes.EvmTxArgs) (uint64, error)
EstimateGasLimit estimates the gas limit for a tx with the provided address and txArgs
func (*IntegrationTxFactory) ExecuteContractCall ¶
func (tf *IntegrationTxFactory) ExecuteContractCall(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs) (abcitypes.ExecTxResult, error)
ExecuteContractCall executes a contract call with the provided private key.
func (*IntegrationTxFactory) ExecuteEthTx ¶
func (tf *IntegrationTxFactory) ExecuteEthTx( priv cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, ) (abcitypes.ExecTxResult, error)
ExecuteEthTx executes an Ethereum transaction - contract call with the provided private key and txArgs It first builds a MsgEthereumTx and then broadcasts it to the network.
func (*IntegrationTxFactory) GenerateContractCallArgs ¶
func (tf *IntegrationTxFactory) GenerateContractCallArgs( txArgs evmtypes.EvmTxArgs, callArgs CallArgs, ) (evmtypes.EvmTxArgs, error)
GenerateContractCallArgs generates the txArgs for a contract call.
func (*IntegrationTxFactory) GenerateDefaultTxTypeArgs ¶
func (*IntegrationTxFactory) GenerateDeployContractArgs ¶
func (tf *IntegrationTxFactory) GenerateDeployContractArgs( from common.Address, txArgs evmtypes.EvmTxArgs, deploymentData ContractDeploymentData, ) (evmtypes.EvmTxArgs, error)
GenerateDeployContractArgs generates the txArgs for a contract deployment.
func (*IntegrationTxFactory) GenerateGethCoreMsg ¶
func (tf *IntegrationTxFactory) GenerateGethCoreMsg( privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, ) (core.Message, error)
GenerateGethCoreMsg creates a new GethCoreMsg with the provided arguments.
func (*IntegrationTxFactory) GenerateMsgEthereumTx ¶
func (tf *IntegrationTxFactory) GenerateMsgEthereumTx( privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, ) (evmtypes.MsgEthereumTx, error)
GenerateMsgEthereumTx creates a new MsgEthereumTx with the provided arguments. If any of the arguments are not provided, they will be populated with default values.
func (*IntegrationTxFactory) GenerateSignedEthTx ¶
func (tf *IntegrationTxFactory) GenerateSignedEthTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (signing.Tx, error)
GenerateSignedEthTx generates an Ethereum tx with the provided private key and txArgs but does not broadcast it.
func (*IntegrationTxFactory) GenerateSignedMsgEthereumTx ¶
func (tf *IntegrationTxFactory) GenerateSignedMsgEthereumTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (evmtypes.MsgEthereumTx, error)
GenerateSignedMsgEthereumTx generates an MsgEthereumTx signed with the provided private key and txArgs.
func (*IntegrationTxFactory) GetEvmTransactionResponseFromTxResult ¶
func (tf *IntegrationTxFactory) GetEvmTransactionResponseFromTxResult( txResult abcitypes.ExecTxResult, ) (*evmtypes.MsgEthereumTxResponse, error)
GetEvmTransactionResponseFromTxResult returns the MsgEthereumTxResponse from the provided txResult.
func (*IntegrationTxFactory) SignMsgEthereumTx ¶
func (tf *IntegrationTxFactory) SignMsgEthereumTx(privKey cryptotypes.PrivKey, msgEthereumTx evmtypes.MsgEthereumTx) (evmtypes.MsgEthereumTx, error)
SignMsgEthereumTx signs a MsgEthereumTx with the provided private key and chainID.
type TxFactory ¶
type TxFactory interface { commonfactory.CoreTxFactory // GenerateDefaultTxTypeArgs generates a default ETH tx args for the desired tx type GenerateDefaultTxTypeArgs(sender common.Address, txType int) (evmtypes.EvmTxArgs, error) // GenerateSignedEthTx generates an Ethereum tx with the provided private key and txArgs but does not broadcast it. GenerateSignedEthTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (signing.Tx, error) // GenerateSignedMsgEthereumTx generates an MsgEthereumTx signed with the provided private key and txArgs. GenerateSignedMsgEthereumTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (evmtypes.MsgEthereumTx, error) // SignMsgEthereumTx signs a MsgEthereumTx with the provided private key. SignMsgEthereumTx(privKey cryptotypes.PrivKey, msgEthereumTx evmtypes.MsgEthereumTx) (evmtypes.MsgEthereumTx, error) // ExecuteEthTx builds, signs and broadcasts an Ethereum tx with the provided private key and txArgs. // If the txArgs are not provided, they will be populated with default values or gas estimations. ExecuteEthTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (abcitypes.ExecTxResult, error) // ExecuteContractCall executes a contract call with the provided private key ExecuteContractCall(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs) (abcitypes.ExecTxResult, error) // DeployContract deploys a contract with the provided private key, // compiled contract data and constructor arguments DeployContract(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, deploymentData ContractDeploymentData) (common.Address, error) // CallContractAndCheckLogs is a helper function to call a contract and check the logs using // the integration test utilities. // // It returns the Cosmos Tx response, the decoded Ethereum Tx response and an error. This error value // is nil, if the expected logs are found and the VM error is the expected one, should one be expected. CallContractAndCheckLogs(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, callArgs CallArgs, logCheckArgs testutil.LogCheckArgs) (abcitypes.ExecTxResult, *evmtypes.MsgEthereumTxResponse, error) // GenerateDeployContractArgs generates the txArgs for a contract deployment. GenerateDeployContractArgs(from common.Address, txArgs evmtypes.EvmTxArgs, deploymentData ContractDeploymentData) (evmtypes.EvmTxArgs, error) // GenerateContractCallArgs generates the txArgs for a contract call. GenerateContractCallArgs(txArgs evmtypes.EvmTxArgs, callArgs CallArgs) (evmtypes.EvmTxArgs, error) // GenerateMsgEthereumTx creates a new MsgEthereumTx with the provided arguments. GenerateMsgEthereumTx(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (evmtypes.MsgEthereumTx, error) // GenerateGethCoreMsg creates a new GethCoreMsg with the provided arguments. GenerateGethCoreMsg(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs) (core.Message, error) // EstimateGasLimit estimates the gas limit for a tx with the provided address and txArgs EstimateGasLimit(from *common.Address, txArgs *evmtypes.EvmTxArgs) (uint64, error) // GetEvmTransactionResponseFromTxResult returns the MsgEthereumTxResponse from the provided txResult GetEvmTransactionResponseFromTxResult(txResult abcitypes.ExecTxResult) (*evmtypes.MsgEthereumTxResponse, error) }
TxFactory defines a struct that can build and broadcast transactions for the Cosmos EVM network. Methods are organized by build sign and broadcast type methods.