StockTokenHook on Base

Uniswap v4 Hook Contract 0xff02680c7afe8c63e91c07efa985c81efa6b68c4 on Base · Dynamic fee · Verified contract

Volume (24h)
$0
Value locked (TVL)
$114.40K
All-time volume
$9.17M
Pools using this hook
3
Swaps (24h)
0 (0 traders)
Total swaps
13,900

What it does

A Uniswap v4 hook for tokenized stock pools that charges a decaying swap fee, sends a 1% cut to a developer wallet, and restricts trading to set market hours.

How it works step by step

  • Gates swaps to configured trading sessions using a timezone offset and hour or minute timing.
  • Applies a buy or sell fee that decays linearly from a start rate to an end rate over 48 hours after the first trade.
  • Takes the fee from the unspecified side of each swap via manager.take and returns it through afterSwapReturnDelta.
  • Sends 1% of swap volume to a configurable dev wallet.
  • Forwards the remaining fee to the StockToken fee vault, converting tokens through the pool or a Uniswap V3 router first.
  • Restricts pool initialization and liquidity additions to the StockToken loading phase.
Swap behaviour
beforeSwap reverts if the pool is unregistered or outside trading hours and records the first trade timestamp. afterSwap takes a fee in the unspecified currency based on the current decaying fee, converts it where needed, splits it between the dev wallet and the StockToken fee vault, and returns the fee as a delta.
Liquidity behaviour
beforeAddLiquidity only allows liquidity to be added while the StockToken is in its loadingLiquidity phase; otherwise it reverts. No remove-liquidity callbacks.
Fee behaviour
Each pool has start and end buy/sell fee tiers (max 10%). The fee decays linearly from start to end over 48 hours after the first trade. Fees are taken from the unspecified side of each swap in afterSwap via manager.take, then split 1% to the dev wallet and the remainder to the StockToken fee vault. Fees may be converted through the pool itself or Uniswap V3 SwapRouter02 before distribution.
Owner & admin controls
Only the StockToken owner can change the dev wallet via setDevWallet. Pool registration is restricted to the StockToken contract (onlyStockToken). Trading hours and fee parameters are set at registration and not otherwise changeable in the source shown. No pause or upgrade mechanism found.

Enabled Uniswap v4 callbacks

beforeInitialize, beforeAddLiquidity, beforeSwap, afterSwap, afterSwapReturnDelta

beforeInitialize restricts pool initialization to the StockToken loading phase. beforeAddLiquidity restricts liquidity additions to the same phase. beforeSwap enforces that the pool is registered and within configured trading hours, and records the first trade timestamp that starts the fee decay. afterSwap takes the fee in the unspecified currency and distributes it. afterSwapReturnDelta lets the hook return a delta equal to the taken fee so the swapper receives less.

Security & trust assessment

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

Who controls it: The StockToken owner can replace the dev wallet, redirecting the 1% dev fee on all future swaps. The StockToken contract controls pool registration and liquidity loading. Fee parameters and trading hours are fixed at registration, so the owner cannot raise fees on existing pools through this hook.

Risk to user funds: The hook takes a portion of the unspecified token on every swap through return deltas and holds fees briefly during conversion. Fees are forwarded to the dev wallet and the StockToken fee vault; the hook does not hold user principal. Unprotected conversion swaps can leak value from fees.

Security findings

  • [info] Trading session gating: Swaps revert outside configured trading hours via TradingOutsideAllowedHours, so traders cannot swap at all during closed sessions.
  • [medium] Owner can redirect dev fee: setDevWallet is gated by stockToken.owner() and allows the owner to redirect the 1% dev fee to any non-zero address immediately.
  • [medium] Fee conversion has no slippage protection: Fee conversion calls manager.swap and exactInputSingle with amountOutMinimum of 0 and sqrtPriceLimitX96 of 0 on the V3 router, so the conversion can be sandwiched and fees lose value to MEV.
  • [low] Nested swap inside afterSwap: afterSwap takes the fee via manager.take and, for stock-token fees, performs a nested manager.swap inside a hook callback. Reentrancy and accounting correctness rely on PoolManager unlock semantics and were not independently verified.
  • [info] Bounded fees: Fee tiers are fixed at registration and capped at 10%, and the decay is linear over 48 hours, which limits how much the hook can extract from traders.

Contract details

Verified source
Yes (StockTokenHook)
Compiler
solc 0.8.29+commit.ab55807c
Bytecode size
11,566 bytes
Upgradeable proxy
No
Detected patterns
return-delta

Pools using StockTokenHook