Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TokenConfigValidation ¶ added in v1.2.0
func TokenConfigValidation(sl validator.StructLevel)
TokenConfigValidation method is for validation of tokenConfig struct
func ValidateIsUpdateMethodTypeIsNotStatic ¶ added in v1.2.0
func ValidateIsUpdateMethodTypeIsNotStatic(fl validator.FieldLevel) bool
ValidateIsUpdateMethodTypeIsNotStatic method is for validation update method type field is not static
func ValidateUpdateMethodType ¶ added in v1.2.0
func ValidateUpdateMethodType(fl validator.FieldLevel) bool
ValidateUpdateMethodType method is for validation update method field in config
Types ¶
type PriceUpdater ¶
type PriceUpdater struct {
// contains filtered or unexported fields
}
PriceUpdater definition
func NewPriceUpdater ¶
func NewPriceUpdater( defaultUpdateMethodType UpdateMethodType, tokensConfig []TokenConfig, db *historydb.HistoryDB, bitfinexV2URL, coingeckoV3URL string, ) (*PriceUpdater, error)
NewPriceUpdater is the constructor for the updater
func (*PriceUpdater) UpdatePrices ¶
func (p *PriceUpdater) UpdatePrices(ctx context.Context)
UpdatePrices is triggered by the Coordinator, and internally will update the token prices in the db
func (*PriceUpdater) UpdateTokenList ¶
func (p *PriceUpdater) UpdateTokenList() error
UpdateTokenList get the registered token symbols from HistoryDB
type TokenConfig ¶
type TokenConfig struct { UpdateMethod UpdateMethodType `validate:"is-valid-updatemethodtype"` StaticValue float64 // required by UpdateMethodTypeStatic Symbol string Addr ethCommon.Address }
TokenConfig specifies how a single token get its price updated
type UpdateMethodType ¶
type UpdateMethodType string
UpdateMethodType defines the token price update mechanism
const ( // UpdateMethodTypeBitFinexV2 is the http API used by bitfinex V2 UpdateMethodTypeBitFinexV2 UpdateMethodType = "bitfinexV2" // UpdateMethodTypeCoingeckoV3 is the http API used by copingecko V3 UpdateMethodTypeCoingeckoV3 UpdateMethodType = "coingeckoV3" // UpdateMethodTypeStatic is the value given by the configuration UpdateMethodTypeStatic UpdateMethodType = "static" // UpdateMethodTypeIgnore indicates to not update the value, to set value 0 // it's better to use UpdateMethodTypeStatic UpdateMethodTypeIgnore UpdateMethodType = "ignore" )
Click to show internal directories.
Click to hide internal directories.