Dynamic fee hook on Robinhood Chain
Uniswap v4 Hook Contract 0xf6c6622a2fcd82ec9491ac59e23fd6cc0a56e0cc on Robinhood Chain · Dynamic fee
- Volume (24h)
- $9.69K
- Value locked (TVL)
- $11.28K
- All-time volume
- $9.69K
- Pools using this hook
- 1
- Swaps (24h)
- 65 (26 traders)
- Total swaps
- 65
What it does
This hook charges a separate buy fee and sell fee on swaps, capped at a fixed maximum, and forwards the collected fees to a fee receiver, so the direction set to the higher rate pays more, while the owner can pause trading and block addresses.
How it works step by step
- Charges a buy fee and a sell fee in basis points, read from storage slot 3 (buyBps and sellBps), with a FEE_CAP_BPS ceiling
- Gates trading behind a tradingEnabled flag that the owner toggles via setTradingEnabled
- Maintains an owner-managed blacklist of addresses that are blocked from trading
- Accumulates fees taken in afterSwap into parkedFees and forwards them to feeReceiver via settleParkedFees
- Can disable fees entirely via disableFees, and updateFees lets the owner change buy and sell rates
- Uses unlockCallback and self-unlock to settle currency through the pool manager during fee settlement
- Swap behaviour
- beforeSwap reverts with TradingNotOpen while trading is disabled and rejects blacklisted senders; it can return a dynamic fee and a delta, and afterSwap takes a fee from the swap output and adds it to parkedFees. Buys and sells are priced at different rates, so trades in the direction with the higher configured bps pay more.
- Liquidity behaviour
- beforeAddLiquidity, beforeRemoveLiquidity, afterAddLiquidity and afterRemoveLiquidity are present but appear to be pass-through checks without fee logic; no liquidity fee is evident from the decoded bytecode.
- Fee behaviour
- Dynamic per-swap fee using buyBps and sellBps (direction dependent), capped by FEE_CAP_BPS. Accrued fees are parked in the hook and sent to feeReceiver through settleParkedFees. disableFees can zero the fee logic.
- Owner & admin controls
- Owner (Ownable with two-step transfer via transferOwnership and acceptOwnership, and renounceOwnership) can set trading on or off, change buy and sell fee rates, disable fees, blacklist and unblacklist addresses, grant and revoke operator access, withdraw ETH and ERC20/ERC721 tokens via emergency functions, and set the fee receiver.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize validates pool setup; beforeSwap enforces trading gating, blacklist checks and returns the dynamic fee override; afterSwap skims the fee into parkedFees; beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take currency from swaps.
Security & trust assessment
Risk level: high, estimated (decoded bytecode, medium confidence).
Who controls it: A single owner key (and any operators it grants) can freeze trading, block specific wallets, change fees up to the cap, redirect the fee receiver and withdraw all hook-held assets.
Risk to user funds: The hook holds fees temporarily in parkedFees and can take currency through return deltas during swaps; the owner can withdraw these balances and can block swaps, so user funds are exposed to owner action.
Security findings
- [medium] Owner can halt all trading: setTradingEnabled(false) makes beforeSwap revert with TradingNotOpen, freezing swaps for all users.
- [medium] Owner can raise fees up to the cap and block addresses: updateFees sets buyBps and sellBps, and blacklist(address[]) blocks chosen addresses from swapping; the owner can also grant operator rights.
- [medium] Hook takes currency via return deltas: beforeSwapReturnDelta and afterSwapReturnDelta are enabled, so the hook can move swap output into its own balance before forwarding it.
- [medium] Emergency withdrawal functions: emergencyWithdrawETH, emergencyWithdrawERC20 and emergencyWithdrawERC721 let the owner move any balance held by the hook, including accumulated parked fees.
- [info] Parked fee settlement is permissionless to call: settleParkedFees has no visible access modifier in the decoded selector list, so anyone can trigger forwarding of parked fees to feeReceiver.
Contract details
- Verified source
- No
- Bytecode size
- 7,999 bytes
- Upgradeable proxy
- No
- Detected patterns
- access-control, dynamic-fee, erc20, moves-currency, ownable, return-delta, self-unlock
Pools using Dynamic fee hook
- ETH / TRUFFLR (0.00% fee) — 24h volume $9.69K, TVL $11.28K, 65 swaps today