You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(contracts): live Balancer V3 swap binding for BuybackBurner #686
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%.
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
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).
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)
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
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).
Activity
github-actions commentedon May 28, 2026
🎯 Triage report
This is a well-scoped follow-up to PR #684, tracking the deferred Balancer V3
IVault.swapbinding forBuybackBurner._performSwap(USDC → TOKEN → burn) andSafetyReserve.swapAccumulatedTokens(slashed TOKEN → USDC). It also captures thenonReentrantre-addition onSafetyReserveand the plannedBalancerV3SwapHelperextraction per ADR 016. This blocks the production FeeRouter buyback and slash-redirect conversion paths.📊 Assessment
economics,prod-blockingadded (existing:technical,blocked,architecture)IVault.swapABI, swap directions, and a concrete helper extraction pattern per ADR 016. Success criteria are clear (CI-clean, both stubs replaced,nonReentrantrestored).🔗 Similar issues
BuybackBurnerwith "full path including Balancer V3 swap" andBalancerV3SwapHelperabstract as in-scope, so feat(contracts): live Balancer V3 swap binding for BuybackBurner #686 is the direct child task for that line item.💡 Notes and suggestions
Key implementation notes:
IVault.swapABI: Use theIVaultinterface from thebalancer-v3-monorepo. The swap entrypoint isIVault.swap(VaultSwapParams calldata params)returning(uint256 amountCalculated, uint256 amountIn, uint256 amountOut). EnsureFOUNDRY_PROFILE=ci+--deny warningsdoesn't trip on ABI imports.BuybackBurner._performSwap(contracts/src/BuybackBurner.sol:114): USDC in → TOKEN out, then callTOKEN.burn(amountOut). SetSwapKind.EXACT_INwith appropriate slippage guard (the existingminAmountOut/ deadline pattern already in scope per ADR 018).SafetyReserve.swapAccumulatedTokens(contracts/src/SafetyReserve.sol:378): slashed TOKEN in → USDC out forpayout. Re-addnonReentrantonce the body is no longer an unconditional revert (W5740 warning goes away automatically).BalancerV3SwapHelper: Extract as anabstract contractwith an internal_swapViaBalancer(...)function. Both call sites inherit it. Confirm no diamond-inheritance issues with OZ bases.unused-returnonIVault.swaptuple destructuring needs a// slither-disable-next-line unused-returnabove the function declaration (not the call site) per CLAUDE.md.IVaultstub for unit tests; add a fork test against Arbitrum Sepolia Vault address once that's available.Sub-tasks checklist:
BuybackBurner._performSwapwith liveIVault.swapcallSafetyReserve.swapAccumulatedTokenswith liveIVault.swapcallnonReentranttoSafetyReserve.swapAccumulatedTokensBalancerV3SwapHelperabstract once both paths are liveforge fmt,forge build --deny warnings, slither, aderyn)Add this agentic workflows to your repo
To install this agentic workflow, run
[-]feat(contracts): live Balancer V3 swap binding for BuybackBurner and SafetyReserve[/-][+]feat(contracts): live Balancer V3 swap binding for BuybackBurner[/+]alpergundogdu commentedon May 29, 2026
Re-scoped to
BuybackBurneronly — see the updated body.The
SafetyReserve.swapAccumulatedTokensleg and the sharedBalancerV3SwapHelperare dropped:SafetyReservewas removed in #708 (ADR 033 retired), and slash restitution is now escrow-on-slash inCapacityBondwith no TOKEN→USDC conversion.BuybackBurneris stillabstractand revertsSwapNotImplemented(), 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).feat(contracts): extend DeployProtocol with new contracts + E2E (#452)
feat(contracts): extend DeployProtocol + full E2E integration (#452) (#…
feat(contracts): live Balancer V3 swap binding for BuybackBurner (#686)…
docs(adr): condense ADR 018 to STE100, cut repetition
docs(adr): condense ADR 018 to STE100, cut repetition (#1414)