Documentation ¶
Index ¶
- Variables
- func ContractABI(abiVersion Version) string
- func LoadABI(abiFilePath string) error
- func SyncEth1Events(logger *zap.Logger, client Client, storage SyncOffsetStorage, ...) error
- type AbiParser
- func (ap AbiParser) ParseOperatorAddedEvent(operatorPubKey string, data []byte, topics []common.Hash, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, bool, bool, error)
- func (ap AbiParser) ParseValidatorAddedEvent(operatorPrivateKey *rsa.PrivateKey, data []byte, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, bool, bool, error)
- type AbiVersion
- type Client
- type ClientMock
- type Event
- type Options
- type ShareEncryptionKeyProvider
- type SyncEndedEvent
- type SyncEventHandler
- type SyncOffset
- type SyncOffsetStorage
- type Version
Constants ¶
This section is empty.
Variables ¶
var (
V2ContractABI = `` /* 12082-byte string literal not displayed */
)
Abi's to use
Functions ¶
func ContractABI ¶ added in v0.0.6
ContractABI abi of the ssv-network contract
func SyncEth1Events ¶ added in v0.0.4
func SyncEth1Events(logger *zap.Logger, client Client, storage SyncOffsetStorage, syncOffset *SyncOffset, handler SyncEventHandler) error
SyncEth1Events sync past events
Types ¶
type AbiParser ¶ added in v0.1.8
type AbiParser struct { Logger *zap.Logger Version AbiVersion }
AbiParser serves as a parsing client for events from contract
func (AbiParser) ParseOperatorAddedEvent ¶ added in v0.1.8
func (ap AbiParser) ParseOperatorAddedEvent(operatorPubKey string, data []byte, topics []common.Hash, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, bool, bool, error)
ParseOperatorAddedEvent parses an OperatorAddedEvent
func (AbiParser) ParseValidatorAddedEvent ¶ added in v0.1.8
func (ap AbiParser) ParseValidatorAddedEvent(operatorPrivateKey *rsa.PrivateKey, data []byte, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, bool, bool, error)
ParseValidatorAddedEvent parses ValidatorAddedEvent
type AbiVersion ¶ added in v0.1.8
type AbiVersion interface { ParseOperatorAddedEvent(logger *zap.Logger, operatorPubKey string, data []byte, topics []common.Hash, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, bool, bool, error) ParseValidatorAddedEvent(logger *zap.Logger, operatorPrivateKey *rsa.PrivateKey, data []byte, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, bool, bool, error) }
AbiVersion serves as the parser client interface
type ClientMock ¶ added in v0.0.16
ClientMock implements eth1.Client interface
func (*ClientMock) EventsFeed ¶ added in v0.1.5
func (ec *ClientMock) EventsFeed() *event.Feed
EventsFeed returns the contract events feed
func (*ClientMock) Start ¶ added in v0.0.16
func (ec *ClientMock) Start() error
Start mocking client init
type Event ¶
type Event struct { // Log is the raw event log Log types.Log // Data is the parsed event Data interface{} // IsOperatorEvent indicates whether the event belongs to operator IsOperatorEvent bool }
Event represents an eth1 event log in the system
type Options ¶ added in v0.0.6
type Options struct { ETH1Addr string `yaml:"ETH1Addr" env:"ETH_1_ADDR" env-required:"true" env-description:"ETH1 node WebSocket address"` ETH1SyncOffset string `yaml:"ETH1SyncOffset" env:"ETH_1_SYNC_OFFSET" env-description:"block number to start the sync from"` ETH1ConnectionTimeout time.Duration `yaml:"ETH1ConnectionTimeout" env:"ETH_1_CONNECTION_TIMEOUT" env-default:"10s" env-description:"eth1 node connection timeout"` RegistryContractAddr string `` /* 161-byte string literal not displayed */ RegistryContractABI string `yaml:"RegistryContractABI" env:"REGISTRY_CONTRACT_ABI" env-description:"registry contract abi json file"` CleanRegistryData bool `` /* 156-byte string literal not displayed */ AbiVersion Version `yaml:"AbiVersion" env:"ABI_VERSION" env-default:"0" env-description:"smart contract abi version (format)"` }
Options configurations related to eth1
type ShareEncryptionKeyProvider ¶ added in v0.0.6
type ShareEncryptionKeyProvider = func() (*rsa.PrivateKey, bool, error)
ShareEncryptionKeyProvider is a function that returns the operator private key
type SyncEndedEvent ¶
type SyncEndedEvent struct { // Success returns true if the sync went well (all events were parsed) Success bool // Logs is the actual logs that we got from eth1 Logs []types.Log }
SyncEndedEvent meant to notify an observer that the sync is over
type SyncEventHandler ¶ added in v0.0.18
SyncEventHandler handles a given event
type SyncOffset ¶ added in v0.0.4
SyncOffset is the type of variable used for passing around the offset
func DefaultSyncOffset ¶ added in v0.0.4
func DefaultSyncOffset() *SyncOffset
DefaultSyncOffset returns the default value (block number of the first event from the contract)
func HexStringToSyncOffset ¶ added in v0.0.4
func HexStringToSyncOffset(shex string) *SyncOffset
HexStringToSyncOffset converts an hex string to SyncOffset
type SyncOffsetStorage ¶ added in v0.0.4
type SyncOffsetStorage interface { // SaveSyncOffset saves the offset (block number) SaveSyncOffset(offset *SyncOffset) error // GetSyncOffset returns the sync offset GetSyncOffset() (*SyncOffset, bool, error) }
SyncOffsetStorage represents the interface for compatible storage