ipld-eth-server/pkg/transformers/test_data/mocks/price_feeds/fetcher.go
Rob Mulholand 634604d0b5 Combine price feed transformers
- fetches logs from all three price feeds in one query
- assumes eth/usd price feed will be updated to include LogValue event
- updates transformers to run separate from header sync
2018-08-16 11:22:16 -05:00

30 lines
798 B
Go

package price_feeds
import (
"github.com/ethereum/go-ethereum/core/types"
. "github.com/onsi/gomega"
)
type MockPriceFeedFetcher struct {
passedBlockNumbers []int64
returnErr error
returnLogs []types.Log
}
func (fetcher *MockPriceFeedFetcher) SetReturnErr(err error) {
fetcher.returnErr = err
}
func (fetcher *MockPriceFeedFetcher) SetReturnLogs(logs []types.Log) {
fetcher.returnLogs = logs
}
func (fetcher *MockPriceFeedFetcher) FetchLogValues(blockNumber int64) ([]types.Log, error) {
fetcher.passedBlockNumbers = append(fetcher.passedBlockNumbers, blockNumber)
return fetcher.returnLogs, fetcher.returnErr
}
func (fetcher *MockPriceFeedFetcher) AssertFetchLogValuesCalledWith(blockNumbers []int64) {
Expect(fetcher.passedBlockNumbers).To(Equal(blockNumbers))
}