transformer

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transformer

type Transformer struct {
	// Database interfaces
	EventRepository  srep.EventRepository        // Holds transformed watched event log data
	HeaderRepository repository.HeaderRepository // Interface for interaction with header repositories

	// Pre-processing interfaces
	Parser    parser.Parser            // Parses events and methods out of contract abi fetched using contract address
	Retriever retriever.BlockRetriever // Retrieves first block for contract

	// Processing interfaces
	Fetcher   fetcher.Fetcher              // Fetches event logs, using header hashes
	Converter converter.ConverterInterface // Converts watched event logs into custom log
	Poller    poller.Poller                // Polls methods using arguments collected from events and persists them using a method datastore

	// Store contract configuration information
	Config config.ContractConfig

	// Store contract info as mapping to contract address
	Contracts map[string]*contract.Contract

	Start int64 // Hold the lowest starting block and the highest ending block
	// contains filtered or unexported fields
}

Transformer is the top level struct for transforming watched contract data Requires a header synced vDB (headers) and a running eth node (or infura)

func NewTransformer

func NewTransformer(con config.ContractConfig, bc core.BlockChain, db *postgres.DB) *Transformer

NewTransformer takes in a contract config, blockchain, and database, and returns a new Transformer

func (*Transformer) Execute

func (tr *Transformer) Execute() error

Execute runs the transformation processes

func (*Transformer) GetConfig

func (tr *Transformer) GetConfig() config.ContractConfig

GetConfig returns the transformers config; satisfies the transformer interface

func (*Transformer) Init

func (tr *Transformer) Init() error

Init initialized the Transformer Use after creating and setting transformer Loops over all of the addr => filter sets Uses parser to pull event info from abi Use this info to generate event filters

Jump to

Keyboard shortcuts

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