LendingHookV4 on Ethereum

Uniswap v4 Hook Contract 0x09fb534c79c2f43f4d1efe0ddf9096716b7ffacc on Ethereum · Custom pricing · Verified contract

Volume (24h)
$0
Value locked (TVL)
<$0.01
All-time volume
$10.97K
Pools using this hook
1
Swaps (24h)
0 (0 traders)
Total swaps
615

What it does

A community-funded lending market on a Uniswap v4 ETH/TOKEN pool where LPs deposit into a full-range position and borrowers lock TOKEN to borrow ETH at 40 percent LTV, with liquidations refilling the pool.

How it works step by step

  • Holds a single full-range V4 ETH/TOKEN position that LPs deposit into and withdraw from as ERC20 shares.
  • Lets borrowers lock TOKEN as collateral and receive ETH at 40 percent LTV, with a pro-rata TOKEN amount pulled from the pool and held as loan reserve.
  • Accrues interest on borrows using a utilization curve whose rate is locked per position at borrow time.
  • Allows anyone to liquidate positions whose collateral value falls below 150 percent of debt, paying the debt in ETH for TOKEN at a 2.5 percent discount, and refills the pool.
  • Skims 0.5 percent protocol fees on swaps and 50 percent of origination fees to FeeCollector, with the rest accruing to LPs.
Swap behaviour
Swaps are standard V4 pool swaps with a 0.5 percent LP fee plus a 0.5 percent protocol skim to FeeCollector. External swaps revert in any block where a liquidation has occurred. Swap activity updates the lending price snapshots used by borrow and liquidate.
Liquidity behaviour
LPs deposit ETH and TOKEN at the effective pool ratio and receive ERC20 share tokens; the hook holds a single full-range V4 position. Withdraw burns shares against effective pool value (realETH plus outstanding debt) and reverts if liquidity is currently lent out. Deposits and withdrawals are blocked in the block of a liquidation and withdrawals require a 2-block holding cooldown that resets on share receipt.
Fee behaviour
Pool LP fee is a static 0.5 percent (5000 pips) auto-accrued to the V4 position. A protocol skim of 0.5 percent of input on buys (beforeSwap) and of the unspecified leg on sells (afterSwap) is sent to the hardcoded FeeCollector. Borrowers pay a 1 percent origination fee on debt, half to FeeCollector and half re-donated to LPs. Interest accrues on borrows at a utilization-based rate capped at 100 percent APR. Liquidators get a 2.5 percent collateral discount.
Owner & admin controls
Single privileged role 'deployer' (set to the constructor caller, typically a factory). It can only call setDeployer to hand the role to another address or burn it by setting address(0). No pause, no upgrade proxy, no parameter setters; all economic constants are immutable or constant. initializePool is permissionless but one-shot and bounded.

Enabled Uniswap v4 callbacks

beforeInitialize, afterInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta

beforeInitialize: enforces the canonical PoolKey (native ETH and the token, hooks = this). afterInitialize: no-op. beforeAddLiquidity / beforeRemoveLiquidity: revert for any sender other than the hook itself, so only the hook manages the position. beforeSwap: blocks external swaps in a liquidation block, captures price snapshots, and skims the protocol fee on ETH-in buys. afterSwap: records the swap block, re-syncs realETH/realToken from V4 state, and skims the protocol fee on sells via a returned unspecified delta. beforeSwapReturnDelta and afterSwapReturnDelta: needed so the hook can take fees via returned deltas.

Security & trust assessment

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

Who controls it: The deployer key can only reassign or burn itself; it cannot move funds, change fees, pause swaps or upgrade the contract. Risk is limited to the one-time initialization path, which is guarded against re-entry and invalid prices.

Risk to user funds: The hook custodies all pooled ETH and TOKEN in the V4 position plus per-user collateral and loanReserveToken. It can transfer funds to FeeCollector (swap skims, origination cut, dust), to borrowers on borrow and to liquidators on liquidation. Admin cannot seize or freeze these balances, but a pricing or rounding bug could misallocate them.

Security findings

  • [medium] Pool-spot-based oracle for borrow and liquidation: Lending and collateral valuation read a snapshot price (prevSnap) during the swap-activity window and the live pool ratio otherwise. Spot is a pool-internal ratio, so large pumps can distort valuation within the lag window, mitigated by utilization caps and the 2-block SAFE_LAG.
  • [low] Approximate interest and rounding dust: Interest accrual uses a linear approximation that under-accrues slightly over long periods, and the liquidation, borrow and withdraw paths depend on V4 rounding and dust routing to FeeCollector.
  • [low] Rounding-sensitive settlement paths: Liquidation and repay can leave unsettled-dust residuals; multiple V4 rounding paths were hand-tuned (under-shoot by 1 unit) rather than formally proven.
  • [info] Bad debt socialized to LPs: Hook-held reserve is a single full-range position; in a bad-debt scenario collateral below debt is socialized to LPs via the refill mechanism rather than covered by any insurance buffer.
  • [info] Single deployer key with transfer power only: The deployer role can be burned to address(0) or handed to a new address; no timelock or multisig is enforced by the contract itself.

Contract details

Verified source
Yes (LendingHookV4)
Compiler
solc 0.8.26+commit.8a97fa7a
Bytecode size
23,930 bytes
Upgradeable proxy
No
Detected patterns
donates, erc20, liquidity-management, moves-currency, return-delta, self-unlock

Pools using LendingHookV4