LendingHookV3 on Ethereum
Uniswap v4 Hook Contract 0x3cc9707a9b6dfbbb72e2bfeddc341f7de9cbbacc on Ethereum · Liquidity management · Verified contract
- Volume (24h)
- $193
- Value locked (TVL)
- $6.25K
- All-time volume
- $401.77K
- Pools using this hook
- 1
- Swaps (24h)
- 6 (6 traders)
- Total swaps
- 11,184
What it does
A community-funded ETH/TOKEN lending market where LPs deposit into a single full-range Uniswap v4 position for share tokens, and borrowers lock TOKEN as collateral to borrow ETH at 40 percent LTV, with liquidators able to close underwater positions.
How it works step by step
- Accepts ETH and TOKEN deposits at the current pool ratio and mints ERC20 LP share tokens against a single full-range V4 position.
- Lets borrowers lock TOKEN collateral and borrow ETH at 40 percent LTV, withdrawing a proportional amount of the LP so pool spot is held roughly constant.
- Charges a 1 percent origination fee on borrows, splitting it 50/50 between feeCollector and LPs (donated back to the pool).
- Allows permissionless liquidation when collateral value falls below 150 percent of debt, paying the liquidator collateral at a 2.5 percent discount and refilling the LP.
- Skims a 0.5 percent protocol fee on every swap in beforeSwap or afterSwap, and blocks external swaps in liquidation blocks.
- Restricts pool creation and all third-party liquidity modifications to the hook itself.
- Swap behaviour
- On buys (ETH in), beforeSwap takes 0.5 percent of the input as protocol fee to feeCollector. On sells (TOKEN in), afterSwap takes 0.5 percent of the ETH output to feeCollector. afterSwap also records lastSwapBlock and resyncs internal ETH and TOKEN mirrors from pool state. External swaps are blocked in any block where a liquidation occurred.
- Liquidity behaviour
- Deposit requires ETH and TOKEN at the current pool ratio within 0.1 percent tolerance and mints ERC20 shares (first deposit burns 1000 shares to dead address). Withdraw burns shares for pro-rata ETH and TOKEN from the V4 full-range position. Liquidity is modified only through the hook's own unlock actions; external modifyLiquidity calls are rejected in beforeAddLiquidity/beforeRemoveLiquidity.
- Fee behaviour
- Pool LP fee is a static 0.5 percent (5000 pips) accrued to LP position by V4. Hook skims an additional 0.5 percent protocol swap fee on buys in beforeSwap and on sells in afterSwap, sent to feeCollector. Borrow origination fee is 1 percent of debt with 50 percent to feeCollector and 50 percent donated back to LPs. Position close fee is a flat 0.01 ETH on full repay. Liquidators receive a 2.5 percent discount on collateral.
- Owner & admin controls
- Owner (set at construction) can only call initializePool once to set the starting sqrtPriceX96, and can renounceOwnership to zero the owner. No pause, no upgrade proxy, no fee or parameter setters; constants are immutable and feeCollector/token/poolManager are immutable.
Enabled Uniswap v4 callbacks
beforeInitialize, afterInitialize, beforeAddLiquidity, beforeRemoveLiquidity, beforeSwap, afterSwap, beforeSwapReturnDelta, afterSwapReturnDelta
beforeInitialize restricts pool creation to this hook with ETH/TOKEN key. afterInitialize is a no-op. beforeAddLiquidity and beforeRemoveLiquidity block all third-party LPs. beforeSwap skims protocol fee on buys and blocks external swaps in a block where a liquidation occurred. afterSwap records lastSwapBlock, resyncs realETH/realToken from V4 state, and skims protocol fee on sells. beforeSwapReturnDelta and afterSwapReturnDelta allow the hook to take fee amounts from the swap delta.
Security & trust assessment
Risk level: medium (verified source, high confidence).
Who controls it: Owner can only set the initial pool price once and then renounce; owner cannot pause, change fees, seize funds, or upgrade. feeCollector address is fixed at construction and receives all protocol fees and excess funds.
Risk to user funds: The hook holds all pool ETH and TOKEN in the V4 position and in its own balance (collateral and loan reserve tokens). Borrowers' collateral is locked in the contract and returned only on repay or sent to the liquidator. Protocol and excess funds are routed to feeCollector. No admin path can move user funds directly, but spot-price manipulation and accounting drift are the main loss vectors for LPs and borrowers.
Security findings
- [medium] Spot-based oracle for LTV and liquidation: Position valuation and borrow sizing use realETH/realToken, which are resynced from V4 spot on each swap. A large swap in the same block as a borrow is blocked by lastSwapBlock, but spot can still be moved by swaps in prior blocks and by the owner-chosen initial price.
- [medium] Accounting mirror can drift from V4 position: realETH and realToken are mirrors that depend on fee accrual and rounding; liquidations and withdrawals cap decrements to tracked amounts, so surplus fees or rounding differences can silently drift accounting between the mirror and the actual V4 position.
- [medium] Bad debt socialised to LPs: Liquidation discount and bad-debt handling: when collateral is below debt the bot payout is capped at collateral, so the protocol absorbs shortfall into the LP via refill logic. Losses are socialised across LP share value rather than reserved.
- [low] Same-block lockout can block trading and withdrawals: Swaps, deposits and withdrawals revert in any block where a liquidation has occurred, which can be used by a liquidator or MEV actor to temporarily block trading and LP exits for one block.
- [info] One-time owner price setting: Owner renouncement is irreversible and the single initializePool call sets the starting price; a mispriced initial pool can be arbitraged against LP deposits until corrected.
Contract details
- Verified source
- Yes (LendingHookV3)
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Bytecode size
- 21,978 bytes
- Upgradeable proxy
- No
- Detected patterns
- donates, erc20, liquidity-management, moves-currency, return-delta, self-unlock
Pools using LendingHookV3
- ETH / sato (0.50% fee) — 24h volume $193, TVL $6.25K, 6 swaps today