Repository navigation
feat(contracts): deploy-time genesis buyback activation + venue select (#1084) - #1086
Conversation
#1084) Add an OFF-by-default, venue-selectable path to activate the FeeRouter buyback bucket at genesis, in-script, before the governance handoff. At genesis the normal governance activation is unbootstrappable — served-bytes voting weight is zero (ADR 036) and the deploy leaves the deployer with no privileged role — so activation has to run while the deployer still holds GOVERNANCE_ROLE. This is genesis config, not new contract surface: the same setSharesAndDestinations call, run pre-handoff. - BaseProtocolDeploy: `_runFullDeploy(cfg, act)` overload with a BuybackActivation struct (OFF by default; the single-arg entry point delegates with activation off, so the dormant launch is byte-for-byte unchanged). When ON, seed the venue pool, deploy the concrete burner (admin=deployer), grant PAUSER to the multisig, setKeeper, flip FeeRouter to [6000,3000,1000], then hand the burner to the Timelock alongside every other target. Guards: keeper required; Uniswap pool must be seeded before wiring. - Venue select via BUYBACK_VENUE. Uniswap creates + seeds a TOKEN/USDC V3 pool in-script (SwapRouter02 + NonfungiblePositionManager, full-range POL custodied by the Timelock) — the only runnable venue on Arbitrum Sepolia. Balancer wires an already-seeded 80/20 pool (POL seeding is a treasury/Permit2 act per ADR 018). - DeployProtocol: ACTIVATE_BUYBACK / BUYBACK_VENUE env plumbing; manifest records the burner + live split. - ActivateBuyback runbook generalized to dispatch on venue (balancer unchanged). - Tests: in-process mock activation suite (OFF-path parity, full ON bundle, guard reverts) + gated Arbitrum Sepolia fork suite validating the real Uniswap path (pool created/seeded, split flipped, keeper set, roles handed off, TWAP prices). - ADR 018 (venue-neutral selection + deploy-time genesis activation vs production criteria) and ADR 016 (optional deploy-time activation step, dormant-by-default). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR documents and wires an off-by-default genesis buyback activation path, adds venue selection for Balancer V3 or Uniswap V3, updates deploy-time manifests and tests, and refreshes gas snapshots. ChangesGenesis buyback activation
Estimated code review effort: 5 (Critical) | ~90 minutes Sequence Diagram(s)sequenceDiagram
participant DeployProtocol
participant BaseProtocolDeploy
participant Burner
participant FeeRouter
DeployProtocol->>BaseProtocolDeploy: _runFullDeploy(cfg, act)
BaseProtocolDeploy->>Burner: create and seed venue pool
BaseProtocolDeploy->>Burner: deploy guarded burner and set keeper
BaseProtocolDeploy->>FeeRouter: setSharesAndDestinations(...)
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
New GenesisBuybackActivation entries plus deterministic gas movement on the deploy-invoking suites (Deployment struct gained a buybackBurner field and _runFullDeploy gained the activation branch). Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces an optional deploy-time genesis activation mechanism for the buyback bucket, allowing testnets and genesis networks to seed a Uniswap V3 or Balancer V3 pool, deploy the concrete BuybackBurner, and configure the FeeRouter split before handing over governance to the Timelock. The feedback highlights an inconsistency in the default value of the BUYBACK_VENUE environment variable across different scripts, and recommends validating the computed sqrtPriceX96 against Uniswap V3's MIN_SQRT_RATIO and MAX_SQRT_RATIO boundaries to avoid opaque reverts during pool initialization.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR adds an off-by-default, deploy-time “genesis buyback activation” path to the contracts deployment flow, allowing a new deployment to come up with the FeeRouter buyback bucket live before the governance handoff, with venue selection (Uniswap V3 or Balancer V3). It keeps the default behavior unchanged (buyback dormant) while enabling a coherent in-script activation bundle for testnet/genesis deployments, and documents the behavior in ADRs.
Changes:
- Extend the deployment pipeline to optionally seed a venue pool, deploy the concrete buyback burner, set keeper/pauser, flip FeeRouter shares to
[6000, 3000, 1000], and hand burner governance to the Timelock. - Add venue selection plumbing for deploy-time activation and generalize the
ActivateBuybackrunbook to support both venues. - Add in-process + fork-based tests for the Uniswap genesis activation path and update ADR/README/docs accordingly.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| contracts/test/GenesisBuybackActivation.t.sol | Adds in-process tests (mock Uniswap pool/position manager) for OFF-path parity + ON-path activation bundle + guard reverts. |
| contracts/test/GenesisBuybackActivation.fork.t.sol | Adds gated Arbitrum Sepolia fork acceptance tests against live Uniswap V3. |
| contracts/script/interfaces/IUniswapV3PoolCreation.sol | Adds deploy-script-only Uniswap V3 pool creation + mint interfaces used for in-script seeding. |
| contracts/script/DeployProtocol.s.sol | Reads ACTIVATE_BUYBACK / BUYBACK_VENUE env configuration, passes activation struct into deploy, and records live burner/split in the manifest. |
| contracts/script/BaseProtocolDeploy.s.sol | Implements activation-aware deploy pipeline and the optional genesis buyback activation bundle (Uniswap pool create/seed or Balancer wire). |
| contracts/script/ActivateBuyback.s.sol | Generalizes the post-deploy activation runbook to dispatch on BUYBACK_VENUE (Balancer or Uniswap). |
| contracts/README.md | Updates BuybackBurner description to reflect venue-neutral design and ADR references. |
| contracts/foundry.toml | Adds arbitrum_sepolia RPC endpoint entry for fork tests. |
| adr/018-liquidity-strategy.md | Documents venue-neutral burner selection and deploy-time genesis activation option + TWAP warmup note. |
| adr/016-contract-interactions.md | Documents dormant-by-default launch and optional deploy-time genesis activation in deployment/init sections. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
contracts/script/DeployProtocol.s.sol (1)
243-248: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winValidate the Uniswap fee tier at read time for true fail-fast.
PoolFeeOutOfRangeonly rejects values aboveuint24; an in-range but unsupported tier (e.g.2500) passes here and only reverts later viaUnsupportedFeeTierinside_tickSpacing, mid-broadcast afterEd25519Verifierand all targets are already deployed. Since_readBuybackActivationruns beforevm.startBroadcast, validating the supported set here aborts before any gas is spent, consistent with the fail-fast intent for the other activation inputs.♻️ Validate supported tiers pre-broadcast
uint256 fee = vm.envOr("UNISWAP_POOL_FEE", uint256(10_000)); - if (fee > type(uint24).max) revert PoolFeeOutOfRange(fee); + if (fee != 100 && fee != 500 && fee != 3000 && fee != 10_000) { + revert PoolFeeOutOfRange(fee); + } act.uniPoolFee = uint24(fee);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/script/DeployProtocol.s.sol` around lines 243 - 248, The Uniswap fee tier validation in _readBuybackActivation only checks uint24 bounds, so unsupported in-range tiers can slip through and fail later during broadcast. Update the UNISWAP branch in DeployProtocol.s.sol to validate the fee against the supported Uniswap tiers before assigning act.uniPoolFee, using the existing PoolFeeOutOfRange or a similar early-revert path so invalid values are rejected before vm.startBroadcast and before any deployment work begins.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@adr/018-liquidity-strategy.md`:
- Around line 173-187: The deploy-time genesis activation flow currently mixes
Uniswap V3 and Balancer V3 into one “coherent bundle,” which obscures the actual
steps. Split the logic in this section so the deploy path clearly branches by
venue: describe Uniswap V3 as creating and seeding the pool in-script, and
Balancer V3 as requiring the pool to be seeded off-script before the deploy
script wires it. Update the numbered activation steps and surrounding prose in
the liquidity strategy doc to keep the venue-specific sequence explicit and
consistent.
In `@contracts/test/GenesisBuybackActivation.fork.t.sol`:
- Around line 30-34: The GenesisBuybackActivation.fork.t.sol test is using the
wrong USDC deployment for the fork environment. Update the USDC constant in
GenesisBuybackActivationTest to the Arbitrum Sepolia USDC address so the forked
CI test targets the correct token contract. Keep the other
router/factory/position manager constants unchanged.
---
Nitpick comments:
In `@contracts/script/DeployProtocol.s.sol`:
- Around line 243-248: The Uniswap fee tier validation in _readBuybackActivation
only checks uint24 bounds, so unsupported in-range tiers can slip through and
fail later during broadcast. Update the UNISWAP branch in DeployProtocol.s.sol
to validate the fee against the supported Uniswap tiers before assigning
act.uniPoolFee, using the existing PoolFeeOutOfRange or a similar early-revert
path so invalid values are rejected before vm.startBroadcast and before any
deployment work begins.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9669a7ea-4d1f-4658-b9d0-47db7fd4c1b7
📒 Files selected for processing (10)
adr/016-contract-interactions.mdadr/018-liquidity-strategy.mdcontracts/README.mdcontracts/foundry.tomlcontracts/script/ActivateBuyback.s.solcontracts/script/BaseProtocolDeploy.s.solcontracts/script/DeployProtocol.s.solcontracts/script/interfaces/IUniswapV3PoolCreation.solcontracts/test/GenesisBuybackActivation.fork.t.solcontracts/test/GenesisBuybackActivation.t.sol
…+ Eth Sepolia fork test Make the deploy-time genesis activation genuinely venue-symmetric: the Balancer branch now creates + seeds its 80/20 TOKEN/USDC weighted pool in-script (live WeightedPoolFactory + Router via Permit2), exactly as the Uniswap branch seeds its V3 pool, instead of requiring a pre-seeded pool address. - BaseProtocolDeploy: `_createAndSeedBalancerPool` + `_permit2Approve` mirror the swap+burn fork test's pool-creation flow (sorted legs, 80/20 weights, Router initialize). `_activateBalancer` now creates+seeds then constructs the burner (its constructor validates the live pool = the seed-before-wire guard for this venue). Seed amounts are shared struct fields (`usdcSeed`/`tokenSeed`); `balPool` input dropped, `balFactory`/`balSwapFee` added. - DeployProtocol: read BALANCER_WEIGHTED_POOL_FACTORY / BALANCER_SWAP_FEE; seed defaults are venue-appropriate (Uniswap 10k/1M, Balancer 250k/100M — same $0.01 anchor, different weights). - Relocate the Balancer pool-creation interface from test/interfaces to script/interfaces so the deploy script and the fork tests share one copy. - Tests: GenesisBuybackActivationBalancer.fork.t.sol (gated on SEPOLIA_RPC_URL, self-skips offline) validates the full Balancer bundle against live Balancer V3 on Ethereum Sepolia — verified passing against a public endpoint. The in-process balancer guard test is dropped (factory/vault/permit2 stack is impractical to mock; the keeper guard is venue-agnostic). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Both venues now create + seed the pool in-script (Uniswap via NFPM full-range, Balancer via WeightedPoolFactory + Router/Permit2); update the deploy-time genesis-activation step to match. Co-Authored-By: Claude Opus 4.8 <[email protected]>
- BaseProtocolDeploy: fail-fast on a seed price outside Uniswap V3's valid [MIN_SQRT_RATIO, MAX_SQRT_RATIO] band (was only checking uint160), so a skewed seed reverts with a clear SqrtPriceOutOfRange instead of an opaque revert inside the NonfungiblePositionManager. - DeployProtocol: validate UNISWAP_POOL_FEE against the supported tier set at read time (pre-broadcast) rather than only bounding to uint24 and reverting UnsupportedFeeTier mid-deploy. - ActivateBuyback: default BUYBACK_VENUE to `uniswap`, consistent with DeployProtocol (was `balancer`), to avoid cross-script default confusion. - Drop an unused IEd25519Verifier import from the in-process activation test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
contracts/test/GenesisBuybackActivation.t.sol (1)
260-278: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTighten guard-revert assertions with
expectPartialRevertinstead of bareexpectRevert().Both
test_revertsWhenPoolNotSeededandtest_revertsWhenDeployerLacksSeedBalancefall back to unqualifiedvm.expectRevert()because the custom error's argument is runtime-computed. Foundry'sexpectPartialRevert(bytes4)cheatcode matches only the selector and ignores the rest of the revert data, so it can assert the specific error without needing the runtime pool address/amount, per Foundry's docs: "Use expectPartialRevert when you only care about the error selector, not its arguments". As written, a bareexpectRevert()would also pass if the call reverted for an unrelated reason, weakening the guard test's precision.🧪 Proposed fix
function test_revertsWhenPoolNotSeeded() public { MockPositionManager npm = new MockPositionManager(false); usdc.approve(address(npm), type(uint256).max); BuybackActivation memory act = _uniswapActivation(address(npm)); - vm.expectRevert(); // PoolNotSeeded(pool) — pool address is runtime-computed + vm.expectPartialRevert(BaseProtocolDeploy.PoolNotSeeded.selector); this.externalRunFullDeploy(_config(), act); }cfg.initialTokenHolder = address(0xBEEF); - vm.expectRevert(); // InsufficientSeedBalance(token, 0, TOKEN_SEED) + vm.expectPartialRevert(BaseProtocolDeploy.InsufficientSeedBalance.selector); this.externalRunFullDeploy(cfg, _uniswapActivation(address(npm)));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/test/GenesisBuybackActivation.t.sol` around lines 260 - 278, The two guard tests are using unqualified revert checks, which makes them too broad; update test_revertsWhenPoolNotSeeded and test_revertsWhenDeployerLacksSeedBalance in GenesisBuybackActivation.t.sol to assert the specific custom error selector with Foundry’s expectPartialRevert instead of bare expectRevert. Keep the existing runtime-computed arguments out of the assertion, but target the PoolNotSeeded and InsufficientSeedBalance selectors so externalRunFullDeploy only passes on the intended guard failure.contracts/script/DeployProtocol.s.sol (1)
305-319: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winManifest derives "live" shares from a duplicated constant set instead of on-chain state.
liveShareshardcodesSTEADY_OPERATOR_SHARE/STEADY_BUYBACK_SHARE/STEADY_TREASURY_SHAREfor the activated branch rather than readingd.router.getShares(). In that branchbb != address(0), which only happens after a real_activateBuybackcall against a realFeeRouter(the stub-deployment concern mentioned in the comment only applies to the dormant path, wherecfg.feeRouterSharesis already used as the fallback). If these constants ever drift from the actual values_activateBuybackapplies, the manifest would silently misreport the on-chain split to downstream tooling.♻️ Proposed fix
address bb = address(d.buybackBurner); - uint256[3] memory liveShares = bb == address(0) - ? cfg.feeRouterShares - : [STEADY_OPERATOR_SHARE, STEADY_BUYBACK_SHARE, STEADY_TREASURY_SHARE]; + uint256[3] memory liveShares = bb == address(0) ? cfg.feeRouterShares : d.router.getShares();Also applies to: 345-347
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/script/DeployProtocol.s.sol` around lines 305 - 319, The manifest writer in _writeManifest is using duplicated steady-share constants for the activated path, which can diverge from the real router state. Update the liveShares derivation so the non-dormant branch reads the actual shares from d.router.getShares() (or the canonical source used by _activateBuyback), while keeping cfg.feeRouterShares only for the dormant bb == address(0) fallback. Keep the serialization logic in _writeManifest consistent with the real FeeRouter values and apply the same fix anywhere else in the diff that mirrors this shares-writing logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@contracts/script/DeployProtocol.s.sol`:
- Around line 305-319: The manifest writer in _writeManifest is using duplicated
steady-share constants for the activated path, which can diverge from the real
router state. Update the liveShares derivation so the non-dormant branch reads
the actual shares from d.router.getShares() (or the canonical source used by
_activateBuyback), while keeping cfg.feeRouterShares only for the dormant bb ==
address(0) fallback. Keep the serialization logic in _writeManifest consistent
with the real FeeRouter values and apply the same fix anywhere else in the diff
that mirrors this shares-writing logic.
In `@contracts/test/GenesisBuybackActivation.t.sol`:
- Around line 260-278: The two guard tests are using unqualified revert checks,
which makes them too broad; update test_revertsWhenPoolNotSeeded and
test_revertsWhenDeployerLacksSeedBalance in GenesisBuybackActivation.t.sol to
assert the specific custom error selector with Foundry’s expectPartialRevert
instead of bare expectRevert. Keep the existing runtime-computed arguments out
of the assertion, but target the PoolNotSeeded and InsufficientSeedBalance
selectors so externalRunFullDeploy only passes on the intended guard failure.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ab88df7c-8df7-4759-9a96-656ecf60e7a5
📒 Files selected for processing (9)
adr/018-liquidity-strategy.mdcontracts/.gas-snapshotcontracts/script/BaseProtocolDeploy.s.solcontracts/script/DeployProtocol.s.solcontracts/script/interfaces/IBalancerV3PoolCreation.solcontracts/test/BuybackBurnerBalancerV3.swapburn.fork.t.solcontracts/test/GenesisBuybackActivation.fork.t.solcontracts/test/GenesisBuybackActivation.t.solcontracts/test/GenesisBuybackActivationBalancer.fork.t.sol
✅ Files skipped from review due to trivial changes (1)
- contracts/script/interfaces/IBalancerV3PoolCreation.sol
🚧 Files skipped from review as they are similar to previous changes (3)
- adr/018-liquidity-strategy.md
- contracts/test/GenesisBuybackActivation.fork.t.sol
- contracts/script/BaseProtocolDeploy.s.sol
…re source - DeployProtocol: read the activated FeeRouter split straight from `d.router.getShares()` instead of duplicating the STEADY_* constants, so the manifest can't silently misreport a drifted split. The dormant branch (the only one the stub-deployment script tests exercise) still falls back to the launch config, keeping the writer stub-safe. - GenesisBuybackActivation test: assert the specific error selector via `expectPartialRevert` (PoolNotSeeded / InsufficientSeedBalance) instead of a bare `expectRevert()`, so the guard tests can't pass on an unrelated revert. Co-Authored-By: Claude Opus 4.8 <[email protected]>
`forge fmt` treats `new T[](n)` as atomic and won't wrap the combined declaration+allocation of the long `IBalancerV3WeightedPoolFactory.TokenConfig[]` array, leaving it at 121 chars, which trips solhint's 120-char rule (the documented fmt-vs-solhint ±1 disagreement). Split the declaration from the allocation into two statements so both tools agree. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Replace the hand-computed BUYBACK_TOKEN_SEED with a BUYBACK_TARGET_PRICE knob so an operator supplies only the USDC they hold and the intended TOKEN price; the paired TOKEN seed is derived to initialize the pool at that price. USDC decimals cancel in the derivation, so it only scales by TOKEN's 18 decimals and the venue value-weights (1:1 constant-product for Uniswap, 4:1 for the 80/20 Balancer pool). - BaseProtocolDeploy: add `_deriveTokenSeed(venue, usdcSeed, targetPrice)` (pure) + BAL_TOKEN_WEIGHT/BAL_USDC_WEIGHT constants (now the single source of truth for both the derivation and the Balancer pool weights); TargetPriceZero guard. - DeployProtocol: read BUYBACK_USDC_SEED (default lowered to 100e6) + BUYBACK_TARGET_PRICE (default 10_000 = $0.01/TOKEN in USDC base units); derive the TOKEN seed. Drops the venue-specific token/usdc seed defaults. - Tests: 5 unit tests for _deriveTokenSeed (both venues, price scaling, small seed, zero-price revert); in-process + both fork suites now derive the seed via the helper (values unchanged at the $0.01 anchor, so the live-fork TWAP assertions still hold). - ADR 018: note the seed is sized by a USDC amount + target price. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…t the deployer The Balancer venue of genesis buyback activation seeded the pool via Router.initialize, which mints the pool BPT (protocol-owned liquidity) to the broadcasting deployer and left standing max Permit2 ERC20 approvals. The deployer therefore retained the entire POL position plus dangling approvals after the governance handoff — unlike the Uniswap path, which mints the position NFT to the Timelock and resets its approvals. Move the BPT to the Timelock and clear the Permit2 approvals in _finalizeBalancerSeed; extend the Balancer fork test to assert the deployer holds no BPT/approval and the Timelock custodies the BPT. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… follow-ups (#1090, #1175) Closes #1090, Closes #1175. Implements the ADR 009 bootstrap-multisig phase and clears the #1086 review's buyback follow-ups. Both land on `contracts/script/`; no production contract in `contracts/src/` changes. **#1175 — bootstrap-multisig phase.** `DeployProtocol` run with `BOOTSTRAP_MULTISIG` seats that multisig as the Timelock's sole PROPOSER/CANCELLER and grants `DecdnGovernor` neither, so no operator vote reaches execution while the set is thin enough for a cheap fleet to capture. The Timelock keeps GOVERNANCE_ROLE on every target in both modes, so ADR 009's "48-hour timelock on every parameter change" holds for the multisig too — the phase confines who may *schedule*, not who acts instantly. `script/TransitionToGovernor.s.sol` prints the one-way batch that ends it. Off by default: an unchanged deploy is byte-for-byte the previous one. **#1090 — buyback follow-ups.** `script/lib/BuybackVenueLib.sol` is now the single home for venue dispatch, burner construction, and wiring validation — previously duplicated three ways, letting the genesis path and the runbook wire different burners from the same inputs. `BuybackActivation` regroups into venue-scoped sub-structs with cross-wire, under-wire, and seed-derivation guards. CI passes `ARBITRUM_SEPOLIA_RPC_URL` through and now reports how many fork suites actually ran. Also carries `ruint` 1.20.0 for RUSTSEC-2026-0220, which was blocking every commit in the repo (`main` had the same lockfile). Two rounds of multi-agent review; findings and rationale are in the PR thread. Follow-up filed as #1532 (slippage ceiling + zero-band rejection in `GuardedBuybackBurner`, which needs ADR 018 parameter decisions).
Closes #1084.
What
Adds an OFF-by-default, venue-selectable path to activate the FeeRouter buyback bucket at genesis, in-script, before the governance handoff.
DeployProtocolstill ships the buyback bucket dormant (buybackBurner == address(0), split[9000, 0, 1000]) by default; the newACTIVATE_BUYBACK=trueflag opts into a coherent in-script activation bundle.Normal activation is a governance
FeeRouter.setSharesAndDestinations(...)through the 48h Timelock. At genesis that is unbootstrappable — served-bytes voting weight is zero (ADR 036) and the deploy leaves the deployer with no privileged role on exit — so activation runs while the deployer still holdsGOVERNANCE_ROLE. This is genesis config, not new contract surface: no fallback logic, no sunset role, the samesetSharesAndDestinationscall, run pre-handoff.How
BaseProtocolDeploy— new_runFullDeploy(cfg, act)overload taking aBuybackActivationstruct. The legacy single-arg entry point delegates with activation off, so the dormant launch is byte-for-byte unchanged (existing suites untouched). When ON, after cross-contract wiring and before the handoff: seed the venue pool → deploy the concrete burner (admin = deployer) → grantPAUSER_ROLEto the emergency multisig →setKeeper→ flip FeeRouter to[6000, 3000, 1000]→ hand the burner to the Timelock alongside every other governed target. Symmetric back-door / wiring asserts extended to the burner.MissingBuybackKeeper); Uniswap pool must be seeded before wiring (PoolNotSeeded); deployer must hold the seed TOKEN+USDC (InsufficientSeedBalance).BUYBACK_VENUE):SwapRouter02+NonfungiblePositionManager, full-range POL custodied by the Timelock). The only runnable venue on Arbitrum Sepolia.DeployProtocol—ACTIVATE_BUYBACK/BUYBACK_VENUE+ guard-param env plumbing (defaults from ADR 018 § Parameter Table); manifest records the wired burner + live split.ActivateBuybackrunbook generalized to dispatch on venue (Balancer path unchanged; Uniswap added).Guardrails
Deploy-time genesis activation is a testnet/genesis convenience, documented as such in the ADRs and script comments. Mainnet leaves the flag OFF and keeps the ADR 018 governance-gated activation. The Uniswap burner's TWAP accumulator is fail-closed until it spans
twapMinWindow(~1800s), so early buybacks revertTwapNotReadyuntil the window matures.Testing
test/GenesisBuybackActivation.t.sol(in-process, runs in default CI): OFF-path parity with the dormant launch, full ON Uniswap bundle (split/burner/keeper/pauser/seeded-pool/handoff), and the guard reverts.test/GenesisBuybackActivation.fork.t.sol(gated onARBITRUM_SEPOLIA_RPC_URL, self-skips offline): the real acceptance path against live Arbitrum Sepolia Uniswap V3 — pool created via the live factory + seeded, split flipped to[6000,3000,1000], burner wired, keeper set, roles handed to the Timelock, and the burner reads a real ~$0.01-anchor TWAP spot off the seeded pool. Verified passing against a public Arb Sepolia endpoint.CI mirror run locally:
forge fmt --check,FOUNDRY_PROFILE=ci forge build --sizes --deny warnings,forge test(709 passed / 9 fork-skipped) all green. slither/aderyn are unaffected — their scopes excludescript/+test/and nosrc/contract changed.Notes / design decisions
ActivateBuybackBalancer runbook is unchanged). Flag if you'd prefer full in-script Balancer seeding + an Ethereum-Sepolia fork test. [your call]🤖 Generated with Claude Code
Summary by CodeRabbit