Dynamic fee hook on Unichain
Uniswap v4 Hook Contract 0xe109c2b5fb7b1639dd7824787b6b3091e4265080 on Unichain · Dynamic fee
- Volume (24h)
- $0
- Value locked (TVL)
- $192
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 0
What it does
This hook sets each swap's fee dynamically from an external price feed, with a deadband, base fee and maximum fee cap, and does not change liquidity operations.
How it works step by step
- Sets the pool's dynamic LP fee in beforeSwap through updateDynamicLPFee on the pool manager
- Reads an external price feed via latestRoundData to compare against a reference price
- Checks feed freshness using a maximum age and a gas limit when calling the feed
- Uses a deadband in basis points and a base fee with a maximum fee cap to derive the fee
- Emits or returns reason codes (OK, STALE, INVALID) for the fee decision
- Initializes its state in afterInitialize and blocks no liquidity operations
- Swap behaviour
- beforeSwap reads the external feed, computes a fee from the price deviation, and pushes it to the pool through updateDynamicLPFee before the swap executes. The exact direction of the fee change (which trades pay more or less) cannot be determined from the decoded bytecode alone.
- Liquidity behaviour
- No liquidity callbacks.
- Fee behaviour
- The hook sets a dynamic LP fee per swap from a base fee, a deadband and a MAX_FEE cap, using oracle data; the fee is not taken or shared by the hook itself.
- Owner & admin controls
- No admin controls found.
Enabled Uniswap v4 callbacks
afterInitialize, beforeSwap
afterInitialize records initial state at pool creation. beforeSwap computes and applies the dynamic fee for each swap.
Security & trust assessment
Risk level: medium, estimated (decoded bytecode, medium confidence).
Who controls it: Admin or upgrade controls were not found in the decoded selectors, so the scope of privileged control cannot be confirmed; any parameter or feed address setter would be an unverified control.
Risk to user funds: The hook does not take or hold tokens through return deltas and does not block liquidity operations, so user funds are not directly moved by the hook; exposure is limited to the fee applied to swaps.
Security findings
- [medium] Dependency on external price feed: The fee logic calls latestRoundData on a feed address stored in the contract; if the feed is stale or returns invalid data the hook falls back to reason codes, which affects the fee applied to swaps.
- [info] Unverified source: No verified source is available, so the exact fee formula, admin roles and any upgrade paths are inferred only from decoded selectors.
- [low] Fee updated on every swap: The hook calls updateDynamicLPFee inside beforeSwap, so the fee depends on externally supplied oracle data at each trade.
Contract details
- Verified source
- No
- Bytecode size
- 7,172 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, oracle
Pools using Dynamic fee hook
- ETH / wstETH (Dynamic fee) — 24h volume $0, TVL $192, 0 swaps today