transformer

package
Version: v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

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
	FilterRepository           datastore.FilterRepository       // Log filters repo; accepts filters generated by Contract.GenerateFilters()
	WatchedEventRepository     datastore.WatchedEventRepository // Watched event log views, created by the log filters
	TransformedEventRepository repository.EventRepository       // Holds transformed watched event log data

	// 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 and current block height

	// Processing interfaces
	Converter converter.ConverterInterface // Converts watched event logs into custom log
	Poller    poller.Poller                // Polls methods using contract's token holder addresses and persists them using method datastore

	// Store contract configuration information
	Config config.ContractConfig

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

	// Latest block in the block repository
	LastBlock int64
}

Requires a fully synced vDB and a running eth node (or infura)

func NewTransformer

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

Transformer takes in config for blockchain, database, and network id

func (*Transformer) Execute

func (tr *Transformer) Execute() error

Iterates through stored, initialized contract objects Iterates through contract's event filters, grabbing watched event logs Uses converter to convert logs into custom log type Persists converted logs into custuom postgres tables Calls selected methods, using token holder address generated during event log conversion

func (*Transformer) GetConfig

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

func (*Transformer) Init

func (tr *Transformer) Init() error

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

Source Files

Jump to

Keyboard shortcuts

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