eth

package
v0.0.0-...-6adf9c3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ZeroAddr is all 0s
	ZeroAddr Addr
	// ZeroAddrHex is string of 20 0s
	ZeroAddrHex = Addr2Hex(ZeroAddr)
	// ZeroBigInt is big.NewInt(0)
	ZeroBigInt = big.NewInt(0)
	// ZeroHash is all 0s
	ZeroHash Hash
)

Functions

func Addr2Hex

func Addr2Hex(a Addr) string

Addr2Hex returns hex without 0x

func Bytes2AddrHex

func Bytes2AddrHex(b []byte) string

Bytes2AddrHex returns hex without 0x

func Bytes2Hex

func Bytes2Hex(b []byte) string

Bytes2Hex returns hex string without 0x prefix

func FormatAddrHex

func FormatAddrHex(s string) string

FormatAddrHex formats a string into standard Addr string

func Hex2Bytes

func Hex2Bytes(s string) (b []byte)

Hex2Bytes supports hex string with or without 0x prefix Calls hex.DecodeString directly and ignore err similar to ec.FromHex but better

func Pad20Bytes

func Pad20Bytes(in []byte) []byte

if in is 20 bytes, return directly. otherwise return a new []byte w/ len 20, left pad 0x00..[in] if len(in)>20, panic

func Pad32Bytes

func Pad32Bytes(in []byte) []byte

Types

type Addr

type Addr = ec.Address

Addr is alias to geth common.Address

func Bytes2Addr

func Bytes2Addr(b []byte) Addr

Bytes2Addr returns Address from b Addr.Bytes() does the reverse

func Hex2Addr

func Hex2Addr(s string) Addr

Hex2Addr accepts hex string with or without 0x prefix and return Addr

type ContractCodec

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

func NewContractCodec

func NewContractCodec(abistr string) *ContractCodec

func (*ContractCodec) ABI

func (c *ContractCodec) ABI() *abi.ABI

func (*ContractCodec) DecodeCalldata

func (c *ContractCodec) DecodeCalldata(methodName string, data []byte, ptrs ...interface{}) error

func (*ContractCodec) DecodeReturnData

func (c *ContractCodec) DecodeReturnData(methodName string, data []byte, ptrs ...interface{}) error

func (*ContractCodec) EncodeCalldata

func (c *ContractCodec) EncodeCalldata(methodName string, args ...interface{}) ([]byte, error)

func (*ContractCodec) EncodeReturnData

func (c *ContractCodec) EncodeReturnData(methodName string, ifaces ...interface{}) ([]byte, error)

func (*ContractCodec) Selector

func (c *ContractCodec) Selector(methodName string) []byte

type Hash

type Hash = ec.Hash

Hash is the type for ethereum hash type

func Bytes2Hash

func Bytes2Hash(b []byte) Hash

Bytes2Hash converts bytes to Hash

func Hex2Hash

func Hex2Hash(s string) Hash

Hex2Hash accepts hex string with or without 0x prefix and return Hash

type IMulticaller

type IMulticaller interface {
	TryBlockAndAggregate(requireSuccess bool, calls []multicall.IMulticall2Call) (*MulticallResponse, error)
}

type MulticallResponse

type MulticallResponse struct {
	BlockNumber *big.Int
	BlockHash   Hash
	ReturnData  MulticallResults
}

type MulticallResults

type MulticallResults = []struct {
	Success    bool    "json:\"success\""
	ReturnData []uint8 "json:\"returnData\""
}

type Multicaller

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

The quote functions in IQuoterV2 are a non-view functions. Manual low-level operations are needed to call it statically

func NewMulticaller

func NewMulticaller(address common.Address, ec *ethclient.Client) (*Multicaller, error)

func (*Multicaller) TryBlockAndAggregate

func (m *Multicaller) TryBlockAndAggregate(requireSuccess bool, calls []multicall.IMulticall2Call) (*MulticallResponse, error)

Jump to

Keyboard shortcuts

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