multicall

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MainnetMulticall : Multicall contract address on mainnet
	MainnetAddress = "0x5eb3fa2dfecdde21c950813c665e9364fa609bd2"
	// RopstenMulticall : Multicall contract address on Ropsten
	RopstenAddress = "0xf3ad7e31b052ff96566eedd218a823430e74b406"
)
View Source
const AggregateMethod = "0x17352e13"

Variables

This section is empty.

Functions

This section is empty.

Types

type BigIntJSONString

type BigIntJSONString big.Int

func (BigIntJSONString) MarshalJSON

func (i BigIntJSONString) MarshalJSON() ([]byte, error)

type CallResult

type CallResult struct {
	Success bool
	Raw     []byte
	Decoded []interface{}
}

type Config

type Config struct {
	MulticallAddress string
	Gas              string
}

type Multicall

type Multicall interface {
	CallRaw(calls ViewCalls, block string) (*Result, error)
	Call(calls ViewCalls, block string) (*Result, error)
	Contract() string
}

func New

func New(eth ethrpc.ETHInterface, opts ...Option) (Multicall, error)

type Option

type Option func(*Config)

func ContractAddress

func ContractAddress(address string) Option

func SetGas

func SetGas(gas uint64) Option

func SetGasHex

func SetGasHex(gas string) Option

type Result

type Result struct {
	BlockNumber uint64
	Calls       map[string]CallResult
}

type ViewCall

type ViewCall struct {
	Id        string
	Target    string
	Method    string
	Arguments []interface{}
}

func NewViewCall

func NewViewCall(id, target, method string, arguments []interface{}) ViewCall

func (ViewCall) ArgsCallData

func (call ViewCall) ArgsCallData() ([]byte, error)

func (ViewCall) ArgumentTypes

func (call ViewCall) ArgumentTypes() []string

func (ViewCall) CallData

func (call ViewCall) CallData() ([]byte, error)

func (ViewCall) Decode

func (call ViewCall) Decode(raw []byte) ([]interface{}, error)

func (ViewCall) GetArgument

func (call ViewCall) GetArgument(index int, argumentType string) (interface{}, error)

func (ViewCall) MethodCallData

func (call ViewCall) MethodCallData() ([]byte, error)

func (ViewCall) ReturnTypes

func (call ViewCall) ReturnTypes() []string

func (ViewCall) Validate

func (call ViewCall) Validate() error

type ViewCalls

type ViewCalls []ViewCall

func (ViewCalls) CallData

func (calls ViewCalls) CallData() ([]byte, error)

func (ViewCalls) Decode

func (calls ViewCalls) Decode(raw string) (*Result, error)

func (ViewCalls) DecodeRaw

func (calls ViewCalls) DecodeRaw(raw string) (*Result, error)

func (ViewCalls) DecodeWrapper

func (calls ViewCalls) DecodeWrapper(raw string) (*wrapperRet, error)

Jump to

Keyboard shortcuts

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