Documentation ¶
Index ¶
- Variables
- type Config
- type ETHClient
- type EVMChainConfig
- type ErrorWithStrippedSecrets
- type EthereumClientConfirmations
- type EthereumConfirmations
- type FinalityState
- type L2Client
- type L2Clients
- type PrimaryClient
- func (c *PrimaryClient) CollateralBridgeAddress() ethcommon.Address
- func (c *PrimaryClient) CollateralBridgeAddressHex() string
- func (c *PrimaryClient) ConfirmationsRequired() uint64
- func (c *PrimaryClient) CurrentHeight(ctx context.Context) (uint64, error)
- func (c *PrimaryClient) IsEthereum() bool
- func (c *PrimaryClient) UpdateEthereumConfig(ctx context.Context, ethConfig *types.EthereumConfig) error
- func (c *PrimaryClient) VerifyContract(ctx context.Context, address ethcommon.Address, expectedHash string) error
- type SecondaryClient
- func (c *SecondaryClient) CollateralBridgeAddress() ethcommon.Address
- func (c *SecondaryClient) CollateralBridgeAddressHex() string
- func (c *SecondaryClient) ConfirmationsRequired() uint64
- func (c *SecondaryClient) CurrentHeight(ctx context.Context) (uint64, error)
- func (c *SecondaryClient) IsEthereum() bool
- func (c *SecondaryClient) UpdateEthereumConfig(ctx context.Context, ethConfig *types.EVMChainConfig) error
- func (c *SecondaryClient) VerifyContract(ctx context.Context, address ethcommon.Address, expectedHash string) error
- type StdTime
- type Time
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnexpectedContractHash = errors.New("hash of contract bytecode not as expected") ErrUnexpectedSolidityFormat = errors.New("unexpected format of solidity bytecode") )
var ( ErrMissingConfirmations = errors.New("not enough confirmations") ErrBlockNotFinalized = errors.New("block not finalized") )
var ContractHashes = map[string]string{
"staking": "d66948e12817f8ae6ca94d56b43ca12e66416e7e9bc23bb09056957b25afc6bd",
"vesting": "5278802577f4aca315b9524bfa78790f8f0fae08939ec58bc9e8f0ea40123b09",
"collateral": "1cd7f315188baf26f70c77a764df361c5d01bd365b109b96033b8755ee2b2750",
"multisig": "5b7070e6159628455b38f5796e8d0dc08185aaaa1fb6073767c88552d396c6c2",
}
ContractHashes the sha3-256(contract-bytecode stripped of metadata).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` RPCEndpoint string RetryDelay encoding.Duration EVMBridgeConfigs []EVMChainConfig 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 ErrorWithStrippedSecrets ¶ added in v0.77.0
type ErrorWithStrippedSecrets struct {
// contains filtered or unexported fields
}
ErrorWithStrippedSecrets is an extremely naïve implementation of an error that will strip the API token from a URL.
func (ErrorWithStrippedSecrets) Error ¶ added in v0.77.0
func (e ErrorWithStrippedSecrets) Error() string
type EthereumConfirmations ¶
type EthereumConfirmations struct {
// contains filtered or unexported fields
}
func NewEthereumConfirmations ¶
func NewEthereumConfirmations(cfg Config, ethClient EthereumClientConfirmations, time Time, cs FinalityState) *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) GetConfirmations ¶ added in v0.75.0
func (e *EthereumConfirmations) GetConfirmations() uint64
func (*EthereumConfirmations) UpdateConfirmations ¶
func (e *EthereumConfirmations) UpdateConfirmations(confirmations uint64)
type FinalityState ¶ added in v0.76.0
type FinalityState int
const ( FinalityStateSafe FinalityState = iota FinalityStateFinalized FinalityStateLatest )
type L2Clients ¶ added in v0.74.0
type L2Clients struct {
// contains filtered or unexported fields
}
func NewL2Clients ¶ added in v0.74.0
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
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 PrimaryClient ¶ added in v0.76.0
type PrimaryClient struct { ETHClient // contains filtered or unexported fields }
func PrimaryDial ¶ added in v0.76.0
func PrimaryDial(ctx context.Context, cfg Config) (*PrimaryClient, error)
func (*PrimaryClient) CollateralBridgeAddress ¶ added in v0.76.0
func (c *PrimaryClient) CollateralBridgeAddress() ethcommon.Address
func (*PrimaryClient) CollateralBridgeAddressHex ¶ added in v0.76.0
func (c *PrimaryClient) CollateralBridgeAddressHex() string
func (*PrimaryClient) ConfirmationsRequired ¶ added in v0.76.0
func (c *PrimaryClient) ConfirmationsRequired() uint64
func (*PrimaryClient) CurrentHeight ¶ added in v0.76.0
func (c *PrimaryClient) CurrentHeight(ctx context.Context) (uint64, error)
func (*PrimaryClient) IsEthereum ¶ added in v0.76.0
func (c *PrimaryClient) IsEthereum() bool
IsEthereum returns whether or not this client is the "primary" one and pointing to Ethereum.
func (*PrimaryClient) UpdateEthereumConfig ¶ added in v0.76.0
func (c *PrimaryClient) UpdateEthereumConfig(ctx context.Context, ethConfig *types.EthereumConfig) error
func (*PrimaryClient) VerifyContract ¶ added in v0.76.0
func (c *PrimaryClient) 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 SecondaryClient ¶ added in v0.76.0
type SecondaryClient struct { ETHClient // contains filtered or unexported fields }
func SecondaryDial ¶ added in v0.76.0
func SecondaryDial(ctx context.Context, cfg Config) (*SecondaryClient, error)
func (*SecondaryClient) CollateralBridgeAddress ¶ added in v0.76.0
func (c *SecondaryClient) CollateralBridgeAddress() ethcommon.Address
func (*SecondaryClient) CollateralBridgeAddressHex ¶ added in v0.76.0
func (c *SecondaryClient) CollateralBridgeAddressHex() string
func (*SecondaryClient) ConfirmationsRequired ¶ added in v0.76.0
func (c *SecondaryClient) ConfirmationsRequired() uint64
func (*SecondaryClient) CurrentHeight ¶ added in v0.76.0
func (c *SecondaryClient) CurrentHeight(ctx context.Context) (uint64, error)
func (*SecondaryClient) IsEthereum ¶ added in v0.76.0
func (c *SecondaryClient) IsEthereum() bool
IsEthereum returns whether or not this client is the "primary" one and pointing to Ethereum.
func (*SecondaryClient) UpdateEthereumConfig ¶ added in v0.76.0
func (c *SecondaryClient) UpdateEthereumConfig(ctx context.Context, ethConfig *types.EVMChainConfig) error
func (*SecondaryClient) VerifyContract ¶ added in v0.76.0
func (c *SecondaryClient) 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.