DeathSTRHookV2 on Ethereum
Uniswap v4 Hook Contract 0xb7945204f1f72b3adffb166b09f52a027a122fcc on Ethereum · Dynamic fee · Verified contract
- Volume (24h)
- $0
- Value locked (TVL)
- $11.43K
- All-time volume
- $3.47M
- Pools using this hook
- 1
- Swaps (24h)
- 0 (0 traders)
- Total swaps
- 14,614
What it does
A Uniswap v4 hook for the ckToken/ETH pool that charges a configurable fee (default 10%, max 20%) on each swap, converts non-ETH fees to ETH and forwards them to a fee collector.
How it works step by step
- Restricts the pool to pairs of native ETH and the ckToken and caches the PoolKey at initialization
- Rejects exact-output swaps in beforeSwap and afterSwap
- Takes a percentage fee (default 10%, max 20%) on each non-excluded swap via poolManager.take
- Converts non-ETH fee amounts to ETH with an internal swap in the same pool
- Forwards the ETH fee to DeathSTRCollector, which splits it among team wallets and the treasury
- Calls enterSwap and exitSwap on the ckToken around swaps and liquidity changes
- Swap behaviour
- Exact-output swaps are rejected. Each swap calls enterSwap on the ckToken, then after the swap takes a percentage of the non-specified currency as a fee, converts it to ETH if needed through the same pool, forwards ETH to DeathSTRCollector, emits Trade, and calls exitSwap. Excluded senders skip the fee path.
- Liquidity behaviour
- Before and after add/remove liquidity the hook calls enterSwap and exitSwap on the ckToken, which act as a guard flag on the token; no fees are taken on liquidity operations and no return deltas are returned.
- Fee behaviour
- A configurable fee (default 10%, hard capped at 20% of 10000 bips) is taken from the non-specified currency of each swap via poolManager.take into the hook; non-ETH fees are swapped to ETH through the same pool and the ETH is forwarded to the DeathSTRCollector. Addresses flagged as excluded pay no fee.
- Owner & admin controls
- Owner (Ownable) can set fee up to a 20% cap via setFee, change feeCollector via setFeeCollector, manage fee exclusions via setExcludeFromFees, and recover any ERC20 or ETH held by the hook via withdrawStuck. Owner can renounce or transfer ownership. No pause or upgrade mechanism on the hook itself.
Enabled Uniswap v4 callbacks
beforeInitialize, beforeAddLiquidity, afterAddLiquidity, beforeRemoveLiquidity, afterRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize validates the pool pairs ckToken with ETH and caches the PoolKey. beforeSwap reverts on exact-output swaps and calls enterSwap on the token. afterSwap takes the fee, forwards ETH to the collector, emits Trade and calls exitSwap. beforeSwapReturnDelta and afterSwapReturnDelta are enabled because afterSwap returns a fee amount as a delta the hook keeps. Liquidity hooks before and after add/remove only toggle enterSwap/exitSwap on the token.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: The owner can raise or lower the fee up to 20% on every swap, redirect future fees by changing feeCollector to any non-zero address, exempt any address from fees, and withdraw any token or ETH sitting in the hook at will. Because the hook calls enterSwap/exitSwap on the ckToken, the token's behaviour during swaps depends on that external contract, which is not analysed here.
Risk to user funds: The hook takes a percentage of the output-side token on each non-excluded swap and holds it briefly before forwarding ETH to the collector, so user funds on swaps are exposed to the fee rate and to any revert in the collector or the ckToken. The owner can withdraw hook balances at any time.
Security findings
- [medium] Owner-adjustable swap fee without timelock: Owner can set the fee anywhere from 0 to 20% via setFee and can immediately affect all future swaps, with no timelock.
- [medium] Owner can withdraw hook balances: withdrawStuck lets the owner transfer any ERC20 or ETH balance of the hook; fees pending conversion or residual pool funds can be drained by the owner.
- [medium] Dependency on external token guard calls: The hook relies on IDeathSTRTokenV2.enterSwap/exitSwap on the ckToken during every swap and liquidity action; if that token reverts or is malicious, swaps and liquidity operations through the pool can be blocked.
- [low] Nested swap during afterSwap: afterSwap calls _swapToEth, a nested poolManager.swap through the same pool when the fee currency is the ckToken, and then settles and takes output tokens; this reentrant pattern deserves close review.
- [medium] Swaps blocked if collector rejects ETH: Fee proceeds are pushed to the DeathSTRCollector with a low-level ETH call; if the collector reverts or is paused, the swap afterSwap path reverts and blocks trading.
Contract details
- Verified source
- Yes (DeathSTRHookV2)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 7,295 bytes
- Upgradeable proxy
- No
- Detected patterns
- dynamic-fee, moves-currency, ownable, return-delta
Pools using DeathSTRHookV2
- ETH / DEATHSTR (0.00% fee) — 24h volume $0, TVL $11.43K, 0 swaps today