Repository navigation
docs: add ADR 018 liquidity strategy (Balancer 80/20 POL) - #188
Conversation
Reverses the implicit Uniswap V3 venue choice in prior ADRs in favour of a Balancer V2 80/20 TOKEN/USDC weighted pool seeded as Protocol-Owned Liquidity. Motivated by a USDC-poor treasury, the small team's inability to operate concentrated-liquidity keeper infrastructure, and an IL profile better aligned with the TOKEN-upside thesis. Sweeps all Uniswap references in ADRs 004 and 016 to Balancer; adds setPoolId(bytes32) to IBuybackBurner in ADR 003 to keep the interface symmetric across venues. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces ADR 018, which establishes a new liquidity strategy using a Balancer V2 80/20 TOKEN/USDC weighted pool as Protocol-Owned Liquidity (POL). This replaces the previous implicit choice of Uniswap V3 to better accommodate a TOKEN-rich but USDC-poor treasury and to eliminate the operational overhead of active range management. The changes include updates to the IBuybackBurner interface, contract interaction diagrams, and the central architecture overview. Review feedback identifies several technical inaccuracies that need correction: the Impermanent Loss (IL) reduction for 80/20 pools is overstated (it is ~1.75x rather than 4x), there is a contradiction in how the slippage limit is applied during multi-step TWAP executions, and the per-transaction cap logic for sub-swaps is inconsistent with existing MEV protection definitions.
There was a problem hiding this comment.
Pull request overview
Adds ADR 018 to formalize a Balancer V2 80/20 TOKEN/USDC Protocol-Owned Liquidity strategy, and updates existing ADRs to reflect Balancer as the canonical buyback venue (including the IBuybackBurner interface change needed to select a Balancer pool).
Changes:
- Introduces ADR 018 describing Balancer 80/20 POL seeding mechanics, buyback execution path, and venue comparison vs Uniswap V3.
- Updates ADRs 004 and 016 (and the architecture index/summary) to replace Uniswap V3 venue assumptions with Balancer Vault + poolId.
- Extends the ADR 003
IBuybackBurnerinterface spec withsetPoolId(bytes32)and updates repo “next ADR number” pointer.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| CLAUDE.md | Updates the “next ADR number” pointer to 019. |
| adr/architecture.md | Adds ADR 018 to the index and updates ADR 004 summary to reference the liquidity strategy decision. |
| adr/018-liquidity-strategy.md | New ADR defining Balancer 80/20 POL strategy, buyback execution approach, and activation criteria. |
| adr/016-contract-interactions.md | Updates call graphs/tables/diagrams to route BuybackBurner swaps through Balancer Vault. |
| adr/004-tokenomics.md | Updates tokenomics ADR to reference ADR 018 for venue and liquidity-seeding details. |
| adr/003-payments.md | Updates the canonical IBuybackBurner interface spec to include setPoolId(bytes32). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… dedup) Corrections from PR #188 review: - IL math: 80/20 at 2x price move is ~3.3%, not 1.3%; reduction vs 50/50 is ~1.75x, not 4x. Added the derivation formula in ADR 018 and propagated the corrected figures to the architecture.md summary. - Removed the duplicated IBuybackBurner interface snippet from ADR 018; reference the canonical block in ADR 003 as the single source of truth, eliminating drift (the snippet had omitted setPoolId, setKeeper, keeper, and getAccumulatedFees). - Rephrased the "requires no changes" claim so it no longer contradicts adding setPoolId(bytes32) in the same section. The core executeBuyback call pattern is unchanged; the interface is extended with one venue-symmetric setter. - TWAP policy: minTokenOut is now the aggregate minimum across the full split request, with per-sub-swap guards derived from remaining required output / remaining sub-swaps (ceil-division). Eliminates the integer-truncation bug where naive minTokenOut / subSwapCount could allow aggregate output to fall below the caller's minimum. - TWAP policy: removed the maxBuybackAmount / subSwapCount cap. ADR 016 defines maxBuybackAmount as a per-transaction MEV limit, so each sub-swap (being its own transaction) may be as large as maxBuybackAmount; dividing the cap would unnecessarily restrict fee throughput. - Minor: "pool id" -> "poolId" in ADR 016 constructor deps row for naming consistency with ADR 018 and ADR 004. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
From the pr-review-toolkit comment-analyzer pass on #188 (no critical issues, 5 important, 6 suggestions). Applied: Important: - architecture.md ADR 018 index entry: scope the "1/4 USDC" claim with "for small trades" to match the qualifier already in ADR 018's body. A future reader skimming the index should not walk away thinking total pool depth is 4x cheaper. - ADR 018 comparison table: add a footnote on the V3 $1M figure noting it is an order-of-magnitude comparison against a roughly-equivalent near-spot range, not an exact requirement (V3 USDC-side requirements depend entirely on range width). - ADR 018 Consequences: tighten the Balancer-incidents phrasing by pinning it to the ADR date (2026-04-04) and naming the affected pool families (ComposableStable, Boosted, linear wrappers) so the claim is auditable against future advisories. - ADR 018 comparison table + Consequences: replace "Balancer is a primary CoW venue" with "a supported CoW Swap settlement venue" (structural property, not market-share claim) to avoid time-decay. Suggestions: - ADR 018 PoC seed sizing: document why the $5K-$20K range is wide and who picks the point estimate (governance at deployment, based on observed PoC traffic). - ADR 018 "No withdraw path to an EOA" invariant: add the enforcement parenthetical (BPT custody at Timelock; Balancer has no protocol-level lockup). - ADR 018 setPoolId future-V3 note: soften the forward commitment so a future V3-supplement ADR is free to reuse or introduce a distinct setter. - ADR 018 subSwapCount=4: add rationale footnote (balance MEV vs keeper gas and ceilDiv rounding). - ADR 018 "When to revisit": add quantitative placeholder triggers (USDC runway, LP fee / protocol fee ratio, execution failures, aggregator regression) so governance voters have concrete bars. - ADR 018 IL-exposure consequence: cross-reference ADR 004 Token Distribution so worst-case IL can be sized quickly. Skipped finding #5 (ADR 003 PoC note pointer chain) because ADR 004's activation criteria paragraph is not changed by this PR, so there is no redirect chain for a reader to follow. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Triggered by the 2025-11-03 Balancer V2 Composable Stable Pool exploit (~$125M across multiple chains). Root cause per Certora, Trail of Bits, and OpenZeppelin post-mortems: a rounding-direction bug in _upscale/_downscale latent since 2021, exploited via EXACT_OUT + batchSwap to manipulate BPT pricing. V3's new Vault architecture (transient accounting via unlock/settle, unified scaling) is explicitly cited by Certora as mitigating this bug class. Standard V3 Weighted Pools are first-class, undeprecated, and deployed on Arbitrum, so the core 80/20 POL decision (USDC efficiency, IL alignment, zero-keeper posture) is preserved — those are properties of weighted pools in general, not V2-specific. Only the execution path, pool identifier, interface setter name, and security framing change. Mechanical changes: - Swap entry point: Vault.swap(SingleSwap, FundManagement, limit, deadline) becomes Router.swapSingleTokenExactIn(pool, tokenIn, tokenOut, exactAmountIn, minAmountOut, deadline, wethIsEth, userData). The contract called is the V3 Router, not the Vault. - Pool identifier: bytes32 poolId becomes address pool. V3 pools are identified by their contract address directly. - IBuybackBurner setter rename: setPoolId(bytes32) becomes setPool(address). This PR is not merged, so this is a rename, not a breaking change. - Approvals footgun: V3 contracts approve the Vault address for input-token pulls while calling the Router to execute the swap. Documented explicitly in ADR 018 deployment config, ADR 016 constructor-deps row, and ADR 016 call table. - Security disclaimer: rewritten to (a) cite the Nov 2025 V2 exploit as realized history, (b) use it as affirmative justification for V3, (c) name the V3 pool taxonomy (Weighted, Stable, Stable Surge, Boosted, LBP, ReClamm, QuantAMM, Gyro, hooks-based) rather than the V2 families, (d) acknowledge V3's shorter track record as residual risk. - CoW Swap claim downgrade: CoW routing is now described as a conditional add-on pending verification that CoW solvers route through the deployed V3 weighted pool. Balancer's V2-only aggregator fee-discount program was explicitly not extended to V3, and CoW's V3 coverage is still maturing. TWAP + minTokenOut guards are the primary MEV defense. Arbitrum mainnet V3 addresses are referenced in ADR 018 for the Vault (0xbA1333333333a1BA1108E8412f11850A5C319bA9) and Router v2 (0xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E). Sepolia and other testnet addresses MUST be pulled from balancer-deployments/addresses/arbitrum-sepolia.json at deployment time and are not hardcoded. Things unchanged: IL math (~1.75x at 2x price move), USDC efficiency (~1/4 vs 50/50), TWAP ceilDiv semantics, maxBuybackAmount per-transaction cap, parameter numerics (subSwapCount=4, subSwapMinBlockGap=10, slippageBps=200, minBuybackAmount=100 USDC), activation criteria depth requirements. These are all venue-version-agnostic properties of weighted-pool curves or of the BuybackBurner MEV policy. Files touched: - adr/018-liquidity-strategy.md: primary rewrite - adr/003-payments.md: IBuybackBurner interface (setPool rename) - adr/004-tokenomics.md: 3 V2->V3 references - adr/016-contract-interactions.md: 7 edits (constructor deps, 2 mermaid diagrams, call table, reentrancy row) - adr/architecture.md: ADR 018 index summary updated Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces ADR 018, which establishes a Balancer V3 80/20 TOKEN/USDC weighted pool as the canonical liquidity venue, replacing the previous implicit choice of Uniswap V3. The strategy leverages Protocol-Owned Liquidity (POL) to improve USDC efficiency and reduce operational overhead for the treasury. Updates across ADRs 003, 004, 016, and the architecture overview align the IBuybackBurner interface and execution logic with Balancer V3's Vault-based architecture and refined MEV protection policies. A Markdown formatting error was noted in the new ADR where a footnote breaks the continuity of a parameter table.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
From the gemini-code-assist + Copilot review pass on commit 1ee0f75. All 6 findings verified as valid; no pushback. - ADR 018 Parameter Table: move the subSwapCount footnote definition below the table body. A footnote block between table rows breaks markdown table rendering — the "Execution activation" row was orphaned from the rest of the table. (gemini) - ADR 018 Buyback execution: disambiguate "Router v2" naming. The Arbitrum mainnet router 0xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E is labelled "Router v2" in Balancer's deployment registry, which is a contract versioning *within* Balancer V3 (second iteration of the V3 Router artifact), not a reference to Balancer V2. The ADR now calls this out explicitly to prevent operators from assuming "Router v2" means V2. (Copilot) - ADR 016 MEV protection note: fix stale anchor link #buyback-execution-via-balancer → #buyback-execution-via-balancer-v3 (the ADR 018 section heading was renamed in the V3 migration). (Copilot) - ADR 016 MEV protection note: reconcile wording with ADR 018. The previous text said "recommended production path is to route buybacks through CoW Swap", which contradicted ADR 018's V3 downgrade of CoW routing to a conditional add-on. Now says direct Router + TWAP is the primary production path and required fallback; CoW is a conditional add-on that requires operator verification of V3 solver routing. (Copilot) - ADR 016 constructor deps row: clarify that the pool address is an initial convenience parameter (may be zero-address at deploy) and remains governance-mutable post-deploy via setPool(address). The previous wording implied the pool was a hard constructor requirement, which contradicted ADR 003's setPool setter. (Copilot) PR description drift (Copilot finding #2) is addressed separately via gh pr edit, not in this commit. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
From the pr-review-toolkit review pass on 2946989. Zero critical issues; 5 Important items applied as a single commit before merge. 1. Pool taxonomy accuracy (ADR 018 Consequences). "Boosted" is a composition pattern (weighted/stable pools with ERC-4626 wrapped tokens via BufferRouter), not a peer pool family — there is no BoostedPoolFactory. "QuantAMM" is a V3 hook-based partner family but is not deployed on Arbitrum per the balancer-deployments registry. Rewrote the taxonomy list to reflect the live Arbitrum registry and to caveat QuantAMM as "on other chains". 2. "Router v2" disambiguation cross-link (ADR 016). The disambiguation text in ADR 018 line 65 was not cross-linked from ADR 016. A deployment engineer landing in ADR 016 first and then searching the Balancer registry for 20250307-v3-router-v2 could momentarily wonder whether "v2" means V2 protocol. Added a "Router naming note" to the BuybackBurner constructor deps row that both explains and cross-links to ADR 018. 3. Constructor vs setPool semantics in ADR 018. ADR 016 permits zero-address at deploy; ADR 018 did not mention this and did not state whether executeBuyback reverts on zero-address. Added one sentence stating constructor-time and setter-time semantics are equivalent, and that executeBuyback MUST revert if the configured pool is the zero address regardless of how it got there. 4. Actor clarification for Vault approval (ADR 018). Previous wording said "USDC approval is made to the V3 Vault address" in passive voice, leaving the actor ambiguous. The only workable interpretation is BuybackBurner self-approves the Vault during initialization — because the Vault pulls from the msg.sender of the Router call, which is BuybackBurner itself. A deployment script that approves the Vault from a multisig operator address would ship a broken contract. Rewrote the footgun bullet to explicitly name BuybackBurner as the actor, clarify that the approval is issued by contract code (not a runbook step), and explain why (Vault pulls from Router msg.sender). 5. Actor clarification cascade (ADR 003, ADR 016 call table). The same passive-voice "must be approved to the Vault" wording lived in ADR 003:516 and ADR 016:145. Updated both to name BuybackBurner as the self-approving actor, consistent with ADR 018. Suggestions 6-11 (time-sensitive address framing, registry task-ID citations, revisit trigger addition, post-mortem URLs, Vault/Router glossary, WeightedPoolFactory task-ID pin) are deferred as Suggestions-grade polish; none affect technical correctness or merge-readiness. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
adr/018-liquidity-strategy.mdspecifying a Balancer V3 80/20 TOKEN/USDC weighted pool seeded as Protocol-Owned Liquidity, with a venue-choice comparison against Uniswap V3 concentrated liquidity.adr/004-tokenomics.mdandadr/016-contract-interactions.mdto Balancer, including the cross-contract call graph, fund-flow diagram, reentrancy analysis, and MEV-protection note.IBuybackBurnerinterface inadr/003-payments.mdwithsetPool(address)(renamed from the initialsetPoolId(bytes32)draft) — V3 identifies pools by contract address directly.adr/architecture.mdADR 004 summary and inserts a new ADR 018 index entry.CLAUDE.mdfrom 018 to 019.Rationale (one-paragraph)
The treasury is TOKEN-rich and USDC-poor, and the protocol team does not have bandwidth to operate a concentrated-liquidity keeper stack. An 80/20 Balancer weighted pool needs roughly 1/4 the USDC of a 50/50 V3 position for comparable near-spot depth, has zero range-management overhead, and reduces impermanent loss by ~1.75× for a 2× TOKEN price move (~3.3% vs ~5.7%). Uniswap V3's wins (fee capture, aggregator routing density) presuppose active range management the team cannot provide during PoC and early production. The
IBuybackBurnerinterface stays venue-agnostic viasetSwapRouter+setPool(address)so a supplemental V3 position can be added by a future ADR without breaking changes.Why Balancer V3 (not V2)
Initial drafts targeted Balancer V2. This PR migrates to V3 before merge in response to the 2025-11-03 Balancer V2 Composable Stable Pool exploit (~$125M) — a rounding-direction bug in
_upscale/_downscalelatent since 2021, exploited viaEXACT_OUT+batchSwapto manipulate BPT pricing (per Certora, Trail of Bits, OpenZeppelin post-mortems). The exploit affected V2 Composable Stable Pools specifically, not standard V2 Weighted Pools and not V3. Certora explicitly cites V3's new Vault architecture (transient accounting viaunlock/settle, unified scaling) as mitigating this bug class. The ADR restricts the venue choice to standard V3 Weighted Pools with no hooks — the simplest V3 pool family. V3's shorter track record is acknowledged as residual risk; the ADR mandates tracking Balancer security advisories as a revisit trigger.V3 integration notes (operator-facing)
BalancerV3Router.swapSingleTokenExactIn(pool, tokenIn, tokenOut, exactAmountIn, minAmountOut, deadline, wethIsEth, userData)on the Balancer V3 Router, notVault.swap(...)on the Vault directly.executeBuybackcalls the Router. The Router forwards into the Vault which pulls input tokens via its own allowance. This is the most common V2→V3 integration mistake.address pool, not V2'sbytes32 poolId.minTokenOutis the primary MEV defense.0xbA1333333333a1BA1108E8412f11850A5C319bA9, Router v20xEAedc32a51c510d35ebC11088fD5fF2b47aACF2E(note: "Router v2" is the second iteration of the V3 Router artifact, not a V2 protocol reference). Sepolia addresses must be pulled frombalancer-deployments/addresses/arbitrum-sepolia.jsonat deployment time.Test plan
grep -rn 'Uniswap\|uniswap\|UniswapV3\|exactInputSingle\|V3Router' adr/ CLAUDE.md— every remaining hit should be inside ADR 018's legitimate comparison sections or the ADR 018 summary inarchitecture.md.grep -rn 'Balancer V2\|BalancerV2\|Vault\.swap\|bytes32 poolId\|setPoolId\|SingleSwap\|FundManagement' adr/ CLAUDE.md— remaining hits should only be inside ADR 018 historical/context passages (migration note, security disclaimer citing the Nov 2025 exploit, and the sentence explaining V3's move away frompoolId).grep -rn 'Balancer V3\|BalancerV3\|swapSingleTokenExactIn\|setPool\b' adr/— references are consistent across ADRs 003, 004, 016, 018, and architecture.md.grep -rn 'LiquidityManager' adr/— appears only where ADR 018 explicitly rejects introducing such a contract.grep -rn 'next number is' CLAUDE.md— bumped to 019.#buyback-execution-via-balancer-v3and#activation-criteria-production.BuybackBurner→ Balancer V3 Router call path inadr/016-contract-interactions.md(constructor deps, call graph, call table, fund-flow diagram, reentrancy analysis) to confirm every reference is updated.🤖 Generated with Claude Code