Flop deal (#39)

*Refactor deal transformer to take in several contract addresses
* Add flop address to deal transformer
This commit is contained in:
Elizabeth
2018-09-27 10:12:29 -05:00
committed by GitHub
parent 369939ad84
commit b0cd852aa3
66 changed files with 145 additions and 137 deletions
+6 -6
View File
@@ -28,25 +28,25 @@ import (
var _ = Describe("Fetcher", func() {
Describe("FetchLogs", func() {
It("fetches logs based on the given query", func() {
blockChain := fakes.NewMockBlockChain()
fetcher := shared.NewFetcher(blockChain)
blockNumber := int64(123)
address := "0xfakeAddress"
addresses := []string{"0xfakeAddress", "0xanotherFakeAddress"}
topicZeros := [][]common.Hash{{common.BytesToHash([]byte{1, 2, 3, 4, 5})}}
_, err := fetcher.FetchLogs(address, topicZeros, blockNumber)
_, err := fetcher.FetchLogs(addresses, topicZeros, blockNumber)
address1 := common.HexToAddress("0xfakeAddress")
address2 := common.HexToAddress("0xanotherFakeAddress")
Expect(err).NotTo(HaveOccurred())
expectedQuery := ethereum.FilterQuery{
FromBlock: big.NewInt(blockNumber),
ToBlock: big.NewInt(blockNumber),
Addresses: []common.Address{common.HexToAddress(address)},
Addresses: []common.Address{address1, address2},
Topics: topicZeros,
}
blockChain.AssertGetEthLogsWithCustomQueryCalledWith(expectedQuery)
})
It("returns an error if fetching the logs fails", func() {
@@ -54,7 +54,7 @@ var _ = Describe("Fetcher", func() {
blockChain.SetGetEthLogsWithCustomQueryErr(fakes.FakeError)
fetcher := shared.NewFetcher(blockChain)
_, err := fetcher.FetchLogs("", [][]common.Hash{}, int64(1))
_, err := fetcher.FetchLogs([]string{}, [][]common.Hash{}, int64(1))
Expect(err).To(HaveOccurred())
Expect(err).To(MatchError(fakes.FakeError))