forked from cerc-io/ipld-eth-server
634604d0b5
- 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
30 lines
798 B
Go
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))
|
|
}
|