eth

package
v0.73.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 17 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
}

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 {
	bind.ContractBackend
	ethereum.ChainReader
	ChainID(context.Context) (*big.Int, error)
	NetworkID(context.Context) (*big.Int, error)
}

ETHClient ...

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 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