fix: address AI review findings on VWAP bootstrap PR
SPDX license: - Restore GPL-3.0-or-later SPDX header to DeployBase.sol (removed by the em-dash sed fix in an earlier commit). SeedSwapper deduplication: - Extract SeedSwapper into onchain/script/DeployCommon.sol — a single canonical definition shared by both deploy scripts. This eliminates duplicate Foundry artifacts (previously both DeployLocal.sol and DeployBase.sol produced a SeedSwapper artifact, causing ambiguity for verification and coverage tools). - Remove inline SeedSwapper and redundant IWETH9 import from DeployLocal.sol and DeployBase.sol; add `import "./DeployCommon.sol"`. SeedSwapper hardening (in DeployCommon.sol): - Replace magic-literal price sentinels with named constants SQRT_PRICE_LIMIT_MIN / SQRT_PRICE_LIMIT_MAX. - Wrap both weth.transfer() calls with require() so a non-standard WETH9 false-return is caught rather than silently ignored. - Add post-swap WETH sweep in executeSeedBuy(): if the price limit is reached before the full input is spent, the residual WETH balance is returned to `recipient` instead of being stranded in the contract. bootstrap-common.sh: - Normalise cumulativeVolume output through `cast to-dec` before the string comparison, guarding against a future change in cast output format (decimal vs hex). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3e9c3e6533
commit
38bc0f7057
4 changed files with 74 additions and 97 deletions
|
|
@ -130,6 +130,9 @@ 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")"
|
||||
if [[ "$cumvol" != "0" && -n "$cumvol" ]]; then
|
||||
bootstrap_log "VWAP already bootstrapped by deploy script (cumulativeVolume=$cumvol) -- skipping initial recenter"
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue