Snag transformer topics from config in factory
This commit is contained in:
parent
155569a1d8
commit
46d8ea8d97
@ -57,13 +57,19 @@ func (transformer Transformer) Execute() error {
|
|||||||
|
|
||||||
log.Printf("Fetching vat move event logs for %d headers \n", len(missingHeaders))
|
log.Printf("Fetching vat move event logs for %d headers \n", len(missingHeaders))
|
||||||
for _, header := range missingHeaders {
|
for _, header := range missingHeaders {
|
||||||
// TODO Needs signature in config
|
// Grab topics from config
|
||||||
topics := [][]common.Hash{{common.HexToHash(shared.VatMoveSignature)}}
|
var topics [][]common.Hash
|
||||||
|
for _, topic := range transformer.Config.Topics {
|
||||||
|
topics = append(topics, []common.Hash{common.HexToHash(topic)})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch the missing logs for a given header
|
||||||
matchingLogs, err := transformer.Fetcher.FetchLogs(transformer.Config.ContractAddresses, topics, header.BlockNumber)
|
matchingLogs, err := transformer.Fetcher.FetchLogs(transformer.Config.ContractAddresses, topics, header.BlockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No matching logs, mark the header as checked for this type of logs
|
||||||
if len(matchingLogs) < 1 {
|
if len(matchingLogs) < 1 {
|
||||||
err := transformer.Repository.MarkHeaderChecked(header.Id)
|
err := transformer.Repository.MarkHeaderChecked(header.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -76,7 +82,8 @@ func (transformer Transformer) Execute() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't assert the whole collection, need to wash types individually
|
// Can't assert a whole collection, wash types individually for Create,
|
||||||
|
// which needs interface{}
|
||||||
var typelessModels []interface{}
|
var typelessModels []interface{}
|
||||||
for _, m := range models {
|
for _, m := range models {
|
||||||
typelessModels = append(typelessModels, m.(interface{}))
|
typelessModels = append(typelessModels, m.(interface{}))
|
||||||
|
Loading…
Reference in New Issue
Block a user