diff --git a/scripts/bootstrap-common.sh b/scripts/bootstrap-common.sh index 16b396f..a67df08 100755 --- a/scripts/bootstrap-common.sh +++ b/scripts/bootstrap-common.sh @@ -130,9 +130,12 @@ call_recenter() { local cumvol cumvol="$(cast call --rpc-url "$ANVIL_RPC" \ "$LIQUIDITY_MANAGER" "cumulativeVolume()(uint256)" 2>/dev/null || echo "0")" - # Normalise to decimal: cast returns decimal for typed calls but cast to-dec handles - # both decimal and hex (0x...) inputs, guarding against future cast output changes. - cumvol="$(cast to-dec "$cumvol" 2>/dev/null || echo "0")" + # cast call with a typed (uint256) selector returns a plain decimal string for + # non-zero values (e.g. "140734553600000") and "0" for zero. A simple != "0" + # check is sufficient; note that the output may include a scientific-notation + # annotation (e.g. "140734553600000 [1.407e14]") which is also != "0", so we + # do NOT attempt to parse it further with cast to-dec (which would fail on the + # annotation and incorrectly fall back to "0"). if [[ "$cumvol" != "0" && -n "$cumvol" ]]; then bootstrap_log "VWAP already bootstrapped by deploy script (cumulativeVolume=$cumvol) -- skipping initial recenter" return 0