Documentation
¶
Index ¶
Constants ¶
View Source
const ( VaaCountMeasurement = "vaa_count" VaaVolumeMeasurement = "vaa_volume_v2" VaaAllMessagesMeasurement = "vaa_count_all_messages" )
Variables ¶
This section is empty.
Functions ¶
func MakePointForVaaCount ¶
MakePointForVaaCount generates a data point for the VAA count measurement.
Some VAAs will not generate a measurement, so the caller must always check whether the returned point is nil.
func MakePointForVaaVolume ¶
func MakePointForVaaVolume(params *MakePointForVaaVolumeParams) (*write.Point, error)
MakePointForVaaVolume builds the InfluxDB volume metric for a given VAA
Some VAAs will not generate a measurement, so the caller must always check whether the returned point is nil.
Types ¶
type MakePointForVaaVolumeParams ¶
type MakePointForVaaVolumeParams struct { // Vaa is the VAA for which we want to compute the volume metric Vaa *sdk.VAA // TokenPriceFunc returns the price of the given token at the specified timestamp. TokenPriceFunc func(tokenID string, timestamp time.Time) (decimal.Decimal, error) // Logger is an optional parameter, in case the caller wants additional visibility. Logger *zap.Logger // Metrics is in case the caller wants additional visibility. Metrics metrics.Metrics // TransferredToken is the token that was transferred in the VAA. TransferredToken *token.TransferredToken }
MakePointForVaaVolumeParams contains input parameters for the function `MakePointForVaaVolume`
type Metric ¶
type Metric struct {
// contains filtered or unexported fields
}
Metric definition.
func New ¶
func New( ctx context.Context, db *mongo.Database, influxCli influxdb2.Client, organization string, bucketInifite string, bucket30Days string, bucket24Hours string, notionalCache deltaswapscanNotionalCache.NotionalLocalCacheReadable, metrics metrics.Metrics, getTransferredTokenByVaa token.GetTransferredTokenByVaa, logger *zap.Logger, ) (*Metric, error)
New create a new *Metric.
type MetricPushFunc ¶
MetricPushFunc is a function to push metrics
type TransferPriceDoc ¶
type TransferPriceDoc struct { // ID is the unique identifier of the VAA for which we are storing price information. ID string `bson:"_id"` // Timestamp is the timestamp of the VAA for which we are storing price information. Timestamp time.Time `bson:"timestamp"` // Symbol is the trading symbol of the token being transferred. Symbol string `bson:"symbol"` // SymbolPriceUsd is the price of the token in USD at the moment of the transfer. SymbolPriceUsd string `bson:"price"` // TokenAmount is the amount of the token being transferred. TokenAmount string `bson:"tokenAmount"` // UsdAmount is the value in USD of the token being transferred. UsdAmount string `bson:"usdAmount"` }
TransferPriceDoc models a document in the `transferPrices` collection
Click to show internal directories.
Click to hide internal directories.