contracts

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed DistributionCaller.json
	DistributionCallerJSON []byte

	// DistributionCallerContract is the compiled contract calling the distribution precompile
	DistributionCallerContract evmtypes.CompiledContract
)
View Source
var (
	//go:embed InterchainSender.json
	InterchainSenderJSON []byte

	// InterchainSenderContract is the compiled contract calling the distribution precompile
	InterchainSenderContract evmtypes.CompiledContract
)

Functions

func Call

func Call(ctx sdk.Context, app *haqqapp.Haqq, args CallArgs) (res abci.ResponseDeliverTx, ethRes *evmtypes.MsgEthereumTxResponse, err error)

Call is a helper function to call any arbitrary smart contract.

func CallContractAndCheckLogs

func CallContractAndCheckLogs(ctx sdk.Context, app *haqqapp.Haqq, cArgs CallArgs, logCheckArgs testutil.LogCheckArgs) (abci.ResponseDeliverTx, *evmtypes.MsgEthereumTxResponse, error)

CallContractAndCheckLogs is a helper function to call any arbitrary smart contract and check that the logs contain the expected events.

Types

type CallArgs

type CallArgs struct {
	// Amount is the msg.value sent with the transaction.
	Amount *big.Int
	// AccessList is the access list to use for the transaction. If not empty, the transaction will be an EIP-2930 transaction (AccessListTx).
	AccessList *ethtypes.AccessList
	// ContractAddr is the address of the contract to call.
	ContractAddr common.Address
	// ContractABI is the ABI of the contract to call.
	ContractABI abi.ABI
	// MethodName is the name of the method to call.
	MethodName string
	// Nonce is the nonce to use for the transaction.
	Nonce *big.Int
	// GasLimit to use for the transaction
	GasLimit uint64
	// GasPrice is the gas price to use. If left empty, the base fee for the current block will be used.
	GasPrice *big.Int
	// GasFeeCap is the gas fee cap to use. If not empty, the transaction will be an EIP-1559 transaction (DynamicFeeTx).
	GasFeeCap *big.Int
	// GasTipCap is the gas tip cap to use. If not empty, the transaction will be an EIP-1559 transaction (DynamicFeeTx).
	GasTipCap *big.Int
	// PrivKey is the private key to be used for the transaction.
	PrivKey cryptotypes.PrivKey
	// 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.

func (CallArgs) WithABI

func (c CallArgs) WithABI(abi abi.ABI) CallArgs

WithABI returns the CallArgs with the given contract ABI.

func (CallArgs) WithAccessList

func (c CallArgs) WithAccessList(accessList *ethtypes.AccessList) CallArgs

WithAccessList returns the CallArgs with the given access list.

func (CallArgs) WithAddress

func (c CallArgs) WithAddress(addr common.Address) CallArgs

WithAddress returns the CallArgs with the given address.

func (CallArgs) WithAmount

func (c CallArgs) WithAmount(amount *big.Int) CallArgs

WithAmount populates the CallArgs struct's Amount field with the given amount. This is the amount of ISLM that will be sent with the contract call.

func (CallArgs) WithArgs

func (c CallArgs) WithArgs(args ...interface{}) CallArgs

WithArgs populates the CallArgs struct's Args field with the given list of arguments. These are the arguments that will be packed into the contract call input.

func (CallArgs) WithGasFeeCap

func (c CallArgs) WithGasFeeCap(gasFeeCap *big.Int) CallArgs

WithGasFeeCap returns the CallArgs with the given gas fee cap.

func (CallArgs) WithGasLimit

func (c CallArgs) WithGasLimit(gasLimit uint64) CallArgs

WithGasLimit returns the CallArgs with the given gas limit.

func (CallArgs) WithGasPrice

func (c CallArgs) WithGasPrice(gasPrice *big.Int) CallArgs

WithGasPrice returns the CallArgs with the given gas price.

func (CallArgs) WithGasTipCap

func (c CallArgs) WithGasTipCap(gasTipCap *big.Int) CallArgs

WithGasTipCap returns the CallArgs with the given gas tip cap.

func (CallArgs) WithMethodName

func (c CallArgs) WithMethodName(methodName string) CallArgs

WithMethodName returns the CallArgs with the given method name.

func (CallArgs) WithNonce

func (c CallArgs) WithNonce(nonce *big.Int) CallArgs

WithNonce returns the CallArgs with the given nonce.

func (CallArgs) WithPrivKey

func (c CallArgs) WithPrivKey(privKey *ethsecp256k1.PrivKey) CallArgs

WithPrivKey returns the CallArgs with the given private key.

Jump to

Keyboard shortcuts

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