forked from cerc-io/ipld-eth-server
finish method polling with hash or address type argument values
collected from watched events; 'MissingMethodsCheckedEventsIntersection' method to find headers which have been checked for each event of interest but methods have not yet been polled at that header; tests for new features; travis ci go version 1.9 -> 1.11 ; consolidate omniWatcher and lightOmniWatcher into single command with light as default
This commit is contained in:
@@ -18,7 +18,6 @@ package contract
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
@@ -44,23 +43,22 @@ type Contract struct {
|
||||
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
|
||||
EmittedBytes map[interface{}]bool // List of all unique bytes 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
|
||||
}
|
||||
|
||||
// If we will be calling methods that use addr, hash, or byte arrays
|
||||
// as arguments then we initialize map to hold these types of values
|
||||
// as arguments then we initialize maps to hold these types of values
|
||||
func (c Contract) Init() *Contract {
|
||||
for _, method := range c.Methods {
|
||||
for _, arg := range method.Args {
|
||||
switch arg.Type.T {
|
||||
case abi.AddressTy:
|
||||
c.EmittedAddrs = map[interface{}]bool{}
|
||||
case abi.HashTy:
|
||||
case abi.HashTy, abi.BytesTy, abi.FixedBytesTy:
|
||||
c.EmittedHashes = map[interface{}]bool{}
|
||||
case abi.BytesTy, abi.FixedBytesTy:
|
||||
c.EmittedBytes = map[interface{}]bool{}
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -160,15 +158,6 @@ func (c *Contract) AddEmittedHash(hashes ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add event emitted bytes to our list if it passes filter and method polling is on
|
||||
func (c *Contract) AddEmittedBytes(byteArrays ...interface{}) {
|
||||
for _, bytes := range byteArrays {
|
||||
if c.WantedMethodArg(bytes) && c.Methods != nil {
|
||||
c.EmittedBytes[bytes] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func StringifyArg(arg interface{}) (str string) {
|
||||
switch arg.(type) {
|
||||
case string:
|
||||
|
||||
Reference in New Issue
Block a user