Reactive Network: Automated cross-chain liquidation monitoring via a Reactive Smart Contract (RSC) deployed on Reactive Lasna. The RSC subscribes to 5 hook events, maintains a shadow position registry, and triggers auto-liquidation callbacks to PerpHingeCallback on Unichain — replacing off-chain keeper bots with fully on-chain automation.
Unichain: Deployed on Unichain Sepolia, leveraging 200ms Flashblocks for ~300 TWAP observations per minute (60x improvement over Ethereum mainnet) for more accurate mark price discovery.
Github:https://github.com/big14way/PerpHinge Slides: Project Link:https://perphinge.vercel.app Demo Video:https://youtu.be/ZJHs2Ld4G-8?si=raUhMHekeZH5BNkM
There is no native on-chain perpetual futures DEX on Unichain. LPs providing liquidity to Uniswap v4 pools have no way to hedge their impermanent loss, and traders looking for leveraged exposure must bridge funds to other chains. Meanwhile, Unichain's 200ms Flashblocks provide uniquely fast settlement — an ideal environment for derivatives — but no protocol takes advantage of this. "Perp DEXs built with hooks" is one of Unichain's most-requested application types, yet none existed. PerpHinge solves this by building a complete perpetual futures engine entirely within a single Uniswap v4 Hook, leveraging the existing pool infrastructure for mark price discovery rather than deploying a separate protocol.
PerpHinge is the first perpetual futures DEX built entirely as a Uniswap v4 Hook — not a fork, not a wrapper, but a new DeFi primitive that lives inside the pool itself. What makes it unique: (1) The TWAP mark price is computed entirely from afterSwap tick observations with a custom 180-slot ring buffer — no external keeper or oracle needed for mark price. (2) Unichain's 200ms Flashblocks generate ~300 observations per minute vs ~5 on Ethereum mainnet, providing 60x more accurate TWAP data. (3) Funding rates settle automatically on every swap callback — no cron jobs needed. (4) Liquidations are automated cross-chain via Reactive Network RSC, replacing centralized keeper bots with fully on-chain infrastructure. This demonstrates that complex DeFi derivatives can be built as composable hook primitives rather than standalone protocols, opening the door for hedging tools, structured products, and risk management directly within Uniswap v4 pools.
The biggest challenge was mining a valid hook address via CREATE2 salt search — the hook address must encode the correct permission bits (AFTER_INITIALIZE | BEFORE_SWAP | AFTER_SWAP), requiring brute-force salt mining against Forge's deterministic deployer. Building a custom TWAP oracle was also non-trivial since Uniswap v4 removed the built-in oracle from v3 — we implemented a 180-slot ring buffer with tick-cumulative tracking from scratch. Getting funding rate math correct required careful handling of WAD precision (1e18) alongside USDC's 6-decimal representation, and ensuring funding settlements happen atomically before any position changes. The Reactive Network integration required designing a two-chain architecture (RSC on Lasna + Callback on Unichain) and working around the fact that the Reactive indexer doesn't yet support Unichain Sepolia event delivery. Finally, ensuring the afterSwap callback never reverts (which would brick the entire pool) required defensive try/catch patterns around Pyth oracle calls.