eth1

package
v0.2.1-rc.6 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: GPL-3.0 Imports: 17 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

View Source
var (
	ContractAbiV2 = `` /* 16391-byte string literal not displayed */
)

Abi's to use

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(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, 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 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) ParseAccountEnabledEvent added in v0.2.0

func (ap AbiParser) ParseAccountEnabledEvent(log types.Log) (*abiparser.AccountEnabledEvent, error)

ParseAccountEnabledEvent parses AccountEnabledEvent

func (AbiParser) ParseAccountLiquidatedEvent added in v0.2.0

func (ap AbiParser) ParseAccountLiquidatedEvent(log types.Log) (*abiparser.AccountLiquidatedEvent, error)

ParseAccountLiquidatedEvent parses AccountLiquidatedEvent

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(logger *zap.Logger, log types.Log, contractAbi abi.ABI) (*abiparser.OperatorAddedEvent, error)
	ParseOperatorRemovedEvent(logger *zap.Logger, log types.Log, contractAbi abi.ABI) (*abiparser.OperatorRemovedEvent, error)
	ParseValidatorAddedEvent(logger *zap.Logger, log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorAddedEvent, error)
	ParseValidatorRemovedEvent(logger *zap.Logger, log types.Log, contractAbi abi.ABI) (*abiparser.ValidatorRemovedEvent, error)
	ParseAccountLiquidatedEvent(log types.Log) (*abiparser.AccountLiquidatedEvent, error)
	ParseAccountEnabledEvent(log types.Log) (*abiparser.AccountEnabledEvent, error)
}

AbiVersion serves as the parser client interface

type Client

type Client interface {
	EventsFeed() *event.Feed
	Start() error
	Sync(fromBlock *big.Int) error
}

Client represents the required interface for eth1 client

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

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) Start added in v0.2.0

func (m *MockClient) Start() error

Start mocks base method

func (*MockClient) Sync added in v0.2.0

func (m *MockClient) Sync(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) Start added in v0.2.0

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

Start indicates an expected call of Start

func (*MockClientMockRecorder) Sync added in v0.2.0

func (mr *MockClientMockRecorder) Sync(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 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 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

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

type Version added in v0.1.8

type Version int64

Version enum to support more than one abi format

const (
	Legacy Version = iota
	V2
)

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