Skip to content

Commit

Permalink
chore: fix sqs ingest bug due to division by zero panic (#7350) (#7351)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 20, 2024
1 parent f130309 commit e98fdfd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ingest/sqs/pools/ingester/pool_ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ func (pi *poolIngester) convertPool(
}

// Set base preecision to USDC
basePrecison = tokenPrecisionMap[usdcDenom]
basePrecison, ok = tokenPrecisionMap[usdcDenom]
if !ok {
errorInTVLStr = "no precision for denom " + usdcDenom
continue
}
} else {
// If there is no method to compute TVL for this denom, attach error and silently skip it.
errorInTVLStr = err.Error()
Expand All @@ -416,6 +420,11 @@ func (pi *poolIngester) convertPool(

uosmoBaseAssetSpotPrice = uosmoBaseAssetSpotPrice.Mul(precisionMultiplier)

if uosmoBaseAssetSpotPrice.IsZero() {
errorInTVLStr = "failed to calculate spot price due to it becoming zero from truncations " + balance.Denom
continue
}

routingInfo = denomRoutingInfo{
PoolID: poolForDenomPair,
Price: uosmoBaseAssetSpotPrice,
Expand Down

0 comments on commit e98fdfd

Please sign in to comment.