0x07 · project

LiqOS

Uniswap V4 Hook

LiqOS

An auction-based JIT liquidity rebalancer implemented as a custom Uniswap V4 hook — eliminates LPs manually chasing price.

01 · Requirement Analysis

Uniswap V3 concentrates liquidity so tightly that LPs must manually rebalance ranges as price drifts — a constant, error-prone chore. The brief: a transparent, automated mechanism that rebalances liquidity mid-trade without custodial loss.

02 · Architecture Discovery

Explored the V4 hook lifecycle (beforeSwap / afterSwap / afterModifyLiquidity) and the unlock-callback flash-accounting model. Settled on a per-swap auction held inside the hook, with transient storage (EIP-1153) recording net deltas only within a single swap.

03 · Software Architecture

Three collaborating modules: the hook contract (entry + delta accounting), an auction market (Dutch-price, JIT) that matches an incoming swap against live bids, and a router adapter that triggers the rebalance before settlement.

04 · Development Principles

Gas-aware deltas via transient storage rather than persistent SSTORE; flash-accounting ensures every borrow is repaid in the same unlock window; reentrancy and repay guards on every entry point; fuzz/invariant tests around the auction.

05 · Impact

LPs earn JIT fees without manual repositioning; swaps route against freshly rebalanced liquidity for tighter effective price; the design generalizes to any V4 pool with minimal added gas.

AUCTION HOOK LIQ