Limit orders hook on Ethereum

Uniswap v4 Hook Contract 0x2a6c4fa316411e75cbb1e9297fde851cc8645040 on Ethereum · Limit orders

Volume (24h)
$0
Value locked (TVL)
$0
All-time volume
$0
Pools using this hook
2
Swaps (24h)
0 (0 traders)
Total swaps
0

What it does

A Uniswap v4 hook that lets users place limit orders on a pool, which are filled automatically when swaps cross their tick.

How it works step by step

  • Records the last lower tick per pool when the pool is initialized (afterInitialize).
  • Lets users place limit orders at a chosen tick and direction via placeOrder, with order ids derived from the pool key, tick and direction (getOrderId).
  • Fills crossed orders after each swap in afterSwap, using per-tick, per-direction liquidity accounting.
  • Lets makers cancel unfilled orders with cancelOrder and withdraw filled proceeds with withdraw.
  • Exposes getUserInfo and getOrderInfo views for reading a user's position and order state.
Swap behaviour
After each swap, afterSwap checks which ticks were crossed and executes resting limit orders on the opposite side against the swap, settling the tokens through the PoolManager.
Liquidity behaviour
Its beforeAddLiquidity, beforeRemoveLiquidity, afterAddLiquidity and afterRemoveLiquidity callbacks are dispatched but not enabled by the hook permissions, so liquidity changes are not intercepted; liquidity is held by the hook as placed limit orders rather than by the pool.
Fee behaviour
Uses the pool's static fee.
Owner & admin controls
No admin controls found.

Enabled Uniswap v4 callbacks

afterInitialize, afterSwap

afterInitialize: initializes per-pool tick bookkeeping (tickLowerLast) when a pool is created. afterSwap: detects ticks crossed by a swap and fills resting limit orders on the opposite side, moving the output tokens via the PoolManager.

Security & trust assessment

Risk level: medium (decoded bytecode, medium confidence).

Who controls it: No privileged owner or admin role is visible in the dispatched functions, so the risk is limited to contract logic rather than a key that can change parameters.

Risk to user funds: The hook holds tokens for open limit orders and moves them to fillers and to users on fill, cancel and withdraw through the PoolManager; funds could be affected by any bug in the unverified order accounting, but no admin key appears able to seize or block them.

Security findings

  • [info] Hook custodies user order funds: The hook implements a limit-order book with placeOrder, cancelOrder and withdraw, and settles tokens through the PoolManager (unlock, take, transfer, transferFrom), so it holds user deposits while orders are open.
  • [medium] Fills executed in afterSwap callback: Order fills happen inside afterSwap by calling the PoolManager, so a swap's gas cost and reentrancy surface depend on the number of resting orders crossed.
  • [medium] Unverified order accounting logic: Withdrawal and cancellation depend on the order id and stored per-order liquidity mappings (slots 2 to 4); correctness of these paths cannot be verified without source.
  • [low] No verified source: Only the decoded bytecode is available; the source is unverified, so the exact fill, rounding and access checks are inferred from selectors and storage layout.

Contract details

Verified source
No
Bytecode size
12,504 bytes
Upgradeable proxy
No
Detected patterns
moves-currency, self-unlock

Pools using Limit orders hook