Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyBlockHash = errors.New("block hash is empty")
Functions ¶
func IndexLogs ¶
- IndexLogs will run until the eventChannel is closed, passing each event to the logStorer. - If an event fails to be stored, and the error is retryable, it will sleep for 100ms and try again. - The only non-retriable errors should be things like malformed events or failed validations.
Types ¶
type BlockTracker ¶
type BlockTracker struct {
// contains filtered or unexported fields
}
* BlockTracker keeps a database record of the latest block that has been indexed for a contract address and allows the user to increase the value. *
func NewBlockTracker ¶
func NewBlockTracker( ctx context.Context, client blockchain.ChainClient, address common.Address, queries *queries.Queries, deploymentBlock uint64, ) (*BlockTracker, error)
Return a new BlockTracker initialized to the latest block from the DB
func (*BlockTracker) GetLatestBlock ¶
func (bt *BlockTracker) GetLatestBlock() (uint64, []byte)
func (*BlockTracker) UpdateLatestBlock ¶
type IBlockTracker ¶
type IBlockTracker interface {
GetLatestBlock() (uint64, []byte)
UpdateLatestBlock(ctx context.Context, block uint64, hash []byte) error
}
Tracks the latest block number and hash for a contract.
type IContract ¶
type IContract interface {
IBlockTracker
IReorgHandler
ILogStorer
Address() common.Address
Topics() []common.Hash
Logger() *zap.Logger
}
An IContract is a contract that can be indexed.
type ILogStorer ¶
Takes a log event and stores it, returning either an error that may be retriable, non-retriable, or nil.
type ILogStreamer ¶
An ILogStreamer streams logs from a source through a channel.