Dynamic fee hook on Base
Uniswap v4 Hook Contract 0x57b18c5f0e028ab86a0888d578de23e65f072acc on Base · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 4 (2 traders)
- Total swaps
- 4
What it does
This hook tracks a king-of-the-hill address and reserves for a pool and can take currency on swaps through return deltas, but without source the exact fee and trade direction effects cannot be confirmed.
How it works step by step
- Hook permissions enable initialization, liquidity add and remove, swap, and after-swap callbacks, with before-swap and after-swap return-delta permissions that allow the hook to alter swap accounting.
- Stores a pool key and pool id at initialization and tracks reserves and effective liquidity per pool state slot.
- Contains a king-of-the-hill style mechanic: a koth address is stored via setKoth and read by afterSwap, with a churn counter and an onBuy callback selector referenced in the bytecode.
- Uses unlock and unlockCallback with take and transferFrom selectors, so the hook can open a pool manager unlock and move currency during swaps.
- Includes a self-unlock path and a NestedSwap guard, indicating it re-enters the pool manager during swap handling.
- Swap behaviour
- beforeSwap and afterSwap are both active and beforeSwap and afterSwap return deltas are enabled, so the hook can take or give currency on swaps; the exact fee or trade direction rules cannot be determined from decoded bytecode alone.
- Liquidity behaviour
- beforeAddLiquidity and beforeRemoveLiquidity are gated callbacks that read and update reserve and effective liquidity state; the exact restrictions cannot be determined without source.
- Fee behaviour
- Cannot be determined from decoded bytecode; no dynamic fee selector is clearly identified, so the fee may be static or set through return deltas.
- Owner & admin controls
- An owner exists (owner() and NotOwner error) and the owner can call setKoth to change the king address; no pause or upgrade function was identified.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize records pool key and initial state; beforeAddLiquidity and beforeRemoveLiquidity track liquidity; beforeSwap and afterSwap run custom swap logic with return deltas to adjust swap amounts; afterSwap also reads the koth address.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, low confidence).
Who controls it: The owner can set the koth address and may be able to change behaviour that affects which party receives swap value.
Risk to user funds: The hook can hold and move currency through take and transferFrom and return deltas on swaps, so user and pool funds are exposed to the hook logic.
Security findings
- [high] Hook takes currency via return deltas: beforeSwapReturnDelta and afterSwapReturnDelta are enabled alongside take and transferFrom selectors, so the hook can move user or pool currency during swaps.
- [medium] Owner can redirect the koth address: setKoth is callable by the owner and afterSwap reads the stored koth address, so the owner can change who benefits from swap flows.
- [medium] Self-unlock and nested swap handling: The hook calls unlock and unlockCallback and contains a NestedSwap error, so re-entrancy into the pool manager during swaps is a complex path that is hard to verify without source.
- [info] Unverified source: No verified source is available, so behaviour is inferred from decoded selectors and storage layout only.
Contract details
- Verified source
- No
- Bytecode size
- 16,587 bytes
- Upgradeable proxy
- No
- Detected patterns
- erc20, moves-currency, ownable, return-delta, self-unlock