multicall

package
v0.0.0-...-9e55092 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedCallables

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

AggregatedCallables is a Callable that aggregates multiple Callables into a single call.

The AggregatedCallables will call the multicall contract to aggregate the calls. If only a single call is aggregated, the call will be called directly.

The AggregatedCallables will decode the result of the multicall contract and decode the result of the individual calls if they implement the Decoder interface.

There is a special case for Callables that returns a zero address as their address. In this case, the Callable will not be included in the aggregated call, but the AggregatedCallables will try to decode the result of the Callable providing nil as the call result. This is useful mostly for testing purposes.

func AggregateCallables

func AggregateCallables(client rpc.RPC, calls ...contract.Callable) *AggregatedCallables

AggregateCallables creates a new AggregatedCallables instance.

func (*AggregatedCallables) Address

func (a *AggregatedCallables) Address() types.Address

Address implements the contract.Callable interface.

func (*AggregatedCallables) AllowFail

func (a *AggregatedCallables) AllowFail() *AggregatedCallables

AllowFail allows the aggregated call to partially fail. If a call fails, the rest of the calls will still be executed.

func (*AggregatedCallables) Call

func (a *AggregatedCallables) Call(ctx context.Context, number types.BlockNumber, res any) error

Call implements the contract.Caller interface.

func (*AggregatedCallables) CallData

func (a *AggregatedCallables) CallData() ([]byte, error)

CallData implements the contract.Callable interface.

func (*AggregatedCallables) Client

func (a *AggregatedCallables) Client() rpc.RPC

Client implements the contract.Caller interface.

func (*AggregatedCallables) DecodeTo

func (a *AggregatedCallables) DecodeTo(data []byte, res any) error

DecodeTo implements the contract.Decoder interface.

func (*AggregatedCallables) Gas

Gas implements the contract.Caller interface.

func (*AggregatedCallables) SendTransaction

func (a *AggregatedCallables) SendTransaction(ctx context.Context) (*types.Hash, *types.Transaction, error)

SendTransaction implements the contract.Transactor interface.

type Call

type Call struct {
	Target    types.Address `abi:"target"`
	CallData  []byte        `abi:"callData"`
	AllowFail bool          `abi:"allowFailure"`
}

type Multicall

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

func NewMulticall

func NewMulticall(client rpc.RPC) *Multicall

func (*Multicall) Aggregate3

func (m *Multicall) Aggregate3(calls []Call) contract.TypedSelfTransactableCaller[[]Result]

type Result

type Result struct {
	Success bool   `abi:"success"`
	Data    []byte `abi:"returnData"`
}

Jump to

Keyboard shortcuts

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