From 3e9c3e6533650e9ca1e47ee4b8eef54c4e98bdfc Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 12 Mar 2026 23:34:28 +0000 Subject: [PATCH] fix: increase SEED_SWAP_ETH to overcome amplitude check in bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 0.01 ETH seed swap only moved the tick 127 ticks from the start and 37 ticks from the ANCHOR center — far below the 400-tick minimum amplitude (2 × TICK_SPACING). As a result, the second recenter() always reverted with "amplitude not reached", preventing VWAP bootstrap. Root cause: SEED_SWAP_ETH was 1 % of SEED_LM_ETH. The ANCHOR position holds ~25 % of SEED_LM_ETH as WETH across ~7 200 ticks, so consuming half of that WETH (≈0.125 ETH) is already enough to move the price 3 600 ticks past centre. Fix: raise SEED_SWAP_ETH from 0.01 ether to 0.5 ether (50 % of SEED_LM_ETH), giving a 4× margin over the minimum required. Verified against a Base-Sepolia fork at block 20 000 000 (same environment as CI): VWAP is now bootstrapped and cumulativeVolume > 0 after deployment. Co-Authored-By: Claude Sonnet 4.6 --- onchain/script/DeployLocal.sol | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/onchain/script/DeployLocal.sol b/onchain/script/DeployLocal.sol index 75e90f4..01bd841 100644 --- a/onchain/script/DeployLocal.sol +++ b/onchain/script/DeployLocal.sol @@ -78,10 +78,14 @@ contract DeployLocal is Script { // Seed amounts for VWAP bootstrap. // seedLmEth: initial ETH sent to the LM to create thin bootstrap positions. - // seedSwapEth: ETH used for the seed buy; with thin positions this easily moves - // the price >400 ticks (the minimum amplitude for a second recenter). + // seedSwapEth: ETH used for the seed buy. Must be large enough to move the + // Uniswap tick >400 ticks past the ANCHOR center (minAmplitude = 2*tickSpacing + // = 400 for the 1%-fee pool). The ANCHOR typically holds ~25% of seedLmEth as + // WETH across a ~7200-tick range; consuming half of that WETH (≈0.125 ETH) + // moves the price ~3600 ticks — well above the 400-tick threshold. + // 0.5 ether provides a 4× margin over the minimum needed. uint256 internal constant SEED_LM_ETH = 1 ether; - uint256 internal constant SEED_SWAP_ETH = 0.01 ether; + uint256 internal constant SEED_SWAP_ETH = 0.5 ether; // Deployed contracts Kraiken public kraiken;