FewTokenHook on Ethereum
Uniswap v4 Hook Contract 0x948922b055187c7366e71b876ab1242ebbaea888 on Ethereum · Utility · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $0
- All-time volume
- $0
- Pools using this hook
- 1
- Swaps (24h)
- 2 (2 traders)
- Total swaps
- 476
What it does
Lets traders swap between a token and its fewToken wrapper at a fixed 1:1 rate through a Uniswap v4 pool, with liquidity provision blocked.
How it works step by step
- Validates on initialisation that the pool pairs exactly the fewToken wrapper with its underlying token and has zero fee
- Blocks all liquidity additions by reverting in beforeAddLiquidity
- Replaces the pool's pricing on swaps with a 1:1 wrap or unwrap executed via fewToken.wrap and fewToken.unwrap
- Uses beforeSwapReturnDelta so the hook's delta is applied to pool accounting instead of an AMM curve
- Grants fewToken an unlimited approval over the underlying token at construction
- Swap behaviour
- Each swap is intercepted in beforeSwap: when swapping in the wrap direction the hook takes the underlying token from the pool manager, calls fewToken.wrap, and settles the wrapper token back; in the unwrap direction it takes fewToken, calls fewToken.unwrap, and settles the underlying token. Both exact-input and exact-output are handled at a 1:1 rate with zero fee.
- Liquidity behaviour
- Adding liquidity always reverts with LiquidityNotAllowed; removing liquidity has no hook callback, so the pool's liquidity is managed only through the wrapper flow.
- Fee behaviour
- Uses the pool's static fee; the pool must be initialised with fee 0 (InvalidPoolFee otherwise) and the hook returns lpFeeOverride 0, so no fee is charged by the hook.
- Owner & admin controls
- No admin controls found. No owner, pause, upgrade or parameter-setting functions are present; fewToken, poolManager, wrapperCurrency, underlyingCurrency and wrapZeroForOne are all immutable.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, beforeSwap, beforeSwapReturnDelta
beforeInitialize validates the pool pair is exactly the wrapper and underlying tokens with zero fee; beforeAddLiquidity unconditionally reverts to block LP deposits; beforeSwap performs the wrap or unwrap in place of the pool's AMM and returns a before-swap delta so the pool accounting is replaced by the 1:1 conversion; beforeSwapReturnDelta enables that delta to override pool accounting.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: No privileged key exists in the hook logic; the only trusted dependency is the fewToken contract, whose owner (not visible here) controls the wrap/unwrap behaviour the hook relies on.
Risk to user funds: The hook briefly holds underlying and wrapper tokens during each swap, taking them from the pool manager and settling the converted amount back; it cannot withdraw funds on its own initiative. Exposure depends on the fewToken contract, which receives an unlimited approval over the hook's underlying balance.
Security findings
- [medium] Trust in external fewToken contract: The hook takes underlying tokens from the pool manager and mints fewToken through an external call, then settles, so any malicious or upgraded fewToken implementation would control the amounts exchanged with the pool.
- [medium] Unlimited approval to fewToken: The constructor grants fewToken an unlimited allowance over the hook's underlying token balance, so a compromised fewToken could pull any underlying tokens held by the hook.
- [low] Hardcoded 1:1 conversion rate: The hook assumes a strict 1:1 ratio between underlying and wrapper tokens (_getWrapInputRequired and _getUnwrapInputRequired are not overridden), which would mis-price swaps if fewToken ever deviates from parity.
- [info] Hook holds and moves swap funds: The hook returns a before-swap delta that overrides pool accounting and uses the take/settle pattern, so the hook itself moves funds on each swap; this is by design but means user funds pass through the hook contract during wrap and unwrap.
Contract details
- Verified source
- Yes (FewTokenHook)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 5,885 bytes
- Upgradeable proxy
- No
- Detected patterns
- return-delta
Pools using FewTokenHook
- fwWBTC / WBTC (0.00% fee) — 24h volume $0, TVL $0, 2 swaps today