Deployment Overview
| Property | Value |
|---|---|
| Network | Ethereum Sepolia testnet |
| Version | v0.3.0 |
| Milestone | M2 (External Testnet) |
| Collateral | MockUSDC (test ERC-20, 6 decimals) |
| Supported Pair | EUR/USD |
| Oracle | Pyth Network (Sepolia) |
Smart Contracts
Eight core contracts plus a Protocol registry are deployed on Sepolia:Shared Infrastructure
- Protocol — Root registry and access control
- Config — All configurable parameters (fees, margins, caps)
- OracleModule — Pyth spot prices + publisher-pushed forward prices
- ModeController — 4-mode operating state machine
- RiskManager — Position, account, and pool-level risk caps
Pool Contracts
- MarginAccounts — Collateral deposits, margin locking, fee collection
- PoolVault — ERC-4626 liquidity pool for LP deposits
- PositionManager — Position lifecycle (open, increase, close, reduce)
- SettlementEngine — Batch settlement, liquidation, early termination
All contracts are immutable (no proxy upgrades). Protocol parameters are adjustable via the Config
contract by the admin role. Contract source is verified on Sepolia Etherscan.
Supported Features
- Trading
- Liquidity
- Oracle & Pricing
- Risk Management
- EUR/USD NDF trading — LONG or SHORT positions
- 3 tenors: 1 Day (86,400s), 1 Week (604,800s), 1 Month (2,592,000s)
- Isolated margin model — each position’s risk is contained to its own locked margin
- Variable leverage up to 50x (2% initial margin requirement)
- Position operations: open, increase, close early, reduce, add/remove margin
- Permissionless settlement — anyone can settle matured positions or liquidate
Off-Chain Services
Publisher (Rust)
Fetches real EUR/USD spot prices from Pyth Hermes API, computes forward prices using interest rate
parity, and publishes them onchain via the OracleModule. Runs on a configurable interval (default:
every 30 seconds).
Keeper (Rust)
Monitors for matured and liquidatable positions. Executes batch settlement and liquidation
transactions. Fully automated with configurable scan intervals.
Frontend (Next.js)
Trading UI built with Next.js, wagmi, viem, and shadcn/ui. Supports wallet connection via
RainbowKit, real-time position monitoring, LP deposit/withdraw, and protocol state display.
Integration Paths
M2 supports multiple ways to interact with the protocol:| Integration | Description | Status |
|---|---|---|
| TypeScript SDK | Type-safe ABIs, enums, and constants (@nile-markets/sdk) | Available |
| Subgraph API | GraphQL queries for positions, accounts, pool state, history | Available |
| CLI Tool | Command-line interface (nile) for all protocol operations | Available |
| MCP Server | Model Context Protocol server for AI agents | Available |
| x402 API | Pay-per-call HTTP API using x402 payment protocol | Available |
| llms.txt | Machine-readable protocol summary for LLM consumption | Available |
Known Limitations
The following limitations apply to the M2 deployment and are planned for resolution in future milestones:Single currency pair
Single currency pair
Only EUR/USD is supported. The contract architecture supports multi-pair registration via
OracleModule.registerPair(), but additional pairs (GBP/USD, USD/JPY) are deferred to M3.Isolated margin only
Isolated margin only
All positions use isolated margin (MarginMode.ISOLATED). Cross-margin support
(MarginMode.CROSS) is defined in the enum but not implemented. Planned for M3.
No holiday calendar
No holiday calendar
Fixing dates do not account for FX market holidays. Only weekends are excluded from the tenor
duration calculation. A proper holiday calendar is planned for M3.
Admin-controlled mode transitions
Admin-controlled mode transitions
Mode changes (Normal, Degraded, Reduce-Only, Paused) are triggered by the admin role. Automated
mode escalation based on oracle health or pool metrics is planned for M3.
No formal audit
No formal audit
The M2 contracts have not undergone a professional security audit. A professional audit with 1-2
independent firms is planned for M3. The test suite includes 550 Foundry tests with 95%+ line
coverage.
MockUSDC collateral
MockUSDC collateral
M2 uses a test ERC-20 (MockUSDC) rather than canonical USDC. Integration with canonical USDC
on mainnet is planned for M3.
No keeper economic incentives
No keeper economic incentives
The keeper service operates without onchain economic incentives (no liquidation rewards or gas
reimbursement). Keeper incentive design is planned for M3.
Single publisher
Single publisher
Forward prices are published by a single authorized publisher. There is no publisher redundancy
or decentralized publisher network. Multi-publisher support is planned for M3.
Related Pages
M3 Plan
What is planned for the mainnet-ready milestone.
Contract Addresses
Current Sepolia deployment addresses.
Quick Start
Get started interacting with the M2 deployment.