* Add from_address and to_address to vaa_volume_v3 * check from_address and to_address before adding to vaa_volume_v3 * normalize from_address and to_address * fix which chain to use in decoding * fix logger message from_chain and to_chain
This commit is contained in:
parent
9d743e7f5a
commit
ea33058324
|
@ -38,6 +38,8 @@ type TransferredToken struct {
|
|||
TokenAddress sdk.Address
|
||||
TokenChain sdk.ChainID
|
||||
Amount *big.Int
|
||||
FromAddress string
|
||||
ToAddress string
|
||||
}
|
||||
|
||||
func (t *TransferredToken) Clone() *TransferredToken {
|
||||
|
@ -169,6 +171,8 @@ func createToken(p *parser.ParseVaaWithStandarizedPropertiesdResponse, emitterCh
|
|||
TokenAddress: address,
|
||||
TokenChain: p.StandardizedProperties.TokenChain,
|
||||
Amount: n,
|
||||
FromAddress: p.StandardizedProperties.FromAddress,
|
||||
ToAddress: p.StandardizedProperties.ToAddress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -318,6 +318,30 @@ func (m *Metric) MakePointVaaVolumeV3(vaaVolumeV2Point *write.Point, params *Par
|
|||
|
||||
point.AddTag("size", strconv.Itoa(len(transferredToken.AppIDs)))
|
||||
|
||||
if transferredToken.FromAddress != "" {
|
||||
var fromAddr string
|
||||
fromAddrHex, err := domain.DecodeNativeAddressToHex(transferredToken.FromChain, transferredToken.FromAddress)
|
||||
if err != nil {
|
||||
m.logger.Error("Failed to decode native fromAddress to hex", zap.String("trackId", params.TrackID), zap.String("vaaId", params.Vaa.MessageID()), zap.String("nativeFromAddress", transferredToken.FromAddress), zap.Uint16("fromChain", uint16(transferredToken.FromChain)))
|
||||
fromAddr = transferredToken.FromAddress
|
||||
} else {
|
||||
fromAddr = fromAddrHex
|
||||
}
|
||||
point.AddField("from_address", fromAddr)
|
||||
}
|
||||
|
||||
if transferredToken.ToAddress != "" {
|
||||
var toAddr string
|
||||
toAddrHex, err := domain.DecodeNativeAddressToHex(transferredToken.ToChain, transferredToken.ToAddress)
|
||||
if err != nil {
|
||||
m.logger.Error("Failed to decode native toAddress to hex", zap.String("trackId", params.TrackID), zap.String("vaaId", params.Vaa.MessageID()), zap.String("nativeToAddress", transferredToken.ToAddress), zap.Uint16("toChain", uint16(transferredToken.ToChain)))
|
||||
toAddr = transferredToken.ToAddress
|
||||
} else {
|
||||
toAddr = toAddrHex
|
||||
}
|
||||
point.AddField("to_address", toAddr)
|
||||
}
|
||||
|
||||
if len(transferredToken.AppIDs) > 3 {
|
||||
m.logger.Warn("Too many appIDs.",
|
||||
zap.String("vaaId", params.Vaa.MessageID()),
|
||||
|
|
Loading…
Reference in New Issue