Limit orders
Place an order at a price on TSLA/USDG, NVDA/USDG, QQQ/USDG or ETH/USDG. A swap that crosses your price fills it; cancel any time, claim the output.
How an order works
A limit order is liquidity in one tick-spacing range on the far side of the current price, holding only the token you sell. A sell order sits above the price, a buy order below. When a swap moves the price through the whole range, the order has been converted into the other token: it is filled. While the price is inside the range it earns the pool's swap fee like any LP.
Placing
On Limit orders or from a pool card in Live swaps, pick the pool, the side, the price in USDG and the amount. The page shows the range the order covers and its average fill price; one tick spacing is 0.6% on the hook stack pools and 0.1% on ETH/USDG. A price that is already reached is refused: use a swap.
Fills and claims
Anyone can lock a crossed order with fill(id): its liquidity is pulled and the output held for the owner, so a price move back does not undo the fill. The keeper locks crossed orders every hour. The owner calls claim(id), which locks first if needed, and cancel(id) any time before, getting back what is left of both tokens.
Why not a hook in the stack
A pool's hook is fixed at creation, and stacked v4 hooks run with a gas limit that is too small to move liquidity inside a swap. The LimitOrders contract works on the pools as they are, through the PoolManager, so every v4 Marketplace pool and the ETH/USDG v4 pool take orders today.
First fill
Order #0 sold 0.0002 TSLA on TSLA/USDG in the range of ticks -216,240 to -216,180 (406.71 to 409.16 USDG per TSLA, 407.93 on average) and received 0.081831 USDG after a USDG to TSLA swap crossed it: 409.16 USDG per TSLA, the range average plus the swap fee the order earned while it was crossed. The MCP tool is place_limit_order and the SDK method placeLimitOrder().