Documentation
¶
Index ¶
Constants ¶
const (
DenomUSD = "USD"
)
Variables ¶
var ( // ErrEmptyConfigPath defines a sentinel error for an empty config path. ErrEmptyConfigPath = errors.New("empty configuration file path") // SupportedProviders defines a lookup table of all the supported currency API // providers. SupportedProviders = map[provider.Name]struct{}{ provider.ProviderKraken: {}, provider.ProviderBinance: {}, provider.ProviderBinanceUS: {}, provider.ProviderOsmosis: {}, provider.ProviderOsmosisV2: {}, provider.ProviderOkx: {}, provider.ProviderHuobi: {}, provider.ProviderGate: {}, provider.ProviderCoinbase: {}, provider.ProviderBitget: {}, provider.ProviderMexc: {}, provider.ProviderCrypto: {}, provider.ProviderMock: {}, } // SupportedQuotes defines a lookup table for which assets we support // using as quotes. SupportedQuotes = map[string]struct{}{ DenomUSD: {}, "USDC": {}, "USDT": {}, "DAI": {}, "BTC": {}, "ETH": {}, "ATOM": {}, "OSMO": {}, } )
Functions ¶
func CheckProviderMins ¶
CheckProviderMins starts the currency provider tracker to check the amount of providers available for a currency by querying CoinGecko's API. It will enforce a provider minimum for a given currency based on its available providers.
Types ¶
type Account ¶
type Account struct { ChainID string `mapstructure:"chain_id" validate:"required"` Address string `mapstructure:"address" validate:"required"` Validator string `mapstructure:"validator" validate:"required"` }
Account defines account related configuration that is related to the Umee network and transaction signing functionality.
type Config ¶
type Config struct { Server Server `mapstructure:"server"` CurrencyPairs []CurrencyPair `mapstructure:"currency_pairs" validate:"required,gt=0,dive,required"` Deviations []Deviation `mapstructure:"deviation_thresholds"` Account Account `mapstructure:"account" validate:"required,gt=0,dive,required"` Keyring Keyring `mapstructure:"keyring" validate:"required,gt=0,dive,required"` RPC RPC `mapstructure:"rpc" validate:"required,gt=0,dive,required"` Telemetry telemetry.Config `mapstructure:"telemetry"` GasAdjustment float64 `mapstructure:"gas_adjustment" validate:"required"` ProviderTimeout string `mapstructure:"provider_timeout"` ProviderMinOverride bool `mapstructure:"provider_min_override"` ProviderEndpoints []provider.Endpoint `mapstructure:"provider_endpoints" validate:"dive"` }
Config defines all necessary price-feeder configuration parameters.
func ParseConfig ¶
ParseConfig attempts to read and parse configuration from the given file path. An error is returned if reading or parsing the config fails.
func (Config) ProviderEndpointsMap ¶ added in v2.1.0
ProviderEndpointsMap converts the provider_endpoints from the config file into a map of provider.Endpoint where the key is the provider name
func (Config) ProviderPairs ¶ added in v2.1.0
func (c Config) ProviderPairs() map[provider.Name][]types.CurrencyPair
type CurrencyPair ¶
type CurrencyPair struct { Base string `mapstructure:"base" validate:"required"` Quote string `mapstructure:"quote" validate:"required"` Providers []provider.Name `mapstructure:"providers" validate:"required,gt=0,dive,required"` }
CurrencyPair defines a price quote of the exchange rate for two different currencies and the supported providers for getting the exchange rate.
type CurrencyProviderTracker ¶
type CurrencyProviderTracker struct { CurrencyProviders map[string][]string // map of price feeder currencies and what exchanges support them CurrencyProviderMin map[string]int // map of price feeder currencies and min required providers for them // contains filtered or unexported fields }
CurrencyProviderTracker queries the CoinGecko API and UMEE's osmosis-api for all the exchanges that support the currency pairs set in the price feeder config. It will poll the APIs every 24 hours to log any new exchanges that were added for a given currency.
REF: https://www.coingecko.com/en/api/documentation REF: https://github.com/umee-network/osmosis-api
func NewCurrencyProviderTracker ¶
func NewCurrencyProviderTracker( ctx context.Context, logger zerolog.Logger, pairs ...CurrencyPair, ) (*CurrencyProviderTracker, error)
type Deviation ¶
type Deviation struct { Base string `mapstructure:"base" validate:"required"` Threshold string `mapstructure:"threshold" validate:"required"` }
Deviation defines a maximum amount of standard deviations that a given asset can be from the median without being filtered out before voting.
type Keyring ¶
type Keyring struct { Backend string `mapstructure:"backend" validate:"required"` Dir string `mapstructure:"dir" validate:"required"` }
Keyring defines the required Umee keyring configuration.
type RPC ¶
type RPC struct { TMRPCEndpoint string `mapstructure:"tmrpc_endpoint" validate:"required"` GRPCEndpoint string `mapstructure:"grpc_endpoint" validate:"required"` RPCTimeout string `mapstructure:"rpc_timeout" validate:"required"` }
RPC defines RPC configuration of both the Umee gRPC and Tendermint nodes.
type Server ¶
type Server struct { ListenAddr string `mapstructure:"listen_addr"` WriteTimeout string `mapstructure:"write_timeout"` ReadTimeout string `mapstructure:"read_timeout"` VerboseCORS bool `mapstructure:"verbose_cors"` AllowedOrigins []string `mapstructure:"allowed_origins"` }
Server defines the API server configuration.