RatchetProtocolHook on Ethereum

Uniswap v4 Hook Contract 0x0b44ee78e5dbd58c59951df3ea5732042fb220cc on Ethereum · Fee sharing · Verified contract

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
1
Swaps (24h)
4 (4 traders)
Total swaps
4

What it does

Traders pay a buy fee that starts high at launch and decays to a lower steady rate, while sells pay a separate fixed sell fee, with all fees going to a project wallet.

How it works step by step

  • Charges a buy fee and a sell fee in the pool's quote currency (ETH or an ERC-20) on every swap and forwards it to a fee recipient wallet via poolManager.take
  • Applies an anti-sniper buy fee that starts at antiSniperBps at launch and decays linearly to buyBps over antiSniperSeconds
  • Gates pool initialization so the pool can only be opened once, through the designated opener, at the agreed sqrt price
  • Enforces a hard fee ceiling (maxBps, at most 25%) set at construction, so the owner can only lower fees
  • Uses beforeSwap for exact-input buys and afterSwap for exact-output buys and all sells, taking the fee via return deltas
Swap behaviour
Buys (quote into token) pay the current buy fee, which is highest at launch and decays toward buyBps over antiSniperSeconds. Sells (token into quote) pay sellBps. The fee is taken in the quote currency and sent to feeRecipient, reducing the swapper's effective amount. Fee amounts are computed from the specified or delta amount respectively.
Liquidity behaviour
No liquidity callbacks.
Fee behaviour
Buy fee is currentBuyBps(), an anti-sniper value decaying linearly from antiSniperBps to buyBps. Sell fee is sellBps. Both are capped by maxBps and are taken as the quote currency and forwarded in full to feeRecipient; nothing is shared with LPs. The pool's static fee is separate.
Owner & admin controls
The owner can change buyBps and sellBps (bounded by the immutable maxBps), change feeRecipient to a non-contract address, transfer ownership, or renounce ownership. There is no pause, no upgrade mechanism, and no way to change maxBps, the opener, or the agreed opening price after deployment.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize restricts and records pool opening at the agreed price. beforeSwap takes the buy fee on exact-input buys via a before-swap return delta. afterSwap takes the buy fee on exact-output buys and the sell fee via an after-swap return delta. beforeSwapReturnDelta and afterSwapReturnDelta are enabled because the hook takes currency from swaps.

Security & trust assessment

Risk level: low (verified source, high confidence).

Who controls it: The owner key can raise buy and sell fees up to 25%, redirect all fee revenue to any EOA, and transfer or renounce ownership. It cannot pause swaps, upgrade the contract, or move the pool's liquidity.

Risk to user funds: The hook does not hold tokens or liquidity; it takes fees in the quote currency during swaps and immediately forwards them to feeRecipient, so user funds are exposed only to the fee amount, which is bounded by maxBps.

Security findings

  • [medium] Owner can raise fees up to the ceiling: setFees lets the owner set buy and sell fees anywhere up to the immutable maxBps (at most 2,500 bps, 25%), so a swap's fee can be increased at any time without user consent, even though the cap prevents an unbounded fee.
  • [low] Fee recipient can be redirected: setFeeRecipient lets the owner send all future fees to a new EOA; the recipient is checked to be a non-contract address, which prevents sells from freezing through a refusing contract.
  • [info] Return deltas take currency from swaps: The hook uses beforeSwap and afterSwap return deltas to take the fee in the quote currency via poolManager.take, so the hook directly moves user funds to feeRecipient on every swap.
  • [info] Pool opening restricted to one opener at one price: beforeInitialize only permits initialization by the opener at openSqrtPriceX96 and only once, so the pool cannot be opened by an arbitrary party at a manipulated price.

Contract details

Verified source
Yes (RatchetProtocolHook)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
5,167 bytes
Upgradeable proxy
No
Detected patterns
dynamic-fee, fee-sharing, launchpad, mev-protection, moves-currency, ownable, return-delta

Pools using RatchetProtocolHook