Skip to content

feat(contracts): live Balancer V3 swap binding for BuybackBurner #686

Closed

Description

@thiras

Context

PR #684 landed BuybackBurner as a scaffold whose swap path reverts SwapNotImplemented(). The contract is abstract until a subclass overrides _performSwap with the live Balancer V3 Vault ABI (ADR 018 § Liquidity Strategy, 80/20 POL). Until then FeeRouter's buyback bucket ships at 0% (launch shares [9000, 0, 1000]) and is dialed up by governance once the swap path is live.

Re-scoped 2026-05-30. The original scope also covered SafetyReserve.swapAccumulatedTokens and a shared BalancerV3SwapHelper abstract. SafetyReserve was removed (#708; ADR 033 retired) — slash restitution is now escrow-on-slash in CapacityBond, with no TOKEN→USDC conversion. Only the BuybackBurner leg remains, so there is a single swap call site and the shared-helper extraction no longer applies. (The original body also linked a non-existent adr/018-tokenomics-deployment.md; the canonical spec is adr/018-liquidity-strategy.md.)

Scope

  • Implement BuybackBurner._performSwap against the Balancer V3 IVault.swap ABI on Arbitrum (USDC → TOKEN → burn) in a concrete, deployable subclass.
  • Wire FeeRouter.buybackBurner to the deployed address; governance raises the buyback share toward the canonical 30%.
  • Tests: swap success, minOut / slippage bound, TWAP + private-RPC guards.

References

Blocks

Production activation of the FeeRouter buyback-and-burn bucket.

Activity

  1. added
    status:blocked
    on May 28, 2026
  2. added
    design:economics
    on May 28, 2026
  3. github-actions commented on May 28, 2026

    @github-actions

    🎯 Triage report

    This is a well-scoped follow-up to PR #684, tracking the deferred Balancer V3 IVault.swap binding for BuybackBurner._performSwap (USDC → TOKEN → burn) and SafetyReserve.swapAccumulatedTokens (slashed TOKEN → USDC). It also captures the nonReentrant re-addition on SafetyReserve and the planned BalancerV3SwapHelper extraction per ADR 016. This blocks the production FeeRouter buyback and slash-redirect conversion paths.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature New implementation replacing stub scaffolds; not a bug fix
    Labels economics, prod-blocking added (existing: technical, blocked, architecture) Swap binding is core to token economic flows; blocks production deployment
    Coding agent Suitable Requirements are precise: two specific contract locations, the Balancer V3 IVault.swap ABI, swap directions, and a concrete helper extraction pattern per ADR 016. Success criteria are clear (CI-clean, both stubs replaced, nonReentrant restored).

    🔗 Similar issues

    💡 Notes and suggestions

    Key implementation notes:

    • Balancer V3 IVault.swap ABI: Use the IVault interface from the balancer-v3-monorepo. The swap entrypoint is IVault.swap(VaultSwapParams calldata params) returning (uint256 amountCalculated, uint256 amountIn, uint256 amountOut). Ensure FOUNDRY_PROFILE=ci + --deny warnings doesn't trip on ABI imports.
    • BuybackBurner._performSwap (contracts/src/BuybackBurner.sol:114): USDC in → TOKEN out, then call TOKEN.burn(amountOut). Set SwapKind.EXACT_IN with appropriate slippage guard (the existing minAmountOut / deadline pattern already in scope per ADR 018).
    • SafetyReserve.swapAccumulatedTokens (contracts/src/SafetyReserve.sol:378): slashed TOKEN in → USDC out for payout. Re-add nonReentrant once the body is no longer an unconditional revert (W5740 warning goes away automatically).
    • BalancerV3SwapHelper: Extract as an abstract contract with an internal _swapViaBalancer(...) function. Both call sites inherit it. Confirm no diamond-inheritance issues with OZ bases.
    • Slither: unused-return on IVault.swap tuple destructuring needs a // slither-disable-next-line unused-return above the function declaration (not the call site) per CLAUDE.md.
    • Testing: Add fuzz tests on slippage bounds; mock the Vault with a minimal IVault stub for unit tests; add a fork test against Arbitrum Sepolia Vault address once that's available.

    Sub-tasks checklist:

    • Implement BuybackBurner._performSwap with live IVault.swap call
    • Implement SafetyReserve.swapAccumulatedTokens with live IVault.swap call
    • Re-add nonReentrant to SafetyReserve.swapAccumulatedTokens
    • Extract BalancerV3SwapHelper abstract once both paths are live
    • Unit tests with mock Vault for both swap paths
    • CI clean (forge fmt, forge build --deny warnings, slither, aderyn)

    Generated by Agentic Triage for issue #686 · ● 1.2M · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  4. changed the title [-]feat(contracts): live Balancer V3 swap binding for BuybackBurner and SafetyReserve[/-] [+]feat(contracts): live Balancer V3 swap binding for BuybackBurner[/+] on May 29, 2026
  5. alpergundogdu commented on May 29, 2026

    @alpergundogdu
    Contributor

    Re-scoped to BuybackBurner only — see the updated body.

    The SafetyReserve.swapAccumulatedTokens leg and the shared BalancerV3SwapHelper are dropped: SafetyReserve was removed in #708 (ADR 033 retired), and slash restitution is now escrow-on-slash in CapacityBond with no TOKEN→USDC conversion. BuybackBurner is still abstract and reverts SwapNotImplemented(), so this remains the home for the live Balancer V3 binding. Also corrected the dead ADR reference (018-tokenomics-deployment.md → 018-liquidity-strategy.md).

  6. removed
    status:blocked
    on Jun 2, 2026
  7. self-assigned this
    on Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:economicsprio:medium

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions