contract

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: AGPL-3.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringifyArg

func StringifyArg(arg interface{}) (str string)

Types

type Contract

type Contract struct {
	Name           string                       // Name of the contract
	Address        string                       // Address of the contract
	Network        string                       // Network on which the contract is deployed; default empty "" is Ethereum mainnet
	StartingBlock  int64                        // Starting block of the contract
	Abi            string                       // Abi string
	ParsedAbi      abi.ABI                      // Parsed abi
	Events         map[string]types.Event       // List of events to watch
	Methods        []types.Method               // List of methods to poll
	Filters        map[string]filters.LogFilter // Map of event filters to their event names; used only for full sync watcher
	FilterArgs     map[string]bool              // User-input list of values to filter event logs for
	MethodArgs     map[string]bool              // User-input list of values to limit method polling to
	EmittedAddrs   map[interface{}]bool         // List of all unique addresses collected from converted event logs
	EmittedHashes  map[interface{}]bool         // List of all unique hashes collected from converted event logs
	CreateAddrList bool                         // Whether or not to persist address list to postgres
	CreateHashList bool                         // Whether or not to persist hash list to postgres
	Piping         bool                         // Whether or not to pipe method results forward as arguments to subsequent methods
}

Contract object to hold our contract data

func (*Contract) AddEmittedAddr

func (c *Contract) AddEmittedAddr(addresses ...interface{})

Add event emitted address to our list if it passes filter and method polling is on

func (*Contract) AddEmittedHash

func (c *Contract) AddEmittedHash(hashes ...interface{})

Add event emitted hash to our list if it passes filter and method polling is on

func (*Contract) GenerateFilters

func (c *Contract) GenerateFilters() error

Use contract info to generate event filters - full sync contract watcher only

func (Contract) Init

func (c Contract) Init() *Contract

If we will be calling methods that use addr, hash, or byte arrays as arguments then we initialize maps to hold these types of values

func (*Contract) PassesEventFilter

func (c *Contract) PassesEventFilter(args map[string]string) bool

Returns true if any mapping value matches filtered for address or if no filter exists Used to check if an event log name-value mapping should be filtered or not

func (*Contract) WantedEventArg

func (c *Contract) WantedEventArg(arg string) bool

Returns true if address is in list of arguments to filter events for or if no filtering is specified

func (*Contract) WantedMethodArg

func (c *Contract) WantedMethodArg(arg interface{}) bool

Returns true if address is in list of arguments to poll methods with or if no filtering is specified

Jump to

Keyboard shortcuts

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