V4HOOKSCUT SHEET DIRECTORY

Index / Super DCA

product · Apache-2.0 · last updated 2026-08-27

Super DCA

Dynamic LP fee in beforeSwap from who is swapping; pool must include the DCA token.

SuperDCAGauge (Apache-2.0) requires the Super DCA token in the pair and tickSpacing 60 in _beforeInitialize, then dynamic fees after init. _beforeSwap only accepts verified routers, reads msgSender, and returns fee | OVERRIDE_FEE_FLAG (0 for internal, keeper vs external). Liquidity callbacks also exist for gauge accounting. This is how to do allowlisted fee tiers, not a generic TWAMM you should copy blindly. Full SuperDCAGauge.sol at the permalink. Listing is not an audit.

Permission bits

These bits must match the deployed address. Confirm on-chain before you route.

Initialize
ba
Liquidity
baba
Swap
ba
Donate
ba
Return delta
baaa

beforeInitializeafterInitializebeforeAddLiquiditybeforeRemoveLiquiditybeforeSwap

Solidity

Excerpt from src/SuperDCAGauge.sol. Production hook. Study the callbacks, do not paste it as your factory. Not an audit.

// SPDX-License-Identifier: Apache-2.0
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
    return Hooks.Permissions({
        beforeInitialize: true,
        afterInitialize: true,
        beforeAddLiquidity: true,
        afterAddLiquidity: false,
        beforeRemoveLiquidity: true,
        afterRemoveLiquidity: false,
        beforeSwap: true,
        afterSwap: false,
        beforeDonate: false,
        afterDonate: false,
        beforeSwapReturnDelta: false,
        afterSwapReturnDelta: false,
        afterAddLiquidityReturnDelta: false,
        afterRemoveLiquidityReturnDelta: false
    });
}

function _beforeSwap(address sender, PoolKey calldata key, IPoolManager.SwapParams calldata, bytes calldata hookData)
    internal
    override
    returns (bytes4, BeforeSwapDelta, uint24)
{
    if (!verifiedRouters[sender]) revert SuperDCAGauge__UnauthorizedRouter();
    address swapper = IMsgSender(sender).msgSender();
    uint24 fee = isInternalAddress[swapper] ? internalFee : swapper == keeper ? keeperFee : externalFee;
    if (!isInternalAddress[swapper] && swapper != keeper) _handleDistributionAndSettlement(key, hookData);
    return (IHooks.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, fee | LPFeeLibrary.OVERRIDE_FEE_FLAG);
}

Spec

Kindproduct
Statusproduction
LicenseApache-2.0
Sourcehttps://github.com/Super-DCA-Tech/super-dca-gauge
CategoriesTWAMMDynamic feesVote-escrow
PropertiesDynamic fee
ChainsBaseEthereum
Websitehttps://superdca.org/

FAQ

Can I paste this into production? The snippet is an excerpt. Use the full file at the source URL, match flags to the address, and treat this page as a map, not a guarantee.

How do I build this safely? Start with secure v4 hooks and the OpenZeppelin hooks guide.