Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailingMockProvider ¶
type FailingMockProvider struct {
*StaticMockProvider
}
FailingMockProvider defines a mocked exchange rate provider that always fails when fetching prices.
func NewFailingMockProvider ¶
func NewFailingMockProvider() *FailingMockProvider
NewFailingMockProvider returns a new failing mock provider.
func (FailingMockProvider) GetPrices ¶
func (p FailingMockProvider) GetPrices(_ context.Context) (map[oracletypes.CurrencyPair]aggregator.QuotePrice, error)
GetPrices always fails for the failing mock provider.
func (FailingMockProvider) Name ¶
func (p FailingMockProvider) Name() string
Name returns the name of the failing mock provider.
type StaticMockProvider ¶
type StaticMockProvider struct {
// contains filtered or unexported fields
}
StaticMockProvider defines a mocked exchange rate provider using fixed exchange rates.
func NewStaticMockProvider ¶
func NewStaticMockProvider() *StaticMockProvider
NewStaticMockProvider returns a new mock provider. The mock provider will always return the same static data. Meant to be used for testing.
func NewStaticMockProviderFromConfig ¶
func NewStaticMockProviderFromConfig(providerConfig config.ProviderConfig) (*StaticMockProvider, error)
NewStaticMockProviderFromConfig constructs a new static mock provider from the config Notice this method expects the TokenNameToSymbol map to be populated w/ entries of the form CurrencyPair.ToString(): big.NewInt(price)
func (StaticMockProvider) GetPairs ¶
func (p StaticMockProvider) GetPairs() []oracletypes.CurrencyPair
GetPairs is a no-op for the mock provider.
func (StaticMockProvider) GetPrices ¶
func (p StaticMockProvider) GetPrices(_ context.Context) (map[oracletypes.CurrencyPair]aggregator.QuotePrice, error)
GetPrices returns the mocked exchange rates.
func (StaticMockProvider) Name ¶
func (p StaticMockProvider) Name() string
Name returns the name of the mock provider.
func (StaticMockProvider) SetPairs ¶
func (p StaticMockProvider) SetPairs(_ ...oracletypes.CurrencyPair)
SetPairs is a no-op for the mock provider.
type StaticMockProviderConfig ¶
type StaticMockProviderConfig struct { // TokenPrices is a map of token names to their metadata. TokenPrices map[string]string `mapstructure:"tokens" toml:"tokens"` }
StaticMockProviderConfig is a map of token names to their metadata.
func ReadStaticMockProviderConfigFromFile ¶
func ReadStaticMockProviderConfigFromFile(path string) (StaticMockProviderConfig, error)
ReadStaticMockProviderConfigFromFile reads the static mock provider config from the given file.
type TimeoutMockProvider ¶
type TimeoutMockProvider struct { *StaticMockProvider // contains filtered or unexported fields }
TimeoutMockProvider defines a mocked exchange rate provider that always times out when fetching prices.
func NewTimeoutMockProvider ¶
func NewTimeoutMockProvider(timeout time.Duration) (*TimeoutMockProvider, error)
NewTimeoutMockProvider returns a new timeout mock provider.
func (TimeoutMockProvider) GetPrices ¶
func (p TimeoutMockProvider) GetPrices(_ context.Context) (map[oracletypes.CurrencyPair]aggregator.QuotePrice, error)
GetPrices always times out for the timeout mock provider.
func (TimeoutMockProvider) Name ¶
func (p TimeoutMockProvider) Name() string
Name returns the name of the timeout mock provider.