UniPerp

A decentralized perpetual futures DEX on Uniswap v4 with vAMM, oracle pricing & lower funding rates.

UniPerp

Created At

ETHGlobal New Delhi

Winner of

ETHGlobal

ETHGlobal - 🏆 ETHGlobal New Delhi 2025 Finalist

Uniswap Foundation

Uniswap Foundation - Build with Uniswap v4 Hooks 2nd place

Project Description

UniPerp is a next-generation perpetual futures exchange built entirely on-chain, leveraging Uniswap v4 hooks to embed perpetual markets directly into liquidity pools. Instead of depending on external market makers or fragmented order books, UniPerp implements a virtual AMM (vAMM), where a constant product formula is applied to virtual reserves. This approach enables traders to open leveraged positions without requiring external liquidity providers. As a result, UniPerp achieves higher capital efficiency, lower trading costs, and strong resistance to MEV attacks, while ensuring that every trade remains verifiable on-chain.

For traders, the platform offers a familiar but enhanced experience. They can take leveraged positions of up to 20× across major crypto markets, with spreads kept tight because liquidity is virtual rather than fragmented. Collateral management is also simplified through a unified margin vault. Instead of maintaining separate margin balances across multiple markets, users deposit USDC once, and that single account supports collateralization across all perpetual pairs. This unified model improves capital efficiency and makes risk management easier.

Positions on UniPerp are tokenized as NFTs. Each open position is minted as an ERC-721 token that encodes a trader’s leverage, entry price, and margin. This makes positions transferable, composable with other DeFi protocols, and fully on-chain. A trader can move or sell their position as easily as any other NFT, while also gaining the possibility of using it in lending, vaulting, or other composable applications.

Price stability between perpetuals and spot markets is maintained through dynamic funding rates. UniPerp derives a robust mark price from both the vAMM state and external oracle feeds, such as those provided by the Pyth Network. Funding payments between longs and shorts are adjusted continuously on-chain, ensuring that perp prices remain closely aligned with spot markets without needing delayed settlement cycles.

Risk management is enforced through a layered safety framework. A liquidation engine continuously monitors positions and closes trades that become undercollateralized. If extreme volatility pushes losses beyond margin coverage, an insurance fund backstops the system and ensures that profitable traders are paid in full. As a last-resort mechanism, UniPerp employs auto-deleveraging (ADL), which redistributes risk by partially closing profitable positions if system solvency is at stake.

A core design priority of UniPerp is protection against MEV (Maximum Extractable Value). Across Ethereum, MEV has siphoned billions through sandwich attacks, front-running, and oracle manipulation. UniPerp addresses this problem at multiple layers. Orders are routed through a private execution layer, shielding them from the public mempool until finalized. This prevents MEV bots from inferring trade direction or size and executing sandwich strategies. Inside Uniswap v4 hooks, UniPerp is able to intercept trades in real time, run flash-loan and collateral checks, and reject abnormal flows before they settle. These safeguards ensure a secure execution path enforced at the protocol level.

Further, UniPerp extends trustless verification beyond execution by integrating zk-TLS proofs with Lighthouse. Every off-chain event, whether it is a price oracle read, a keeper liquidation, or a funding update, is accompanied by a zero-knowledge proof. These proofs are published to Lighthouse, producing an immutable audit trail. Sensitive details remain private, but correctness is always cryptographically provable. This ensures that UniPerp is not just decentralized in architecture but also verifiable in operation.

By combining Uniswap v4’s extensibility, virtual AMMs, continuous funding, and zk-secured MEV protection, UniPerp introduces a perpetual futures exchange purpose-built for DeFi. It achieves capital efficiency by eliminating idle liquidity, lowers fees by removing the need for incentivized external LPs, and guarantees provable correctness through zk-TLS and Lighthouse proofs. Most importantly, it provides an execution environment that is resistant to hidden MEV costs. Together, these features make UniPerp a scalable, efficient, and trust-minimized alternative to traditional perpetual futures platforms.

How it's Made

UniPerp makes leveraged perpetual trading trustless and safer by addressing the three core challenges of DEX perpetuals:

