Skip to content

feat(contracts): deploy-time buyback activation with venue-select (Balancer/Uniswap) + ADR updates #1084

Closed

Description

@alpergundogdu

Add a deploy-time, venue-selectable path to activate the buyback bucket at genesis, so a fresh deployment (testnet first) can launch with buyback live without a post-deploy governance proposal. Includes the ADR updates in the same change.

Why (genesis governance can't bootstrap this)

DeployProtocol ships FeeRouter dormant — buybackBurner == address(0), shares [9000, 0, 1000] — and activation is normally a governance action: FeeRouter.setSharesAndDestinations(...) scheduled through the 48h Timelock.

At genesis that path is effectively unbootstrappable:

  • Voting weight is served-bytes-based (ADR 036); at launch nobody has served bytes → no weight to pass a proposal.
  • The deploy script's exit invariant leaves the deployer with no privileged role, so post-handoff the only caller of the setter is the Timelock/Governor.

So activation can't happen until real traffic exists. Doing it at genesis — while the deploy script still transiently holds GOVERNANCE_ROLE, before the handoff — is the clean way. This is genesis configuration, not a bootstrap backdoor: the script already sets initial shares, terms hash, and roles this way. No new contract surface, no fallback logic, no sunset.

Scope

1. Venue-select (Balancer / Uniswap)

The contracts are already venue-neutral (#1000: abstract GuardedBuybackBurner + concrete BuybackBurnerBalancerV3 / BuybackBurnerUniswapV3). The gap is the deploy/activation layer:

  • Add a BUYBACK_VENUE config knob (balancer | uniswap) that selects which concrete burner to deploy and which venue addresses to wire.
  • Generalize contracts/script/ActivateBuyback.s.sol (currently Balancer-hardcoded) to dispatch on venue — Uniswap path wires SwapRouter02 + a V3 pool (BuybackBurnerUniswapV3.Config); Balancer path unchanged.
  • Arb Sepolia note: Balancer V3 is not deployed there (only Uniswap V3), so uniswap is the only runnable venue on the initial testnet (cli: auto-swap USDC → TOKEN bond during decdn setup via the live DEX pool (Uniswap V3 / Balancer V3) #991).

2. Deploy-time activation flag (OFF by default)

  • Add an --activate-buyback (env/config) flag to DeployProtocol / BaseProtocolDeploy. When set, run this coherent bundle in-script, before the governance handoff:
    1. create + seed the venue pool (TOKEN/USDC) — requires TOKEN + USDC liquidity in the deployer wallet at deploy time,
    2. deploy the concrete burner (roles → Timelock),
    3. FeeRouter.setSharesAndDestinations([6000, 3000, 1000], {buybackBurner: burner, treasury}),
    4. setKeeper(keeper).
  • Default OFF → genesis stays dormant [9000, 0, 1000] exactly as today.
  • Guard ordering: the pool must be seeded before the burner is wired; fail-fast otherwise.

3. Preconditions + guardrails

  • Keeper: if no keeper is set, the 30% accrues as USDC parked in the burner (not lost) until executeBuyback — document this; require BUYBACK_KEEPER when the flag is on.
  • TWAP warmup: the Uniswap burner's hand-rolled TWAP accumulator needs its min window (~1800s default) to fill before swaps pass the floor — note that early buybacks may revert; acceptable.
  • Comment in the script that deploy-time genesis activation is a testnet/genesis convenience; mainnet keeps the ADR 018 governance-gated activation (seeded pool + calibrated cap + audited proposal). Flag must not become the prod default.

4. ADR updates (same PR)

  • ADR 018 (liquidity strategy): document the venue-neutral burner selection and the deploy-time genesis-activation option, distinct from the prod governance activation criteria.
  • ADR 016 (deployment order / initialization): record the optional deploy-time activation step and the venue-select input; keep dormant-by-default as the genesis default.
  • Follow ADR conventions: present-tense, self-contained, no issue/PR refs in the ADR text, bare Accepted.

Reference values (Arbitrum Sepolia)

Item Value
USDC 0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
Uniswap SwapRouter02 0x101F443B4d1b059569D643917553c771E1b9663E
Uniswap QuoterV2 0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B
Uniswap Factory 0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e
NonfungiblePositionManager 0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65
Pool fee tier 10000 (1%, matches ADR 018 80/20 intent)

Acceptance

  • forge script DeployProtocol with the flag OFF is byte-for-byte the same genesis state as today (dormant).
  • With the flag ON + BUYBACK_VENUE=uniswap, a deploy against an Arb Sepolia fork lands with FeeRouter split [6000,3000,1000], the burner wired, keeper set, and a seeded pool.
  • Balancer venue path still works (existing behavior preserved).
  • CI green (forge fmt, FOUNDRY_PROFILE=ci forge build --deny warnings, forge test, aderyn/slither).

Refs: #1000 (venue-neutral burner), #991 (Uniswap on Arb Sepolia), #1083 (testnet deploy plan).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:adrdesign:economicskind:feature

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions