Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SyncEth1Events ¶ added in v0.0.4
func SyncEth1Events(logger *zap.Logger, client Client, storage SyncOffsetStorage, observerID string, syncOffset *SyncOffset) error
SyncEth1Events sync past events
Types ¶
type Client ¶
type Client interface {
EventsSubject() pubsub.Subscriber
Start() error
Sync(fromBlock *big.Int) error
}
Client represents the required interface for eth1 client
type OperatorAddedEvent ¶
type OperatorAddedEvent struct {
Name string
PublicKey []byte
PaymentAddress common.Address
OwnerAddress common.Address
}
OperatorAddedEvent struct represents event received by the smart contract
func ParseOperatorAddedEvent ¶ added in v0.0.4
func ParseOperatorAddedEvent(logger *zap.Logger, data []byte, contractAbi abi.ABI) (*OperatorAddedEvent, bool, error)
ParseOperatorAddedEvent parses an OperatorAddedEvent
type OperatorPrivateKeyProvider ¶
type OperatorPrivateKeyProvider = func() (*rsa.PrivateKey, error)
OperatorPrivateKeyProvider 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 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, error)
}
SyncOffsetStorage represents the interface for compatible storage
type ValidatorAddedEvent ¶
ValidatorAddedEvent struct represents event received by the smart contract
func ParseValidatorAddedEvent ¶ added in v0.0.4
func ParseValidatorAddedEvent(logger *zap.Logger, operatorPrivateKey *rsa.PrivateKey, data []byte, contractAbi abi.ABI) (*ValidatorAddedEvent, bool, error)
ParseValidatorAddedEvent parses ValidatorAddedEvent