Skip to main content
The Open Nile Protocol is an onchain, vault-based counterparty system for synthetic non-deliverable forward (NDF) FX contracts. Traders take long or short positions on future exchange rates against a shared USDC liquidity pool. Every trader profit is a pool loss and vice versa — a zero-sum design that eliminates the need for order book matching or peer-to-peer counterparties.

How the Protocol Works

The protocol manages the full lifecycle of a forward contract onchain through seven coordinating smart contracts. Here is the journey from collateral deposit to settlement:
1

Deposit Collateral

A trader deposits USDC into their MarginAccounts balance. This is the available collateral from which initial margin will be locked when opening positions. Separately, LPs deposit USDC into the PoolVault (an ERC-4626 vault) to provide counterparty liquidity.
2

Open a Position at the Forward Price

The trader calls PositionManager to open a long or short position for a chosen tenor (1D, 1W, or 1M). The OracleModule provides the current forward price for that maturity — computed off-chain using interest rate parity and published onchain by the authorized publisher. RiskManager applies pricing adjustments (spread, premium/discount) and enforces exposure caps. The resulting entry price (strike) is locked immutably for the life of the position, and initial margin is reserved from the trader’s balance.
3

Mark-to-Market PnL Tracking

While the position is open, unrealized PnL is computed by comparing the locked entry price against the latest forward price for the same maturity. No margin is settled during this period — PnL is informational until the position closes. If the trader’s equity (locked margin + unrealized PnL) drops below maintenance margin, the position becomes eligible for liquidation.
4

Manage: Increase, Reduce, or Early-Close

Traders can increase notional (adding more margin), partially reduce the position (settling proportional PnL), or early-terminate before maturity (settling full PnL plus a termination fee). Each action goes through PositionManager or SettlementEngine with fresh oracle validation.
5

Maturity and Fixing Price

At 4:00 PM UTC on the maturity business day, the Pyth EUR/USD spot price is captured as the fixing price. This is the settlement anchor — once recorded, it is permanent and the same for all positions maturing at that timestamp.
6

Settlement

The SettlementEngine settles matured positions using the fixing price. Final PnL is computed, fees are deducted, and the net amount transfers between the trader’s MarginAccounts and the PoolVault. The position is closed and margin is released. Anyone can call settlement — the keeper automates this, but the contracts are permissionless.
7

Zero-Sum Redistribution

Every USDC that a trader gains comes from the pool, and every USDC a trader loses goes to the pool. Fees collected during the position lifecycle accrue to the pool, creating a structural edge for LPs over time. Bad debt (when a trader’s loss exceeds their margin) is absorbed by the pool.

What You’ll Find in This Tab

This tab covers the protocol’s mechanics, risk controls, and technical details. It is organized into four sections:

Quick Reference

Core Design Principles

Zero-sum pool model, isolated margin, immutable contracts, and how it differs from order books and perps

Oracle & Forward Pricing

Pyth spot prices, interest rate parity forward computation, fixing prices, and staleness rules

Position Lifecycle

Open, increase, reduce, close, settle — the full journey of a forward position

Margin Model

Isolated margin with variable leverage from 1x to 50x

Settlement

Maturity settlement using the fixing price, permissionless execution

Protocol Assumptions

Business, technical, and operational premises underlying the protocol