Capital efficiency & composability — Instead of real liquidity providers, UniPerp uses vAMMs (constant-product on virtual reserves) embedded in Uniswap v4 hooks. This gives realistic price impact and tight spreads without draining on-chain liquidity, enabling lower fees and better capital usage for both traders and market makers.

Robust price integrity & funding — Per-market FundingOracles compute a resilient mark price as the median of multiple sources (the vAMM mid-price, an external oracle TWAP such as Pyth, and a spot DEX TWAP). Funding rates are derived from the deviation between perp price and spot price using a clamped formula (e.g., clamp(k*(mark−spot)/spot + base, ±cap)), and a global cumulative funding index is used to apply funding to positions.

MEV, manipulation & liquidation safety — UniPerp layers active defenses: (a) ZK-protected dark-pool flow to hide order sizes (a ZK proof verifies amounts without revealing them to the public mempool), (b) Uniswap v4 hooks that intercept and validate swaps mid-execution (blocking suspicious inflows or flash-loan attacks), (c) a Deviation Band Gap policy (see below), and (d) an Insurance Fund + ADL backstop for bad debt.

->Deviation Band Gap (the 5% rule) : explicit & central

To limit arbitrage windows and reduce MEV amplification, UniPerp enforces a Deviation Band Gap: the protocol targets keeping the vAMM perp price within ±5% of the underlying spot price (configurable, but 5% is the working threshold). Mechanisms when deviation breaches the band:

Automatic hedging by the Insurance Fund: If vAMM deviates beyond 5%, the insurance fund (or a designated hedge module) can open offsetting spot/perp positions to push prices back toward parity (e.g., short the underlying spot against a large long that caused the gap).

Throttle / Pause & intervention: If hedging would exceed insurance capacity (or repeated breaches occur), the protocol may temporarily throttle large trades in the affected market or pause new opens to prevent further destabilization.

Fee/funding adjustments: Funding multipliers and fees can be increased dynamically to incentivize rebalancing by traders.

Why this prevents MEV: By making excessive vAMM/spot divergence costly and actively hedging imbalances, the protocol reduces the profit motive for sandwich and manipulation attacks that rely on persistent price misalignment.

->Core components (concise)

Uniswap v4 Pool + Hook (vAMM Engine): The hook stores virtual reserves, runs the perp pricing formula on every swap, executes risk checks, computes fees and PnL, and calls MarginAccount/PositionManager. Hooks let us intercept and validate swap inputs (blocking flash-loan attacks and malicious flows mid-swap).

MarginAccount (USDC Vault): Single ledger where all collateral, PnL settlements, funding payments, and insurance flows happen. Keeps free vs locked balances per user.

PositionManager (ERC-721): Tokenized positions; each NFT stores owner, market, signed size, entry price, margin, and last funding index. NFTs are updated with partial changes and burned on close—enabling composability and easy on-chain references for liquidations.

FundingOracle: Produces mark price and funding rate via composite sources (vAMM mid, Pyth, DEX TWAP). Updates a cumulative funding index (e.g., hourly via keepers). Funding applied on position updates or via periodic settlement.

Insurance Fund: Receives fees, liquidation penalties, and possible net funding receipts. Used to cover shortfalls, perform hedges when the 5% band is breached, and reward keepers. Target size configurable (example: $5M).

PerpsRouter: Single UX entrypoint that validates margin, encodes intent, and performs the atomic swap → hook → position update flow in one transaction.

Off-Chain Keepers / Liquidators: Monitor maintenance margin ratios and call liquidate(positionId) when threshold crossed. Keeper-triggered liquidations execute via the vAMM and pay a reward + penalty which feeds the insurance fund.

zk-Protected Dark Pools & Lighthouse zk-TLS: Off-chain trade intents, keeper actions, and oracle reads are recorded with zk-TLS proofs in Lighthouse. This provides verifiable attestations that external inputs are genuine (e.g., Pyth reads or keeper computed funding updates) without revealing sensitive order data greatly reducing MEV info leakage while keeping auditability.

background image mobile

Join the mailing list

Get the latest news and updates