AnchorPoolHookV2 on Base
Uniswap v4 Hook Contract 0x51aa7f46ef841cf1df0bbb8dbef7190bb0856888 on Base · Dynamic fee · Verified contract
- Volume (24h)
- $289
- Value locked (TVL)
- $1.06K
- All-time volume
- $629
- Pools using this hook
- 1
- Swaps (24h)
- 21 (18 traders)
- Total swaps
- 90
What it does
A YPAL/USDC Uniswap v4 hook that charges a high anti-snipe input fee on external swaps, ratcheting down as the pool's TWAP market cap rises, while restricting liquidity additions to protocol contracts.
How it works step by step
- Restricts pool initialization to core and pins the pool to the YPAL/USDC pair.
- Blocks all external liquidity additions, allowing only core and buyBurn to add liquidity.
- Charges an input-side anti-snipe fee on external swaps via beforeSwap return delta, starting at 80%.
- Ratchets the fee down only, based on TWAP market cap crossing immutable thresholds.
- Routes 50 bps of each external input to a redemption vault, with the remainder going to buyBurn or feeRouter by token.
- Maintains a ring-buffer TWAP of USDC-per-YPAL price that serves as an on-chain USD oracle.
- Swap behaviour
- External exact-input swaps pay an input-side fee (starting at 80%, ratcheting down to 1.5%) split as 50 bps to redemptionVault and the remainder to buyBurn (USDC input) or feeRouter (YPAL input); exact-output swaps from external callers revert; core and buyBurn swaps are fee-exempt.
- Liquidity behaviour
- beforeAddLiquidity only allows core (seed LP) and buyBurn to add liquidity; all external LP adds revert. No beforeRemoveLiquidity callback, so removal is governed by the position owner contract (core), not by the hook. Hook does not move liquidity itself.
- Fee behaviour
- Swaps pay an input-side fee starting at 80% (feeTier0) that can only ratchet down through immutable TWAP mcap tiers, floored at 1.5% (feeFloor). The fee is taken via beforeSwap return delta: 50 bps of input goes to redemptionVault and the remainder goes to buyBurn for USDC input or feeRouter for YPAL input. Core and buyBurn swaps are fee-exempt.
- Owner & admin controls
- Admin (immutable address baked in at deploy) can only call setCore, setBuyBurn and setFeeRouter, each one-shot (reverts if already set); no pause, no upgrade, no fee-parameter change after deployment since tiers are immutable. Admin cannot change the fee curve, redirect fees after wiring, or move funds.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta
beforeInitialize restricts pool creation to core and pins the pool to the YPAL/USDC pair while recording poolId; beforeAddLiquidity gates LP adds to core and buyBurn; beforeSwap accumulates the TWAP, ratchets the fee, blocks external exact-output and takes the input-side fee via return delta; beforeSwapReturnDelta lets the hook consume a portion of swap input as the fee.
Security & trust assessment
Risk level: low (verified source, high confidence).
Who controls it: The admin cannot alter fees, sinks after one-shot wiring, or liquidity rules. Before wiring, the admin alone decides where fee sinks point, so an admin mistake or a delayed setBuyBurn/setFeeRouter call could leave swaps reverting with NotWired. Core, not the hook, controls LP removal; if core is a managed seeder its owner may withdraw the genesis position until ownership is renounced.
Risk to user funds: The hook takes swap input as fees and sends it to fixed sinks (redemptionVault, buyBurn, feeRouter). It cannot hold user funds beyond transient PoolManager accounting, cannot change sinks after wiring, and cannot block exits except during the pre-wiring NotWired window. Liquidity itself is not controlled by the hook.
Security findings
- [medium] Liquidity removal is governed by core, not the hook: LP permanence depends on the wired core contract. The hook has no beforeRemoveLiquidity, so a position owner that is a managed contract can remove liquidity; buyBurn-funded LP has no removal path.
- [low] Trading is blocked until admin completes wiring: Until both buyBurn and feeRouter are set, every external swap reverts with NotWired, which halts trading for users if the admin wiring is delayed or fails.
- [info] High initial fee by design: The fee is an input-side skim of up to 80% at launch, which deliberately makes trades very costly while the pool is thin; users selling or buying early bear a large fee by design.
- [low] Oracle derived from pool spot price: The TWAP and fee ratchet are derived from the pool's own spot price, so large trades can move the oracle; the mcap ratchet is intentionally expensive to manipulate but the fee can only drop, not rise, once lowered.
Contract details
- Verified source
- Yes (AnchorPoolHookV2)
- Compiler
- solc 0.8.28+commit.7893614a
- Bytecode size
- 8,204 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, liquidity-management, moves-currency, oracle, return-delta
Pools using AnchorPoolHookV2
- USDC / PROTO (0.00% fee) — 24h volume $289, TVL $1.06K, 21 swaps today