eth1

package
v0.5.5-jatov2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package eth1 is a generated GoMock package.

Package eth1 is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContractABI added in v0.0.6

func ContractABI(abiVersion Version) string

ContractABI abi of the ssv-network contract

func HandleEventResult added in v0.3.0

func HandleEventResult(logger *zap.Logger, event Event, logFields []zap.Field, err error, ongoingSync bool) []error

HandleEventResult handles the result of an event

func LoadABI added in v0.0.6

func LoadABI(logger *zap.Logger, abiFilePath string) error

LoadABI enables to load a custom abi json

func SyncEth1Events added in v0.0.4

func SyncEth1Events(
	logger *zap.Logger,
	client Client,
	storage SyncOffsetStorage,
	network networkconfig.NetworkConfig,
	syncOffset *SyncOffset,
	handler SyncEventHandler,
) error

SyncEth1Events sync past events

Types

type AbiParser added in v0.1.8

type AbiParser struct {
	Version AbiVersion
}

AbiParser serves as a parsing client for events from contract

func NewParser added in v0.1.8

func NewParser(logger *zap.Logger, version Version) AbiParser

NewParser return parser client based on the contract version

func (AbiParser) ParseClusterLiquidatedEvent added in v0.4.7

func (ap AbiParser) ParseClusterLiquidatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ClusterLiquidatedEvent, error)

ParseClusterLiquidatedEvent parses ClusterLiquidatedEvent

func (AbiParser) ParseClusterReactivatedEvent added in v0.4.7

func (ap AbiParser) ParseClusterReactivatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ClusterReactivatedEvent, error)

ParseClusterReactivatedEvent parses ClusterReactivatedEvent

func (AbiParser) ParseFeeRecipientAddressUpdatedEvent added in v0.4.7

func (ap AbiParser) ParseFeeRecipientAddressUpdatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.FeeRecipientAddressUpdatedEvent, error)

ParseFeeRecipientAddressUpdatedEvent parses FeeRecipientAddressUpdatedEvent

func (AbiParser) ParseOperatorAddedEvent added in v0.1.8

func (ap AbiParser) ParseOperatorAddedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, error)

ParseOperatorAddedEvent parses an OperatorAddedEvent

func (AbiParser) ParseOperatorRemovedEvent added in v0.4.7

func (ap AbiParser) ParseOperatorRemovedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.OperatorRemovedEvent, error)

ParseOperatorRemovedEvent parses an OperatorRemovedEvent

func (AbiParser) ParseValidatorAddedEvent added in v0.1.8

func (ap AbiParser) ParseValidatorAddedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, error)

ParseValidatorAddedEvent parses ValidatorAddedEvent

func (AbiParser) ParseValidatorRemovedEvent added in v0.2.0

func (ap AbiParser) ParseValidatorRemovedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorRemovedEvent, error)

ParseValidatorRemovedEvent parses ValidatorRemovedEvent

type AbiVersion added in v0.1.8

type AbiVersion interface {
	ParseOperatorAddedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, error)
	ParseOperatorRemovedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.OperatorRemovedEvent, error)
	ParseValidatorAddedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, error)
	ParseValidatorRemovedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorRemovedEvent, error)
	ParseClusterLiquidatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ClusterLiquidatedEvent, error)
	ParseClusterReactivatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.ClusterReactivatedEvent, error)
	ParseFeeRecipientAddressUpdatedEvent(log types.Log, contractAbi abi.ABI) (*abiparser.FeeRecipientAddressUpdatedEvent, error)
}

AbiVersion serves as the parser client interface

type Client

type Client interface {
	EventsFeed() *event.Feed
	Start(logger *zap.Logger) error
	Sync(logger *zap.Logger, fromBlock *big.Int) error
	IsReady(ctx context.Context) (bool, error)
}

Client represents the required interface for eth1 client

type ClusterLiquidatedEventYAML added in v0.4.7

type ClusterLiquidatedEventYAML struct {
	Owner       string   `yaml:"Owner"`
	OperatorIds []uint64 `yaml:"OperatorIds"`
}

type ClusterReactivatedEventYAML added in v0.4.7

type ClusterReactivatedEventYAML struct {
	Owner       string   `yaml:"Owner"`
	OperatorIds []uint64 `yaml:"OperatorIds"`
}

type Event

type Event struct {
	// Log is the raw event log
	Log types.Log
	// Name is the event name used for internal representation.
	Name string
	// Data is the parsed event
	Data interface{}
}

Event represents an eth1 event log in the system

func (*Event) UnmarshalYAML added in v0.4.0

func (e *Event) UnmarshalYAML(value *yaml.Node) error

type FeeRecipientAddressUpdatedEventYAML added in v0.4.7

type FeeRecipientAddressUpdatedEventYAML struct {
	Owner            string `yaml:"Owner"`
	RecipientAddress string `yaml:"RecipientAddress"`
}

