Documentation ¶
Overview ¶
Package consumer provides a consumer for the database. It deals with querying, parsing, and storing logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTokenDoesNotExist = errors.New("token id does not exist")
ErrTokenDoesNotExist indicates the queried for token does not exist.
Functions ¶
This section is empty.
Types ¶
type BridgeConfigFetcher ¶
type BridgeConfigFetcher struct { // contains filtered or unexported fields } // TODO switch bridge config based on block number
BridgeConfigFetcher is the fetcher for the bridge config contract.
func NewBridgeConfigFetcher ¶
func NewBridgeConfigFetcher(bridgeConfigAddress common.Address, backend bind.ContractBackend) (*BridgeConfigFetcher, error)
NewBridgeConfigFetcher creates a new config fetcher. Backend must be an archive backend.
func (*BridgeConfigFetcher) GetToken ¶
func (b *BridgeConfigFetcher) GetToken(ctx context.Context, chainID, block uint32, tokenID string) (token *bridgeconfig.BridgeConfigV3Token, err error)
GetToken gets the token from the bridge config contract.
func (*BridgeConfigFetcher) GetTokenID ¶
func (b *BridgeConfigFetcher) GetTokenID(ctx context.Context, chainID uint32, tokenAddress common.Address) (tokenID *string, err error)
GetTokenID gets the token id from the bridge config contract.
type BridgeParser ¶
type BridgeParser struct { // Filterer is the bridge Filterer we use to parse events Filterer *bridge.SynapseBridgeFilterer // contains filtered or unexported fields }
BridgeParser parses events from the bridge contract.
func NewBridgeParser ¶
func NewBridgeParser(consumerDB db.ConsumerDB, bridgeAddress common.Address, bridgeConfigFetcher BridgeConfigFetcher) (*BridgeParser, error)
NewBridgeParser creates a new parser for a given bridge.
func (*BridgeParser) EventType ¶
func (p *BridgeParser) EventType(log ethTypes.Log) (_ bridgeTypes.EventType, ok bool)
EventType returns the event type of a bridge log.
func (*BridgeParser) ParseAndStore ¶
ParseAndStore parses the bridge logs and stores them in the database.
nolint:gocognit,cyclop,dupl
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher is the fetcher for the events. It uses GQL.
func NewFetcher ¶
NewFetcher creates a new fetcher.
type Parser ¶
type Parser interface { // ParseAndStore parses the logs and stores them in the database. ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error }
Parser parses events and stores them.
type SwapParser ¶
type SwapParser struct { // Filterer is the swap Filterer we use to parse events Filterer *swap.SwapFlashLoanFilterer // contains filtered or unexported fields }
SwapParser parses events from the swap contract.
func NewSwapParser ¶
func NewSwapParser(consumerDB db.ConsumerDB, swapAddress common.Address) (*SwapParser, error)
NewSwapParser creates a new parser for a given bridge.
func (*SwapParser) ParseAndStore ¶
ParseAndStore parses and stores the swap logs.
Directories ¶
Path | Synopsis |
---|---|
Package backfill provides a command to backfill the consumer database.
|
Package backfill provides a command to backfill the consumer database. |
Package client provides a GraphQL client for consuming logs.
|
Package client provides a GraphQL client for consuming logs. |
contrib
Package main generates a GQL client.
|
Package main generates a GQL client. |