Skip to main content
M2 is deployed on two testnets — Ethereum Sepolia (L1) and Arbitrum Sepolia (L2). This is not a production system. All tokens are test tokens with no monetary value. Do not use real funds. Contract addresses, parameters, and behaviors may change between deployments.

Two testnets, complementary coverage

Ethereum Sepolia — L1 fidelity

  • chainId 11155111, ~12 s block time
  • Mainnet-shape gas market dynamics — useful for validating behavior under L1 fee variance
  • The canonical L1 testnet for ecosystem integrations (Pyth, Graph Studio, third-party tooling)
  • Block explorer: sepolia.etherscan.io

Arbitrum Sepolia — L2 fidelity

  • chainId 421614, sub-second blocks
  • Low and steady L2 fee market — useful for validating long-running scenarios and frequent operations
  • Sub-second confirmation latency suits agent integrations that chain many transactions
  • Block explorer: sepolia.arbiscan.io
Both networks run identical contracts with identical protocol parameters. The choice between them is about what you are validating, not about feature differences.

Which testnet should I use?

  • Use Sepolia (L1) when you need: mainnet-shape gas validation, L1 confirmation cadence, ecosystems that already treat Sepolia as canonical, or to validate behavior under L1 fee variance.
  • Use Arbitrum Sepolia (L2) when you need: rapid iteration on agent / MCP / x402 / CLI flows (sub-second confirmation), steady fee dynamics for long-running tests, or L2 cost dynamics in your integration tests.
Switch between them by setting NETWORK=sepolia / NETWORK=arbitrumSepolia in the CLI, or ?network= in the MCP / x402 query parameter, or by switching chains in the connected wallet.

Network trade-offs

PropertyEthereum Sepolia (L1)Arbitrum Sepolia (L2)
chainId11155111421614
Block time~12 s~0.25 s
Tx confirmation latency~12–24 ssub-second
Gas fee dynamicsMirrors mainnet — high variance under loadLower, steadier; rollup batches amortize fee
Settlement modelL1 nativeL2 rollup, settled to Ethereum with batch + challenge window
Block explorersepolia.etherscan.iosepolia.arbiscan.io
Native gas faucetarbitrum.faucet.dev/Sepoliaarbitrum.faucet.dev/ArbSepolia

Deployment overview

PropertyValue
NetworksEthereum Sepolia + Arbitrum Sepolia
Versionv0.3.2
MilestoneM2 (External Testnet)
CollateralMockUSDC (test ERC-20, 6 decimals) on both chains
Supported PairsEUR/USD, USD/JPY
OraclePyth Network (per-chain Pyth deployments)
M2 is the first externally accessible deployment of the Open Nile Protocol. The full protocol feature set is deployed on both testnets with real Pyth oracle prices and automated keeper operations on each.

Smart Contracts

Eight core contracts plus a Protocol registry are deployed on each testnet:

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 each chain’s block explorer.

Supported Features

  • NDF trading on EUR/USD and USD/JPY — LONG or SHORT positions
  • 6 tenors per chain: 1D (86,400s), 1W (604,800s), 1M (2,592,000s), 3M (7,776,000s), 6M (15,552,000s), 1Y (31,536,000s). Tenors are a dynamic uint32-second registry; admins can add or remove via Config.registerTenor/unregisterTenor.
  • 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

1

Publisher

Fetches real EUR/USD and USD/JPY spot prices from Pyth Hermes, computes forward prices using interest rate parity, and publishes them onchain via OracleModule.publishRound (gated on PUBLISHER_ROLE). Deployed per-network — each chain runs an independent publisher targeting that chain’s OracleModule. The publish cadence aligns to the chain’s block-time grid.
2

Keeper

Monitors for matured and liquidatable positions and calls the permissionless SettlementEngine.settle{Position,Batch} / liquidate entry points. Deployed per-network — each chain runs an independent keeper. Poll cadence matches the chain’s block time (~12 s on Sepolia, ~1 s on Arbitrum Sepolia) so liquidation reaction time matches the chain’s confirmation cadence.
3

Frontend (Next.js)

Trading UI built with Next.js, wagmi, viem, and shadcn/ui. Supports wallet connection via RainbowKit, switching between Sepolia and Arbitrum Sepolia, real-time position monitoring, LP deposit/withdraw, and protocol state display.
4

Subgraph (The Graph)

Per-chain subgraph deployment indexes all onchain protocol events into a queryable GraphQL API. Provides historical data, position lifecycle tracking, fee accounting, and pool state history.

Integration Paths

M2 supports multiple ways to interact with the protocol on either testnet:
IntegrationDescriptionStatus
TypeScript SDKType-safe ABIs, enums, and constants (@nile-markets/sdk)Available
Subgraph APIPer-chain GraphQL queries for positions, accounts, pool state, historyAvailable
CLI ToolCommand-line interface (nile) — --network arbitrumSepolia or --network sepoliaAvailable
MCP ServerModel Context Protocol server for AI agents — network parameter per tool callAvailable
x402 APIPay-per-call HTTP API — ?network= query parameterAvailable
llms.txtMachine-readable protocol summary for LLM consumptionAvailable

Known Limitations

The following limitations apply to the M2 deployment and are planned for resolution in future milestones:
EUR/USD and USD/JPY are registered on both testnets. The contract architecture supports arbitrary multi-pair registration via OracleModule.registerPair(); additional pairs (GBP/USD, USD/CHF, …) are deferred to a later M2 patch or M3.
All positions use isolated margin (MarginMode.ISOLATED). Cross-margin support (MarginMode.CROSS) is defined in the enum but not implemented. Planned for M3.
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.
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.
The M2 contracts have not undergone a professional security audit. A professional audit with 1-2 independent firms is planned for M3. Audit scope will cover the contracts deployed on both Sepolia and Arbitrum Sepolia — bytecode is identical. The test suite includes 550 Foundry tests with 95%+ line coverage.
M2 uses a test ERC-20 (MockUSDC) on both testnets rather than canonical USDC. Integration with canonical USDC on mainnet is planned for M3.
The keeper service operates without onchain economic incentives (no liquidation rewards or gas reimbursement). Keeper incentive design is planned for M3.
Forward prices on each chain are published by a single authorized publisher. There is no publisher redundancy or decentralized publisher network. Multi-publisher support is planned for M3.

Architecture Decision

Why M2 supports two testnets, and the L1 vs L2 trade-offs in long form.

Contract Addresses

Current deployment addresses per chain.

Quick Start

Get started interacting with the M2 deployment.