type MockClient added in v0.2.0

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

MockClient is a mock of Client interface.

func NewMockClient added in v0.2.0

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) EXPECT added in v0.2.0

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) EventsFeed added in v0.2.0

func (m *MockClient) EventsFeed() *event.Feed

EventsFeed mocks base method.

func (*MockClient) IsReady

func (m *MockClient) IsReady(ctx context.Context) (bool, error)

IsReady mocks base method.

func (*MockClient) Start added in v0.2.0

func (m *MockClient) Start(logger *zap.Logger) error

Start mocks base method.

func (*MockClient) Sync added in v0.2.0

func (m *MockClient) Sync(logger *zap.Logger, fromBlock *big.Int) error

Sync mocks base method.

type MockClientMockRecorder added in v0.2.0

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) EventsFeed added in v0.2.0

func (mr *MockClientMockRecorder) EventsFeed() *gomock.Call

EventsFeed indicates an expected call of EventsFeed.

func (*MockClientMockRecorder) IsReady

func (mr *MockClientMockRecorder) IsReady(ctx interface{}) *gomock.Call

IsReady indicates an expected call of IsReady.

func (*MockClientMockRecorder) Start added in v0.2.0

func (mr *MockClientMockRecorder) Start(logger interface{}) *gomock.Call

Start indicates an expected call of Start.

func (*MockClientMockRecorder) Sync added in v0.2.0

func (mr *MockClientMockRecorder) Sync(logger, fromBlock interface{}) *gomock.Call

Sync indicates an expected call of Sync.

type MockSyncOffsetStorage added in v0.2.0

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

MockSyncOffsetStorage is a mock of SyncOffsetStorage interface.

func NewMockSyncOffsetStorage added in v0.2.0

func NewMockSyncOffsetStorage(ctrl *gomock.Controller) *MockSyncOffsetStorage

NewMockSyncOffsetStorage creates a new mock instance.

func (*MockSyncOffsetStorage) EXPECT added in v0.2.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSyncOffsetStorage) GetSyncOffset added in v0.2.0

func (m *MockSyncOffsetStorage) GetSyncOffset() (*SyncOffset, bool, error)

GetSyncOffset mocks base method.

func (*MockSyncOffsetStorage) SaveSyncOffset added in v0.2.0

func (m *MockSyncOffsetStorage) SaveSyncOffset(offset *SyncOffset) error

SaveSyncOffset mocks base method.

type MockSyncOffsetStorageMockRecorder added in v0.2.0

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

MockSyncOffsetStorageMockRecorder is the mock recorder for MockSyncOffsetStorage.

func (*MockSyncOffsetStorageMockRecorder) GetSyncOffset added in v0.2.0

func (mr *MockSyncOffsetStorageMockRecorder) GetSyncOffset() *gomock.Call

GetSyncOffset indicates an expected call of GetSyncOffset.

func (*MockSyncOffsetStorageMockRecorder) SaveSyncOffset added in v0.2.0

func (mr *MockSyncOffsetStorageMockRecorder) SaveSyncOffset(offset interface{}) *gomock.Call

SaveSyncOffset indicates an expected call of SaveSyncOffset.

type OperatorRemovedEventYAML added in v0.4.7

type OperatorRemovedEventYAML struct {
	ID uint64 `yaml:"ID"`
}

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"`
	ETH1ConnectionTimeout time.Duration `yaml:"ETH1ConnectionTimeout" env:"ETH_1_CONNECTION_TIMEOUT" env-default:"10s" env-description:"eth1 node connection timeout"`
	RegistryContractABI   string
	AbiVersion            Version
}

Options configurations related to eth1

type SyncEndedEvent

type SyncEndedEvent struct {
	// Success returns true if the sync went well (all events were parsed)
	Success bool
	// Block is the block number of the last block synced
	Block uint64
}

SyncEndedEvent meant to notify an observer that the sync is over

type SyncEventHandler added in v0.0.18

type SyncEventHandler func(Event) ([]zap.Field, error)

SyncEventHandler handles a given event

type SyncOffset added in v0.0.4

type SyncOffset = big.Int

SyncOffset is the type of variable used for passing around the offset

func StringToSyncOffset added in v0.4.7

func StringToSyncOffset(syncOffset string) *SyncOffset

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

type ValidatorRemovedEventYAML added in v0.4.7

type ValidatorRemovedEventYAML struct {
	Owner       string   `yaml:"Owner"`
	OperatorIds []uint64 `yaml:"OperatorIds"`
	PublicKey   string   `yaml:"PublicKey"`
}

type Version added in v0.1.8

type Version int64

Version enum to support more than one abi format

const (
	V1 Version = iota
)

Version types

func (Version) String added in v0.1.8

func (v Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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