fix: No mainnet VWAP bootstrap runbook (#728)

Add docs/mainnet-bootstrap.md with the full two-phase bootstrap
sequence: pool init, 300 s TWAP warm-up wait, first recenter + seed
buy (exact cast commands), 60 s cooldown wait, second recenter via
BootstrapVWAPPhase2.s.sol, and verification/troubleshooting steps.

Update the inline bootstrap comment in DeployBase.sol to warn that the
attempt always reverts on a fresh pool and direct operators to the new
runbook.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-14 18:04:11 +00:00
parent 9a9f0bc603
commit 023c661ee7
2 changed files with 274 additions and 11 deletions

View file

@ -101,19 +101,23 @@ contract DeployBase is Script {
// =====================================================================
// VWAP Bootstrap -> seed trade during deployment
//
// WARNING: On Base mainnet this inline attempt WILL REVERT when the pool
// was created in this same script run. The Uniswap V3 TWAP oracle
// requires >= 300 s of observation history before recenter() succeeds,
// and the 60-second recenter cooldown prevents completing both recenters
// in a single broadcast.
//
// Follow docs/mainnet-bootstrap.md for the correct two-phase manual
// sequence:
// Phase 1 deploy contracts (this script, bootstrap section expected
// to revert on fresh pool)
// Phase 2 wait >= 300 s, fund LM, first recenter(), seed buy
// Phase 3 wait >= 60 s, run BootstrapVWAPPhase2.s.sol
//
// The cumulativeVolume==0 path in recenter() records VWAP from whatever
// price exists at the time of the first fee event. An attacker who
// front-runs deployment with a whale buy inflates that anchor.
//
// Fix: execute a small buy BEFORE handing control to users so that
// cumulativeVolume>0 by the time the protocol is live.
//
// recenter() is now permissionless and always enforces TWAP stability.
// For a fresh pool on Base mainnet this bootstrap must run at least
// 300 seconds after pool initialisation (so the TWAP oracle has history).
// If the pool was just created in this same script run, the first
// recenter() will revert with "price deviated from oracle" wait 5 min
// and call the bootstrap as a separate transaction or script.
// front-runs deployment with a whale buy inflates that anchor; executing
// the seed buy before handing control to users closes that window.
//
// Deployer must have SEED_LM_ETH + SEED_SWAP_ETH available (0.015 ETH).
// =====================================================================