Skip to content

refactor(contracts)!: remove Balancer buyback venue, make Uniswap V3 canonical - #2043

Merged
alpergundogdu merged 4 commits into
mainfrom
claude/nice-kowalevski-22c551
Sep 17, 2026
Merged

alpergundogdu merged 4 commits into
mainfrom
claude/nice-kowalevski-22c551

Conversation

@alpergundogdu

@alpergundogdu alpergundogdu commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Remove all Balancer surfaces and make Uniswap V3, full-range 50/50 the sole canonical POL / buyback venue.

Rationale: the Balancer DAO is in an orderly winddown, and Balancer is not deployed on the Arbitrum Sepolia initial network (which runs Uniswap V3), so the Balancer buyback venue is dead code on the launch path. BuybackBurnerUniswapV3 is a real, tested subclass and a full substitute for the swap leg.

Changes

Deleted (10 files, ~2 100 lines): BuybackBurnerBalancerV3, the Balancer V3 interfaces (IBalancerV3Vault/Router/WeightedPool, IBalancerV3PoolCreation), IPermit2 (Permit2 was Balancer-only — Uniswap V3 pulls via a direct ERC20 allowance), the Balancer test + fork suites, and the Balancer-only arbitrum/sepolia fork RPC endpoints.

Design call (kept the base + single subclass): the abstract GuardedBuybackBurner base and the single BuybackBurnerUniswapV3 subclass stay, for cheap future venue optionality. The venue enum / string dispatch / drift machinery is gone — BuybackVenueLib is slimmed to the shared construction seam + steady-state split, and the Balancer branches are removed from DeployProtocol / BaseProtocolDeploy / ActivateBuyback. There is one venue, so there is no selection. Documented in ADR 018 § Venue-neutral burner selection.

ADR 018 rewritten around Uniswap V3 50/50: dropped the 80/20-weighted decision and the Balancer-specific mechanics (Vault/Permit2/Router indirection, "ships no oracle" framing). Kept the venue-neutral MEV stack (TWAP floor, minTokenOut, private-RPC routing, per-epoch liquidity cap). Added the buyback glidepath: each swap adds USDC to the pool, so seed depth is a floor that glides up and the per-epoch cap tracks current depth.

Scrubbed Balancer references from the ADRs (architecture, glossary, 016, 003, 026, appendix-l2-deployment), README, CONTRIBUTING, contracts/README, and updated the ADR 018 cross-link anchors. appendix-l2-deployment now carries the Uniswap V3 SwapRouter02 / NonfungiblePositionManager / Factory addresses in place of the Balancer Vault/Router/Permit2 rows.

Out of scope (deliberately not touched)

  • POL allocation resizing — a separate change. This PR leaves the POL sizing numbers (the 10% / 100M allocation and the rest) as-is. Where a figure was purely Balancer-80/20-specific and has no meaning under 50/50, it carries a TODO(pol-resize) marker rather than an invented value.
  • finance/ and internal/ sibling repos.

grep -rli balancer — remaining matches are intentional

