l1

package
v0.0.0-...-412688d Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConnectionTimeout        = 30 * time.Second
	DefaultConfDepth         uint64 = 20
	DefaultMaxBatchSize             = 100
)

Variables

View Source
var ZeroAddress common.Address

Functions

func HeaderByNumberWithRetry

func HeaderByNumberWithRetry(ctx context.Context,
	client *ethclient.Client) (*types.Header, error)

HeaderByNumberWithRetry retries the given func until it succeeds, waiting for clientRetryInterval duration after every call.

func QueryERC20

func QueryERC20(address common.Address, client *ethclient.Client) (*db.Token, error)

func QueryStateBatches

func QueryStateBatches(filterer *scc.StateCommitmentChainFilterer, startHeight, endHeight uint64, ctx context.Context) (map[common.Hash][]db.StateBatch, error)

Types

type ConfirmedHeaderSelector

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

func NewConfirmedHeaderSelector

func NewConfirmedHeaderSelector(cfg HeaderSelectorConfig) (*ConfirmedHeaderSelector,
	error)

func (*ConfirmedHeaderSelector) NewHead

func (f *ConfirmedHeaderSelector) NewHead(
	ctx context.Context,
	lowest uint64,
	header *types.Header,
	client *rpc.Client,
) ([]*NewHeader, error)

type Driver

type Driver interface {
	// Name is an identifier used to prefix logs for a particular service.
	Name() string
}

Driver is an interface for indexing deposits from l1.

type HeaderSelectorConfig

type HeaderSelectorConfig struct {
	ConfDepth    uint64
	MaxBatchSize uint64
}

type IndexerStatus

type IndexerStatus struct {
	Synced  float64           `json:"synced"`
	Highest db.L1BlockLocator `json:"highest_block"`
}

type NewHeader

type NewHeader struct {
	types.Header
	Hash common.Hash
}

func HeadersByRange

func HeadersByRange(ctx context.Context, client *rpc.Client, startHeight uint64, count int) ([]*NewHeader, error)

func (*NewHeader) UnmarshalJSON

func (h *NewHeader) UnmarshalJSON(input []byte) error

type Service

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

func NewService

func NewService(cfg ServiceConfig) (*Service, error)

func (*Service) GetDeposits

func (s *Service) GetDeposits(w http.ResponseWriter, r *http.Request)

func (*Service) GetIndexerStatus

func (s *Service) GetIndexerStatus(w http.ResponseWriter, r *http.Request)

func (*Service) Loop

func (s *Service) Loop(ctx context.Context)

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Update

func (s *Service) Update(newHeader *types.Header) error

type ServiceConfig

type ServiceConfig struct {
	Context               context.Context
	Metrics               *metrics.Metrics
	L1Client              *ethclient.Client
	RawL1Client           *rpc.Client
	ChainID               *big.Int
	AddressManagerAddress common.Address
	ConfDepth             uint64
	MaxHeaderBatchSize    uint64
	StartBlockNumber      uint64
	StartBlockHash        string
	DB                    *db.Database
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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