Orbital Hook
A Uniswap V4 Hook implementing a custom spherical AMM curve for efficient stable asset swaps.
Problem Statement
Orbital leverages Uniswap V4 Hooks to introduce a new primitive for stablecoin liquidity: the Spherical AMM. Unlike standard pools that rely on hyperbolic curves x.y=k or fragmented ticks, Orbital implements a custom pricing invariant based on high-dimensional spherical geometry.This design creates a naturally "flatter" price curve, ideal for pegged assets, reducing slippage without requiring active tick management. By mathematically defining liquidity as a "radius" rather than a tick range, we unlock higher capital efficiency and lay the groundwork for future multi-asset pools where USDC, DAI, and USDT can share a single liquidity surface. This project demonstrates how V4 Hooks can be used to completely replace the underlying AMM math while retaining the Uniswap interface.
Solution
I built Orbital as a Uniswap V4 Hook that overrides the default AMM logic. The notable "hack" in our architecture is the "Hook-as-Vault" pattern: I bypass the standard PoolManager's tick system entirely. Instead, our Hook contract manages its own reserves and implements an embedded ERC-4626 vault to handle LP shares.We utilize the beforeSwap hook with the BEFORE_SWAP_RETURNS_DELTA flag to hijack the swap flow. Inside the hook, we use Solady's optimized fixed-point math library to solve the spherical intersection formula (R-x)^2 + (R-y)^2 + (R-z)^2 = L^2 in real-time. This allows us to calculate the exact output based on our custom curve and settle the trade using V4's Flash Accounting, effectively replacing the V4 "engine" (math) while keeping the "chassis" (router).
Hackathon
ETHGlobal Buenos Aires
2025
Prizes
- 🏆
Uniswap v4 Stable - Asset Hooks1st place
Uniswap Foundation
Contributors
- Dhruv-2003
6 contributions