(VDB-99) Transform Flap deal events

- Add flapper address to deal transformer config
This commit is contained in:
Rob Mulholand 2018-11-06 12:45:45 -06:00
parent 9cc9d4d3b6
commit a1c4d70a77
2 changed files with 26 additions and 2 deletions

View File

@ -18,7 +18,7 @@ import "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
var DealConfig = shared.TransformerConfig{
TransformerName: shared.DealLabel,
ContractAddresses: []string{shared.FlipperContractAddress, shared.FlopperContractAddress},
ContractAddresses: []string{shared.FlapperContractAddress, shared.FlipperContractAddress, shared.FlopperContractAddress},
ContractAbi: shared.FlipperABI,
Topic: shared.DealSignature,
StartingBlockNumber: 0,

View File

@ -80,6 +80,30 @@ var _ = Describe("Deal transformer", func() {
})
It("persists a flap deal log event", func() {
//TODO: The flap.deal transformer has not yet been implemented
flapBlockNumber := int64(9004628)
err = persistHeader(db, flapBlockNumber)
Expect(err).NotTo(HaveOccurred())
config := deal.DealConfig
config.StartingBlockNumber = flapBlockNumber
config.EndingBlockNumber = flapBlockNumber
initializer := factories.LogNoteTransformer{
Config: config,
Converter: &deal.DealConverter{},
Repository: &deal.DealRepository{},
Fetcher: &shared.Fetcher{},
}
transformer := initializer.NewLogNoteTransformer(db, blockchain)
err := transformer.Execute()
Expect(err).NotTo(HaveOccurred())
var dbResult []deal.DealModel
err = db.Select(&dbResult, `SELECT bid_id, contract_address FROM maker.deal`)
Expect(err).NotTo(HaveOccurred())
Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].BidId).To(Equal("1"))
Expect(dbResult[0].ContractAddress).To(Equal(shared.FlapperContractAddress))
})
})