multicall

package
v0.0.0-...-d770b7a Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthereumMainnet = "0x5ba1e12693dc8f9c48aad8770482f4739beed696"
	Kovan           = "0x5ba1e12693dc8f9c48aad8770482f4739beed696"
	Rinkeby         = "0x5ba1e12693dc8f9c48aad8770482f4739beed696"
	Gorli           = "0x5ba1e12693dc8f9c48aad8770482f4739beed696"
	Ropsten         = "0x5ba1e12693dc8f9c48aad8770482f4739beed696"
	BSCMainnet      = "0x41263cba59eb80dc200f3e2544eda4ed6a90e76c"
	BSCTestnet      = "0xae11C5B5f29A6a25e955F0CB8ddCc416f522AF5C"
	CronosMainnet   = "0xF33d2E47001ddbD7b71301363f68F57e318Bd4c8"
	CronosTestnet   = "0x2F953EA963E0243528186b3C92ea86355af532eb"

	CronosQuickCall = "0x0F278822981A28b1Ecd4E790c414FAC0d52b6B44"
)

Variables

View Source
var (
	ErrQuickCallRequired = errors.New("quickcall is required for this function")
	ErrMulticallRequired = errors.New("multicall is required for this function")
)

Errors

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(address string, version Version, client *ethclient.Client) (*Client, error)

New creates a new client for the given address and version of multicall

func (*Client) Aggregate

func (client *Client) Aggregate(opts *bind.CallOpts, methods []*MethodCall) (blockNumber *big.Int, results []any, err error)

Aggregate makes multiple calls to the target contracts and returns the results.

func (*Client) Execute

func (client *Client) Execute(opts *bind.CallOpts, gasLimitPerCall *big.Int, resultSizeLimit *big.Int, methods []*MethodCall) (result *QuickCallResults, err error)

Execute makes multiple calls to the target contracts and returns the results.

func (*Client) GetBlockHash

func (client *Client) GetBlockHash(blockNumber *big.Int) (*common.Hash, error)

GetBlockHash returns the block hash for the given block number. Note: not available with quickcall.

func (*Client) GetCurrentBlockCoinbase

func (client *Client) GetCurrentBlockCoinbase() (*common.Address, error)

GetCurrentBlockCoinbase returns the current block coinbase. Note: not available with quickcall.

func (*Client) GetCurrentBlockDifficulty

func (client *Client) GetCurrentBlockDifficulty() (*big.Int, error)

GetCurrentBlockDifficulty returns the current block difficulty. Note: not available with quickcall.

func (*Client) GetCurrentBlockGasLimit

func (client *Client) GetCurrentBlockGasLimit() (*big.Int, error)

GetCurrentBlockGasLimit returns the current block gas limit. Note: not available with quickcall.

func (*Client) GetCurrentBlockTimestamp

func (client *Client) GetCurrentBlockTimestamp() (uint64, error)

GetCurrentBlockTimestamp returns the current block timestamp. Note: not available with quickcall.

func (*Client) GetEthBalance

func (client *Client) GetEthBalance(address common.Address) (*big.Int, error)

GetEthBalance returns the balance of the given address. Note: not available with quickcall.

func (*Client) GetLastBlockHash

func (client *Client) GetLastBlockHash() (*common.Hash, error)

GetLastBlockHash returns the hash of the last block. Note: not available with quickcall.

type MethodCall

type MethodCall struct {
	Address common.Address
	Method  abi.Method
	Args    []any
}

func NewMethodCall

func NewMethodCall(address common.Address, method abi.Method, args ...any) *MethodCall

NewMethodCall creates a new method call

type QuickCallResult

type QuickCallResult struct {
	Status *big.Int
	Result any
}

func (*QuickCallResult) IsStatusZero

func (qcr *QuickCallResult) IsStatusZero() bool

IsStatusZero returns true if the status is zero, false otherwise. This is useful for checking if a call was successful or not. Typically, a status of zero means the call has reverted or failed.

type QuickCallResults

type QuickCallResults struct {
	BlockNumber *big.Int
	Results     []QuickCallResult
}

type Version

type Version int
const (
	V1 Version = iota
	QuickCall
)

Jump to

Keyboard shortcuts

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