calls

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSolidityFunctionSig

func GetSolidityFunctionSig(in []byte) [4]byte

func Simulate

func Simulate(c SimulateCaller, block *big.Int, txHash common.Hash, from common.Address) ([]byte, error)

Simulate function gets transaction info by hash and then executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain. Execution happens against provided block.

func SliceTo32Bytes

func SliceTo32Bytes(in []byte) [32]byte

func ToCallArg

func ToCallArg(msg ethereum.CallMsg) map[string]interface{}

ToCallArg is the function that converts ethereum.CallMsg into more abstract map This is done for matter of making EVMClient more abstract since some go-ethereum forks uses different messages types

func UserAmountToWei

func UserAmountToWei(amount string, decimal *big.Int) (*big.Int, error)

UserAmountToWei converts decimal user friendly representation of token amount to 'Wei' representation with provided amount of decimal places eg UserAmountToWei(1, 5) => 100000

func WeiAmountToUser

func WeiAmountToUser(amount *big.Int, decimals *big.Int) (*big.Float, error)

Types

type ClientDispatcher

type ClientDispatcher interface {
	WaitAndReturnTxReceipt(h common.Hash) (*types.Receipt, error)
	SignAndSendTransaction(ctx context.Context, tx evmclient.CommonTransaction) (common.Hash, error)
	GetTransactionByHash(h common.Hash) (tx *types.Transaction, isPending bool, err error)
	UnsafeNonce() (*big.Int, error)
	LockNonce()
	UnlockNonce()
	UnsafeIncreaseNonce() error
	From() common.Address
}

type ContractCaller

type ContractCaller interface {
	CallContract(ctx context.Context, callArgs map[string]interface{}, blockNumber *big.Int) ([]byte, error)
}

type ContractCallerDispatcher

type ContractCallerDispatcher interface {
	ContractCaller
	ClientDispatcher
	ContractChecker
}

type ContractChecker

type ContractChecker interface {
	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
}

type GasPricer

type GasPricer interface {
	// make priority a pointer to uint8 to pass nil into all GasPrice functions (instead of magic numbers)
	GasPrice(priority *uint8) ([]*big.Int, error)
}

type SimulateCaller

type SimulateCaller interface {
	ContractCaller
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
}

type TxFabric

type TxFabric func(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrices []*big.Int, data []byte) (evmclient.CommonTransaction, error)

Directories

Path Synopsis
mock
Package mock_evmgaspricer is a generated GoMock package.
Package mock_evmgaspricer is a generated GoMock package.
Package mock_calls is a generated GoMock package.
Package mock_calls is a generated GoMock package.
itx
itx/mock
Package mock_itx is a generated GoMock package.
Package mock_itx is a generated GoMock package.
mock
Package mock_transactor is a generated GoMock package.
Package mock_transactor is a generated GoMock package.

Jump to

Keyboard shortcuts

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