The grep no longer returns any Balancer-DEX reference in deCDN source. Remaining matches, all confirmed with the requester:

  • CHANGELOG.md — historical PR entries, left as an append-only record.
  • crates/incentive/src/tx.rs, adr/appendix-observability.md, adr/appendix-operator-upgrade-path.md — these say "load balancer" (RPC / infra), not the Balancer protocol. Left as correct, unrelated prose.
  • contracts/lib/solady/** — vendored submodule; a false match on ...InsufficientBalanceReverts.

Verification (mirrors CI)

  • forge fmt --check ✅ · FOUNDRY_PROFILE=ci forge build --sizes --deny warnings ✅
  • forge test ✅ 790 passed, 0 failed, 3 skipped (RPC-gated fork suites)
  • slither . --config-file slither.config.json ✅ exit 0 (no medium+ in touched code)
  • aderyn ✅ (the 3 High findings are pre-existing over-reports in PublisherRegistry/CapacityBond, untouched here)
  • .gas-snapshot regenerated
  • No Rust source changed, so the Rust toolchain gates are unaffected.

🤖 Generated with Claude Code

…canonical

The Balancer DAO is in an orderly winddown, and Balancer is not deployed on
the Arbitrum Sepolia initial network (which runs Uniswap V3), so the Balancer
buyback venue is dead code on the launch path. `BuybackBurnerUniswapV3` is a
full, tested substitute for the swap leg.

Delete the Balancer venue and every reference; promote Uniswap V3 to the sole
canonical TOKEN/USDC POL + buyback venue:

- Delete `BuybackBurnerBalancerV3`, the Balancer V3 interfaces, `IPermit2`
  (Permit2 was Balancer-only; Uniswap V3 uses a direct ERC20 allowance), the
  Balancer test/fork suites, and the Balancer-only fork RPC endpoints.
- Keep the abstract `GuardedBuybackBurner` base + the single
  `BuybackBurnerUniswapV3` subclass for future venue optionality, but delete the
  venue enum / string dispatch / drift machinery in `BuybackVenueLib` and the
  Balancer branches in the deploy + activation scripts — there is one venue, so
  there is no selection.
- Rewrite ADR 018 around Uniswap V3, full-range 50/50, as the canonical venue;
  drop the 80/20-weighted decision and the Balancer-specific mechanics
  (Vault/Permit2/Router indirection, "no pool oracle" framing). Keep the
  venue-neutral MEV stack (TWAP floor, minTokenOut, private-RPC routing,
  per-epoch cap) and add the buyback glidepath: each swap adds USDC to the pool,
  so seed depth is a floor that glides up and the per-epoch cap tracks current
  depth.
- Scrub Balancer references from the ADRs, README, CONTRIBUTING, contracts/README
  and update ADR 018 cross-link anchors.

POL allocation resizing (10% -> 2.5%) is a separate change; numbers that are
purely Balancer-80/20-specific carry a `TODO(pol-resize)` marker rather than an
invented 50/50 figure.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 17, 2026 14:58
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 90.61% (2394/2642 lines)
▲ +0.86pp vs base (89.75% → 90.61%)
Run: 35243113427

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It makes high-impact, on-chain contract and deployment refactors (removing an entire swap venue and rewriting activation wiring) that warrant final human review despite only minor issues found.

Pull request overview

This PR removes all Balancer buyback surfaces from the Solidity codebase and documentation, making Uniswap V3 (full-range 50/50 TOKEN/USDC) the sole canonical protocol-owned-liquidity and buyback venue. It simplifies deployment/runbook scripts and tests by eliminating venue dispatch and Balancer-only wiring, while keeping the venue-neutral guarded burner base and the Uniswap V3 subclass.

Changes:

  • Deleted Balancer V3 buyback burner implementation, interfaces, and fork/unit test suites; removed Permit2 interface that was only used by the Balancer path.
  • Simplified buyback activation configuration and seed derivation to be Uniswap-only (no venue enum/string dispatch), updating deploy/runbook scripts and tests accordingly.
  • Updated ADRs and docs to describe Uniswap V3 50/50 POL/buyback mechanics and chain-specific Uniswap addresses.
File summaries
File Description
README.md Updates liquidity bullet to Uniswap V3 50/50.
CONTRIBUTING.md Updates buyback activation note to reference Uniswap V3 burner.
contracts/test/GenesisBuybackActivationBalancer.fork.t.sol Deletes Balancer genesis-activation fork acceptance suite.
contracts/test/GenesisBuybackActivation.t.sol Removes venue dispatch expectations; updates guards and seed-derivation tests for Uniswap-only.
contracts/test/GenesisBuybackActivation.fork.t.sol Removes venue enum usage; derives pool seed without venue.
contracts/test/BuybackVenueLib.t.sol Refocuses tests on Uniswap wiring guards + steady-state shares (removes venue parsing/ordinals).
contracts/test/BuybackBurnerUniswapV3.t.sol Updates test documentation to reflect Uniswap as sole venue exercising shared MEV stack.
contracts/test/BuybackBurnerBalancerV3.t.sol Deletes Balancer burner unit suite.
contracts/test/BuybackBurnerBalancerV3.swapburn.fork.t.sol Deletes Balancer swap+burn fork suite.
contracts/test/BuybackBurnerBalancerV3.fork.t.sol Deletes Balancer read/validation fork suite.
contracts/test/BuybackBurner.t.sol Updates comment to point venue-specific coverage to Uniswap suite.
contracts/src/interfaces/IPermit2.sol Deletes Permit2 interface (Balancer-only dependency).
contracts/src/interfaces/IBalancerV3WeightedPool.sol Deletes Balancer weighted-pool interface.
contracts/src/interfaces/IBalancerV3Vault.sol Deletes Balancer vault interface.
contracts/src/interfaces/IBalancerV3Router.sol Deletes Balancer router interface.
contracts/src/GuardedBuybackBurner.sol Updates docstrings to be venue-agnostic and remove Balancer-specific wording.
contracts/src/BuybackBurnerUniswapV3.sol Makes Uniswap V3 explicitly canonical in docs; keeps Uniswap-specific wiring validation.
contracts/src/BuybackBurnerBalancerV3.sol Deletes Balancer burner implementation.
contracts/src/BuybackBurner.sol Updates docs to remove Balancer references and describe Uniswap allowance model.
contracts/script/lib/BuybackVenueLib.sol Removes venue selection logic and Balancer construction; keeps Uniswap construction seam + steady shares.
contracts/script/interfaces/IUniswapV3PoolCreation.sol Updates interface docstring to reflect Uniswap-only pool creation at genesis.
contracts/script/interfaces/IBalancerV3PoolCreation.sol Deletes Balancer pool creation interfaces (script-only).
contracts/script/DeployProtocol.s.sol Removes BUYBACK_VENUE dispatch; reads Uniswap vars only; derives seed without venue tag.
contracts/script/BaseProtocolDeploy.s.sol Removes Balancer activation path and venue scoping; keeps Uniswap-only activation, wiring guard, and seed-derivation guard.
contracts/script/ActivateBuyback.s.sol Removes venue selection; deploys Uniswap burner only through BuybackVenueLib seam.
contracts/README.md Updates BuybackBurner description to Uniswap-only concrete subclass.
contracts/foundry.toml Removes Balancer fork RPC endpoints; keeps only arbitrum_sepolia for remaining fork suite(s).
contracts/.gas-snapshot Regenerates snapshot after removing Balancer tests/surfaces.
adr/glossary.md Updates BuybackBurner definition and ADR anchors to Uniswap V3 50/50.
adr/architecture.md Updates tokenomics chapter links/descriptions from Balancer to Uniswap.
adr/appendix-l2-deployment.md Replaces Balancer entries with Uniswap V3 addresses and related deployment assumptions.
adr/026-tokenomics.md Updates POL and buyback/burn venue references to Uniswap V3 50/50 (adds TODO markers where sizing is now venue-dependent).
adr/016-contract-interactions.md Updates contract inventory/diagrams/call graph notes from Balancer Router to Uniswap SwapRouter02.
adr/003-payments.md Updates BuybackBurner function table notes to Uniswap-only venue and approval model.
Review details
  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread contracts/script/DeployProtocol.s.sol Resolved
alpergundogdu and others added 2 commits September 17, 2026 16:03
…y comment

The guard was renamed to _assertPoolSeedDerived when Balancer support was
dropped; update the DeployProtocol comment to match.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…y on Uniswap V3 at governance discretion

Resolve the ADR 018 TODO(pol-resize) markers left by the Balancer removal.
POL keeps its 10% allocation; only the seeding model changes. The pool is not
seeded at genesis — mainnet launches dormant — and governance creates the first
Uniswap V3 50/50 pool when it chooses (illustratively ~$100K USDC / ~10M TOKEN),
then deepens it incrementally from a Timelock reserve and the buyback glidepath.

The USDC side is self-funded from the DAO's 10% FeeRouter revenue share, not from
team or investor capital: drop the ~20% pre-seed POL-seed earmark (ADR 026
bootstrap) and route it to operator subsidies. Pool creation and buyback
activation are separate governance actions. No allocation-table or sell-pressure
changes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It rewrites on-chain deploy scripts and economic ADRs for a payment protocol, which warrants human sign-off despite the change being a mechanically clean, test-passing deletion with one documentation fix flagged.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

adr/026-tokenomics.md:360

  • This POL description now contradicts the pre-seed USDC table just below (line 372) and ADR 018 § Protocol-Owned Liquidity mechanics. The tail "paired with the USDC arm from the pre-seed bootstrap" is stale: line 372 states "POL is not seeded from pre-seed USDC — the DAO funds it from its 10% FeeRouter revenue share and creates the pool itself," and ADR 018 says "The USDC side is funded from the DAO treasury's own revenue — the 10% FeeRouter share ... no team or investor capital seeds it." Update this clause so the USDC funding source matches.
  • Files reviewed: 35/35 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

…ovision

The Protocol-Owned Liquidity bullet still said the USDC arm comes "from the
pre-seed bootstrap," contradicting the same file's bootstrap table and ADR 018.
POL's USDC is funded from the DAO's 10% FeeRouter revenue share; the DAO creates
the pool itself. Align the clause.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu requested a balanced review from Copilot September 17, 2026 15:54
@alpergundogdu
alpergundogdu merged commit db5734f into main Sep 17, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/nice-kowalevski-22c551 branch September 17, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It is a large breaking on-chain deploy-script refactor whose correctness depends on cross-file consistency (including generated docs and CI fork-suite config that appear stale but fall outside the changed files), so a human should confirm the full sweep.

Review details
  • Files reviewed: 35/35 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

thiras added a commit that referenced this pull request Sep 17, 2026
#2043 removed the Balancer V3 buyback venue and made Uniswap V3 canonical, but
left the CI fork-test job wired to the deleted Balancer suites, the ADR book
chapter divider naming Balancer, a stale `BuybackVenueLib` description in
`contracts/README.md`, and no CHANGELOG entry for the change itself.

- `ci.yml`: drop the dead `ARBITRUM_RPC_URL` and `SEPOLIA_RPC_URL` secrets from
  the `solidity-fork-test` job. One fork suite remains,
  `GenesisBuybackActivation.fork` on `ARBITRUM_SEPOLIA_RPC_URL`, which is the
  only alias `contracts/foundry.toml` still carries. Rewrite the comments for a
  single suite: correct the false "the name matches the `[rpc_endpoints]` alias"
  claim (the alias interpolates the var), drop the past-tense incident
  narrative, and stop claiming the glob count proves a test body ran — `forge
  test` exits 0 on an all-skipped suite.
- `adr/_build/part-4-tokenomics.md`: Balancer V3 becomes Uniswap V3 50/50,
  matching `adr/architecture.md` and ADR 018.
- `contracts/README.md`: `BuybackVenueLib` no longer dispatches on a venue.
  Re-derive the `src/` / `interfaces/` / `test/` counts and name all four
  libraries.
- `.coderabbit.yaml`: drop the Permit2 review instruction. `IPermit2` was
  Balancer-only and went with it.
- `CHANGELOG.md`: add the missing #2043 entry.

The repo secrets `ARBITRUM_RPC_URL` and `SEPOLIA_RPC_URL` are now unreferenced
and can be revoked.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants