From 1300ead930f74f8f83b133dbe2b3cff51d0dbdfd Mon Sep 17 00:00:00 2001 From: gipsh Date: Wed, 27 Sep 2023 09:47:32 -0300 Subject: [PATCH] include token data in transferPrices collection --- analytics/metric/mongo.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/analytics/metric/mongo.go b/analytics/metric/mongo.go index c4ed74a4..8b2193d9 100644 --- a/analytics/metric/mongo.go +++ b/analytics/metric/mongo.go @@ -29,6 +29,12 @@ type TransferPriceDoc struct { TokenAmount string `bson:"tokenAmount"` // UsdAmount is the value in USD of the token being transferred. UsdAmount string `bson:"usdAmount"` + // TokenChain is the chain ID of the token being transferred. + TokenChain uint16 `bson:"tokenChain"` + // TokenAddress is the address of the token being transferred. + TokenAddress string `bson:"tokenAddress"` + // CoinGeckoID is the CoinGecko ID of the token being transferred. + CoinGeckoID string `bson:"coinGeckoId"` } func upsertTransferPrices( @@ -92,10 +98,13 @@ func upsertTransferPrices( SymbolPriceUsd: notionalUSD.Truncate(8).String(), TokenAmount: tokenAmount.Truncate(8).String(), UsdAmount: usdAmount.Truncate(8).String(), + TokenChain: uint16(transferredToken.TokenChain), + TokenAddress: transferredToken.TokenAddress.String(), + CoinGeckoID: tokenMeta.CoingeckoID, }, } _, err = transferPrices.UpdateByID( - context.Background(), + ctx, vaa.MessageID(), update, options.Update().SetUpsert(true),