Documentation ¶
Overview ¶
Package parser provides the logic to parse and store events.
Index ¶
- Constants
- func BoolToUint8(input *bool) *uint8
- func GetAmountUSD(amount *big.Int, decimals uint8, price *float64) *float64
- func ParseYaml(yamlFile []byte) (res map[string]string, err error)
- func ToNullString(str *string) sql.NullString
- type BridgeParser
- type MessageBusParser
- func (m *MessageBusParser) EventType(log ethTypes.Log) (_ messageBusTypes.EventType, ok bool)
- func (m *MessageBusParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error)
- func (m *MessageBusParser) ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error
- type Parser
- type SwapParser
Constants ¶
const ErrUnknownTopic = "unknown topic"
ErrUnknownTopic is returned when the topic is unknown.
Variables ¶
This section is empty.
Functions ¶
func BoolToUint8 ¶
BoolToUint8 is a helper function to handle bool to uint8 conversion for clickhouse.
func GetAmountUSD ¶
GetAmountUSD computes the USD value of a token amount.
func ParseYaml ¶ added in v0.0.31
ParseYaml opens yaml file with coin gecko ID mapping and returns it.
func ToNullString ¶
func ToNullString(str *string) sql.NullString
ToNullString is a helper function to convert values to null string.
Types ¶
type BridgeParser ¶
type BridgeParser struct { // Filterer is the bridge Filterer we use to parse events. Filterer *bridge.SynapseBridgeFilterer // Filterer is the bridge Filterer we use to parse events. FiltererV1 *bridgev1.SynapseBridgeFilterer // contains filtered or unexported fields }
BridgeParser parses events from the bridge contract.
func NewBridgeParser ¶
func NewBridgeParser(consumerDB db.ConsumerDB, bridgeAddress common.Address, tokenDataService tokendata.Service, consumerFetcher *fetcher.ScribeFetcher) (*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) Parse ¶ added in v0.0.31
func (p *BridgeParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error)
Parse parses the bridge logs and returns a model that can be stored
nolint:gocognit,cyclop,dupl,maintidx
func (*BridgeParser) ParseAndStore ¶
ParseAndStore parses the bridge logs and returns a model that can be stored Deprecated: use Parse and store separately.
type MessageBusParser ¶ added in v0.0.19
type MessageBusParser struct { // Filterer is the message Filterer we use to parse events Filterer *messagebus.MessageBusUpgradeableFilterer // contains filtered or unexported fields }
MessageBusParser parses messagebus logs.
func NewMessageBusParser ¶ added in v0.0.19
func NewMessageBusParser(consumerDB db.ConsumerDB, messageBusAddress common.Address, consumerFetcher *fetcher.ScribeFetcher) (*MessageBusParser, error)
NewMessageBusParser creates a new parser for a given message.
func (*MessageBusParser) EventType ¶ added in v0.0.19
func (m *MessageBusParser) EventType(log ethTypes.Log) (_ messageBusTypes.EventType, ok bool)
EventType returns the event type of a message log.
func (*MessageBusParser) Parse ¶ added in v0.0.31
func (m *MessageBusParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error)
Parse parses the message logs.
nolint:gocognit,cyclop,dupl
func (*MessageBusParser) ParseAndStore ¶ added in v0.0.19
func (m *MessageBusParser) ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error
ParseAndStore parses the message logs and returns a model that can be stored Deprecated: use Parse and store separately.
type Parser ¶
type Parser interface { // ParseAndStore parses the logs and stores them in the database. // Deprecated: use Parse ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error // Parse parses the logs and returns the parsed data. Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, 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, consumerFetcher *fetcher.ScribeFetcher, swapService *fetcher.SwapService, tokenDataService tokendata.Service) (*SwapParser, error)
NewSwapParser creates a new parser for a given bridge.
func (*SwapParser) Parse ¶ added in v0.0.31
func (p *SwapParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error)
Parse parses the swap logs.
func (*SwapParser) ParseAndStore ¶
ParseAndStore parses the swap logs and returns a model that can be stored Deprecated: use Parse and store separately.