parser

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package parser provides the logic to parse and store events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToUint8

func BoolToUint8(input *bool) *uint8

BoolToUint8 is a helper function to handle bool to uint8 conversion for clickhouse.

func GetAmountUSD

func GetAmountUSD(amount *big.Int, decimals uint8, price *float64) *float64

GetAmountUSD computes the USD value of a token amount.

func OpenYaml

func OpenYaml(path string) (map[string]string, error)

OpenYaml 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, bridgeConfigFetcher fetcher.BridgeConfigFetcher, 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) ParseAndStore

func (p *BridgeParser) ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error

ParseAndStore parses the bridge logs and stores them in the database.

nolint:gocognit,cyclop,dupl,maintidx

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, swapFetcher fetcher.SwapFetcher, consumerFetcher *fetcher.ScribeFetcher) (*SwapParser, error)

NewSwapParser creates a new parser for a given bridge.

func (*SwapParser) EventType

func (p *SwapParser) EventType(log ethTypes.Log) (_ swapTypes.EventType, ok bool)

EventType returns the event type of a swap log.

func (*SwapParser) ParseAndStore

func (p *SwapParser) ParseAndStore(ctx context.Context, log ethTypes.Log, chainID uint32) error

ParseAndStore parses and stores the swap logs.

Jump to

Keyboard shortcuts

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