Skip to content

Commit 2454624

Browse files
authored
chore: fix sqs ingest bug due to division by zero panic (#7350)
1 parent 2caa5c6 commit 2454624

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ingest/sqs/pools/ingester/pool_ingester.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,11 @@ func (pi *poolIngester) convertPool(
402402
}
403403

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

417421
uosmoBaseAssetSpotPrice = uosmoBaseAssetSpotPrice.Mul(precisionMultiplier)
418422

423+
if uosmoBaseAssetSpotPrice.IsZero() {
424+
errorInTVLStr = "failed to calculate spot price due to it becoming zero from truncations " + balance.Denom
425+
continue
426+
}
427+
419428
routingInfo = denomRoutingInfo{
420429
PoolID: poolForDenomPair,
421430
Price: uosmoBaseAssetSpotPrice,

0 commit comments

Comments
 (0)