Fixes after merging staging

This commit is contained in:
Edvard 2018-12-11 15:19:27 +01:00
parent ff47e2e06e
commit 4e089c363e
4 changed files with 39 additions and 39 deletions

View File

@ -49,7 +49,7 @@ func backfillMakerLogs() {
repository := shared2.Repository{}
fetcher := shared2.NewFetcher(blockChain)
watcher := shared.NewWatcher(db, fetcher, repository)
watcher := shared.NewWatcher(db, fetcher, repository, transformers.TransformerConfigs())
watcher.AddTransformers(transformers.TransformerInitializers())
watcher.Execute()

View File

@ -25,7 +25,7 @@ type Watcher struct {
}
func NewWatcher(db *postgres.DB, fetcher shared.LogFetcher, repository WatcherRepository,
transformerConfigs []shared.TransformerConfig) Watcher {
transformerConfigs []shared.TransformerConfig) Watcher {
var contractAddresses []common.Address
var topic0s []common.Hash

View File

@ -143,10 +143,10 @@ var _ = Describe("Watcher", func() {
configA := shared2.TransformerConfig{TransformerName: "transformerA",
ContractAddresses: []string{"0x000000000000000000000000000000000000000A"},
Topic: "0xA"}
Topic: "0xA"}
configB := shared2.TransformerConfig{TransformerName: "transformerB",
ContractAddresses: []string{"0x000000000000000000000000000000000000000b"},
Topic: "0xB"}
Topic: "0xB"}
configs := []shared2.TransformerConfig{configA, configB}
logA := types.Log{Address: common.HexToAddress("0xA"),

View File

@ -18,6 +18,8 @@ import (
"github.com/ethereum/go-ethereum/common"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk"
@ -26,37 +28,46 @@ import (
)
var _ = Describe("PitFileIlk LogNoteTransformer", func() {
It("fetches and transforms a Pit.file ilk 'spot' event from Kovan", func() {
blockNumber := int64(9103223)
config := ilk.IlkFileConfig
config.StartingBlockNumber = blockNumber
config.EndingBlockNumber = blockNumber
var (
db *postgres.DB
blockChain core.BlockChain
initializer factories.LogNoteTransformer
addresses []common.Address
topics []common.Hash
)
BeforeEach(func() {
rpcClient, ethClient, err := getClients(ipc)
Expect(err).NotTo(HaveOccurred())
blockChain, err := getBlockChain(rpcClient, ethClient)
blockChain, err = getBlockChain(rpcClient, ethClient)
Expect(err).NotTo(HaveOccurred())
db := test_config.NewTestDB(blockChain.Node())
db = test_config.NewTestDB(blockChain.Node())
test_config.CleanTestDB(db)
config := ilk.IlkFileConfig
header, err := persistHeader(db, blockNumber, blockChain)
Expect(err).NotTo(HaveOccurred())
addresses = shared.HexStringsToAddresses(config.ContractAddresses)
topics = []common.Hash{common.HexToHash(config.Topic)}
initializer := factories.LogNoteTransformer{
initializer = factories.LogNoteTransformer{
Config: config,
Converter: &ilk.PitFileIlkConverter{},
Repository: &ilk.PitFileIlkRepository{},
}
transformer := initializer.NewLogNoteTransformer(db)
})
fetcher := shared.NewFetcher(blockChain)
logs, err := fetcher.FetchLogs(
shared.HexStringsToAddresses(config.ContractAddresses),
[]common.Hash{common.HexToHash(config.Topic)},
header)
It("fetches and transforms a Pit.file ilk 'spot' event from Kovan", func() {
blockNumber := int64(9103223)
initializer.Config.StartingBlockNumber = blockNumber
initializer.Config.EndingBlockNumber = blockNumber
header, err := persistHeader(db, blockNumber, blockChain)
Expect(err).NotTo(HaveOccurred())
fetcher := shared.NewFetcher(blockChain)
logs, err := fetcher.FetchLogs(addresses, topics, header)
Expect(err).NotTo(HaveOccurred())
transformer := initializer.NewLogNoteTransformer(db)
err = transformer.Execute(logs, header)
Expect(err).NotTo(HaveOccurred())
@ -72,29 +83,18 @@ var _ = Describe("PitFileIlk LogNoteTransformer", func() {
It("fetches and transforms a Pit.file ilk 'line' event from Kovan", func() {
blockNumber := int64(8762253)
config := ilk.IlkFileConfig
config.StartingBlockNumber = blockNumber
config.EndingBlockNumber = blockNumber
initializer.Config.StartingBlockNumber = blockNumber
initializer.Config.EndingBlockNumber = blockNumber
rpcClient, ethClient, err := getClients(ipc)
Expect(err).NotTo(HaveOccurred())
blockChain, err := getBlockChain(rpcClient, ethClient)
header, err := persistHeader(db, blockNumber, blockChain)
Expect(err).NotTo(HaveOccurred())
db := test_config.NewTestDB(blockChain.Node())
test_config.CleanTestDB(db)
err = persistHeader(db, blockNumber, blockChain)
fetcher := shared.NewFetcher(blockChain)
logs, err := fetcher.FetchLogs(addresses, topics, header)
Expect(err).NotTo(HaveOccurred())
initializer := factories.LogNoteTransformer{
Config: config,
Fetcher: &shared.Fetcher{},
Converter: &ilk.PitFileIlkConverter{},
Repository: &ilk.PitFileIlkRepository{},
}
transformer := initializer.NewLogNoteTransformer(db, blockChain)
err = transformer.Execute()
transformer := initializer.NewLogNoteTransformer(db)
err = transformer.Execute(logs, header)
Expect(err).NotTo(HaveOccurred())
var dbResult []ilk.PitFileIlkModel