Documentation ¶
Index ¶
- func CheckAuthorizationEvents(event abi.Event, precompileAddr, granter, grantee common.Address, ...)
- func CheckEthereumTxFailed(ethRes *evmtypes.MsgEthereumTxResponse) (string, bool)
- func CheckLogs(logArgs LogCheckArgs) error
- func CheckVMError(res abci.ResponseDeliverTx, expErrMsg string, args ...interface{}) error
- func CreateValidator(ctx sdk.Context, t *testing.T, pubKey cryptotypes.PubKey, ...)
- func NewPrecompileContract(t *testing.T, ctx sdk.Context, caller common.Address, ...) (*vm.Contract, sdk.Context)
- type LogCheckArgs
- func (l LogCheckArgs) WithABIEvents(abiEvents map[string]abi.Event) LogCheckArgs
- func (l LogCheckArgs) WithErrContains(errContains string, printArgs ...interface{}) LogCheckArgs
- func (l LogCheckArgs) WithExpEvents(expEvents ...string) LogCheckArgs
- func (l LogCheckArgs) WithExpPass(expPass bool) LogCheckArgs
- func (l LogCheckArgs) WithRes(res abci.ResponseDeliverTx) LogCheckArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAuthorizationEvents ¶
func CheckAuthorizationEvents(event abi.Event, precompileAddr, granter, grantee common.Address, res abci.ResponseDeliverTx, height int64, msgTypes []string, amount *big.Int)
CheckAuthorizationEvents is a helper function used in the integration tests and checks if the approval event is emitted.
If the amount is nil, it will not check for the amount in the event, which should be used for any generic approvals.
func CheckEthereumTxFailed ¶
func CheckEthereumTxFailed(ethRes *evmtypes.MsgEthereumTxResponse) (string, bool)
CheckEthereumTxFailed checks if there is a VM error in the transaction response and returns the reason.
func CheckLogs ¶
func CheckLogs(logArgs LogCheckArgs) error
CheckLogs checks the logs for the given events and whether the transaction was successful or not.
func CheckVMError ¶
func CheckVMError(res abci.ResponseDeliverTx, expErrMsg string, args ...interface{}) error
CheckVMError is a helper function used to check if the transaction is reverted with the expected error message in the VmError field of the MsgEthereumResponse struct.
func CreateValidator ¶
func CreateValidator(ctx sdk.Context, t *testing.T, pubKey cryptotypes.PubKey, sk stakingkeeper.Keeper, stakeAmt math.Int)
CreateValidator creates a validator with the given amount of staked tokens in the bond denomination set in the staking keeper.
Types ¶
type LogCheckArgs ¶
type LogCheckArgs struct { // ABIEvents is a map of available abi.Event corresponding to the corresponding event names, // which are available in the contract ABI. ABIEvents map[string]abi.Event // ErrContains is the error message that is expected to be contained in the transaction response. ErrContains string // ExpEvents are the events which are expected to be emitted. ExpEvents []string // ExpPass is whether the transaction is expected to pass or not. ExpPass bool // Res is the response of the transaction. // // NOTE: This does not have to be set when using contracts.CallContractAndCheckLogs. Res abci.ResponseDeliverTx }
LogCheckArgs is a struct that contains configuration for the log checking.
func (LogCheckArgs) WithABIEvents ¶
func (l LogCheckArgs) WithABIEvents(abiEvents map[string]abi.Event) LogCheckArgs
WithABIEvents sets the ABIEvents field of LogCheckArgs.
func (LogCheckArgs) WithErrContains ¶
func (l LogCheckArgs) WithErrContains(errContains string, printArgs ...interface{}) LogCheckArgs
WithErrContains sets the ErrContains field of LogCheckArgs. If any printArgs are provided, they are used to format the error message.
func (LogCheckArgs) WithExpEvents ¶
func (l LogCheckArgs) WithExpEvents(expEvents ...string) LogCheckArgs
WithExpEvents sets the ExpEvents field of LogCheckArgs.
func (LogCheckArgs) WithExpPass ¶
func (l LogCheckArgs) WithExpPass(expPass bool) LogCheckArgs
WithExpPass sets the ExpPass field of LogCheckArgs.
func (LogCheckArgs) WithRes ¶
func (l LogCheckArgs) WithRes(res abci.ResponseDeliverTx) LogCheckArgs
WithRes sets the Res field of LogCheckArgs.