Uniswap v4 hook that auctions the first trade at stock-market reopen and pays the bid to LPs
Tokenized stocks like NVDA trade on-chain 24/7, but the real market closes overnight and on weekends. When it reopens, the pool price is stale, and the first arbitrageur trades at the old price and takes the gap straight from LPs.
Reopen Auction Hook fixes that exact moment. When the market reopens, a keeper starts an auction on the pool. Normal swaps are paused for a few blocks while the price for the right to make the first trade falls every block (a Dutch auction). The first arbitrageur to accept pays the bid and makes their swap in the same transaction, moving the pool to the real price. The bid is donated straight to the pool's LPs. If nobody bids, the auction times out and the pool reopens on its own, so it can never get stuck.
Why not just raise fees? A fee only returns a capped slice of the gap. Fables' NVDA/USDG pool, for example, caps its elevated fee at 0.8%, and gaps smaller than the fee leave the pool stale. An auction has no cap: arbitrageurs compete for the gap, so LPs get what it is worth, and the price is fixed immediately.
Replaying the real NVDA Friday close to Monday open gap of [X%]: vanilla LPs lose [$A], a Fables-style fee recovers [$B], and the auction recovers [$C] ([Y%] of the gap). The replay assumes competitive bidders; our testnet demo has one bidder.
Roadmap: a single-token LP vault where users deposit one asset and are protected at every market reopen, plus per-pool reopen loss analytics.
Built with Foundry on the Uniswap v4-template. The hook uses only the beforeSwap permission, with no return-delta flags, so it never changes swap amounts and is friendly to routers.
Core contract: ReopenAuctionHook.sol holds a two-phase state machine (OPEN, AUCTION). startAuction(refPrice) can only be called by the authorised keeper. currentPrice() decays linearly per block. bidAndSwap() is the trick worth mentioning: the hook acts as its own router. It takes the winner's bid, calls PoolManager.unlock, executes the winner's swap inside unlockCallback, then calls PoolManager.donate() to pay the bid to in-range LPs, all in one transaction. During an auction, beforeSwap rejects every swap whose sender is not the hook itself, so the only way to trade is to win the auction. Bidding and swapping atomically also means nobody can win and then not trade. A timeout reopens the pool if nobody bids.
Testing: Foundry scene tests cover normal trading, the auction blocking swaps, keeper-only access, the bid reaching LPs, and timeout recovery, plus fuzz tests on bid size and timing. A replay test reproduces a real NVDA weekend gap and compares a vanilla pool, a Fables-style elevated fee (up to 0.8%) and the auction.
Deployment: hook deployed to [chain/testnet] with HookMiner to get the permission-flag address, with mock xNVDA/USDG tokens and a pool. [Keeper: TypeScript + viem script that detects the market reopen and calls startAuction.] [Chainlink CRE workflow reads market session and reference price and writes the report that starts the auction.] [Frontend: React page showing pool phase, the falling auction price and the bid paid to LPs.]
Uniswap v4 made this possible: hooks let us gate swaps for one moment, and donate() gives a native way to pay LPs without new accounting.

