contract

package
v0.0.14-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringifyArg

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

StringifyArg resolves a method argument type to string type

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
	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{})

AddEmittedAddr adds event emitted addresses to our list if it passes filter and method polling is on

func (*Contract) AddEmittedHash

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

AddEmittedHash adds event emitted hashes to our list if it passes filter and method polling is on

func (Contract) Init

func (c Contract) Init() *Contract

Init initializes a contract object 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

PassesEventFilter 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

WantedEventArg 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

WantedMethodArg 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