eth

package
v0.74.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedContractHash   = errors.New("hash of contract bytecode not as expected")
	ErrUnexpectedSolidityFormat = errors.New("unexpected format of solidity bytecode")
)
View Source
var ContractHashes = map[string]string{
	"staking":    "d66948e12817f8ae6ca94d56b43ca12e66416e7e9bc23bb09056957b25afc6bd",
	"vesting":    "5278802577f4aca315b9524bfa78790f8f0fae08939ec58bc9e8f0ea40123b09",
	"collateral": "1cd7f315188baf26f70c77a764df361c5d01bd365b109b96033b8755ee2b2750",
	"multisig":   "5b7070e6159628455b38f5796e8d0dc08185aaaa1fb6073767c88552d396c6c2",
}

ContractHashes the sha3-256(contract-bytecode stripped of metadata).

View Source
var ErrMissingConfirmations = errors.New("not enough confirmations")

Functions

This section is empty.

Types

type Client

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

func Dial

func Dial(ctx context.Context, cfg Config) (*Client, error)

func (*Client) CollateralBridgeAddress

func (c *Client) CollateralBridgeAddress() ethcommon.Address

func (*Client) CollateralBridgeAddressHex

func (c *Client) CollateralBridgeAddressHex() string

func (*Client) ConfirmationsRequired

func (c *Client) ConfirmationsRequired() uint64

func (*Client) CurrentHeight

func (c *Client) CurrentHeight(ctx context.Context) (uint64, error)

func (*Client) UpdateEthereumConfig

func (c *Client) UpdateEthereumConfig(ethConfig *types.EthereumConfig) error

func (*Client) VerifyContract

func (c *Client) VerifyContract(ctx context.Context, address ethcommon.Address, expectedHash string) error

VerifyContract takes the address of a contract in hex and checks the hash of the byte-code is as expected.

type Config

type Config struct {
	Level           encoding.LogLevel `long:"log-level"`
	RPCEndpoint     string
	RetryDelay      encoding.Duration
	EVMChainConfigs []EVMChainConfig
}

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.

type ETHClient

type ETHClient interface {

	// client
	ChainID(context.Context) (*big.Int, error)
	NetworkID(context.Context) (*big.Int, error)

	// ethereum.ChainReader
	BlockByHash(ctx context.Context, hash ethcommon.Hash) (*ethtypes.Block, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*ethtypes.Header, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*ethtypes.Block, error)
	HeaderByHash(ctx context.Context, hash ethcommon.Hash) (*ethtypes.Header, error)
	SubscribeNewHead(ctx context.Context, ch chan<- *ethtypes.Header) (ethereum.Subscription, error)
	TransactionCount(ctx context.Context, blockHash ethcommon.Hash) (uint, error)
	TransactionInBlock(ctx context.Context, blockHash ethcommon.Hash, index uint) (*ethtypes.Transaction, error)

	// bind.ContractCaller
	CodeAt(ctx context.Context, contract ethcommon.Address, blockNumber *big.Int) ([]byte, error)
	CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

	// bind.ContractTransactor
	EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
	PendingCodeAt(ctx context.Context, account ethcommon.Address) ([]byte, error)
	PendingNonceAt(ctx context.Context, account ethcommon.Address) (uint64, error)
	SendTransaction(ctx context.Context, tx *ethtypes.Transaction) error
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)

	// bind.ContractFilterer
	FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]ethtypes.Log, error)
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- ethtypes.Log) (ethereum.Subscription, error)
}

ETHClient ...

type EVMChainConfig added in v0.74.0

type EVMChainConfig struct {
	ChainID     string
	RPCEndpoint string
}

type EthereumClientConfirmations

type EthereumClientConfirmations interface {
	HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error)
}

type EthereumConfirmations

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

func NewEthereumConfirmations

func NewEthereumConfirmations(
	cfg Config,
	ethClient EthereumClientConfirmations,
	time Time,
) *EthereumConfirmations

func (*EthereumConfirmations) Check

func (e *EthereumConfirmations) Check(block uint64) error

func (*EthereumConfirmations) CheckRequiredConfirmations added in v0.73.0

func (e *EthereumConfirmations) CheckRequiredConfirmations(block uint64, required uint64) error

func (*EthereumConfirmations) UpdateConfirmations

func (e *EthereumConfirmations) UpdateConfirmations(confirmations uint64)

type L2Client added in v0.74.0

type L2Client struct {
	ETHClient
}

func DialL2 added in v0.74.0

func DialL2(ctx context.Context, endpoint string) (*L2Client, error)

type L2Clients added in v0.74.0

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

func NewL2Clients added in v0.74.0

func NewL2Clients(
	ctx context.Context,
	log *logging.Logger,
	cfg Config,
) (*L2Clients, error)

func (*L2Clients) Get added in v0.74.0

func (c *L2Clients) Get(chainID string) (*L2Client, *EthereumConfirmations, bool)

func (*L2Clients) ReloadConf added in v0.74.0

func (e *L2Clients) ReloadConf(cfg Config)

ReloadConf updates the internal configuration of the execution engine and its dependencies.

func (*L2Clients) UpdateConfirmations added in v0.74.0

func (e *L2Clients) UpdateConfirmations(ethCfg *types.EthereumL2Configs)

type StdTime

type StdTime struct{}

func (StdTime) Now

func (StdTime) Now() time.Time

type Time

type Time interface {
	Now() time.Time
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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