Dynamic fee hook on BNB Chain
Uniswap v4 Hook Contract 0x3c5165ddbabbf4ec49ded71e3a025fc9901ca9cc on BNB Chain · Dynamic fee
- Volume (24h)
- $0.88
- Value locked (TVL)
- $0
- All-time volume
- $0.88
- Pools using this hook
- 1
- Swaps (24h)
- 2 (1 traders)
- Total swaps
- 2
What it does
This is an upgradeable, owner-controlled hook that charges owner-set dynamic swap fees and caps the number of swaps per pool, with return-delta and withdrawal callbacks that an upgrade could use to take swap funds or block LPs.
This read was written for the hook 0x7cf7…29cc on BNB Chain and reused here: the two share a code shape, so constants such as fees, owners and addresses can differ.
How it works step by step
- Sets a per-pool swap fee and a global dynamic fee that the owner can change; pools must use the dynamic-fee flag.
- Counts swaps per pool and can reject swaps once a maximum swap count is reached.
- Owner can change gas-limit and other configuration values and reset swap counters.
- Runs on adding liquidity and after LP withdrawals; the exact checks are unclear from bytecode.
- Sits behind an upgradeable proxy, so the owner can replace its logic within the fixed permission bits.
- Swap behaviour
- Before each swap the hook reads the dynamic fee, the gas limit and the pool's swap counter, and may revert with a swap-limit error. Swap return deltas are enabled, so the current or a future implementation can change or deduct swap amounts.
- Liquidity behaviour
- The hook runs before liquidity is added, possibly with an owner check, and after liquidity is removed. Because a remove-liquidity callback is enabled on an upgradeable proxy, an upgrade could make withdrawals revert.
- Fee behaviour
- The owner sets the swap fee per pool and a global dynamic fee, and an InvalidFee check exists, but the exact cap cannot be confirmed from bytecode. Fees go to LPs through the normal dynamic LP fee unless return deltas are used.
- Owner & admin controls
- The owner can set per-pool and dynamic fees, the gas limit, a 'mid' address, per-address values and swap counters, and can upgrade the implementation. Fee caps are not verifiable.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize: requires a dynamic-fee pool and records its fee; beforeAddLiquidity: gates or checks deposits; afterRemoveLiquidity: runs on withdrawals; beforeSwap: applies the fee and the swap-count limit; afterSwap: post-swap bookkeeping; beforeSwapReturnDelta/afterSwapReturnDelta: can change swap amounts.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, low confidence).
Who controls it: A single owner controls fees, swap counters and configuration, and can upgrade the logic. At worst they could take swap funds or block withdrawals through an upgrade.
Risk to user funds: Swap amounts can be changed through return deltas, and the fee range is unverified. LP principal stays in the PoolManager, but withdrawals could be blocked by an upgraded implementation.
Security findings
- [high] Upgradeable proxy with swap return deltas: The implementation can be swapped, and the enabled swap return-delta bits let new logic take tokens from swaps.
- [high] Withdrawal callback upgradeable: afterRemoveLiquidity is enabled, so an upgraded implementation could revert and block LP withdrawals.
- [medium] Swap count limit: Swaps can be rejected once a pool's swap counter reaches its maximum, and the owner controls the counters.
- [medium] Owner-set fees with unknown cap: The owner can change fees at any time; a validity check exists but its bound is unknown.
Contract details
- Verified source
- No
- Bytecode size
- 1,112 bytes
- Upgradeable proxy
- Yes
- Detected patterns
- dynamic-fee, ownable, return-delta, upgradeable
Pools using Dynamic fee hook
- USDT / 牛来 (Dynamic fee) — 24h volume $0.88, TVL $0, 2 swaps today