Arc TestnetTestnetDEMO
Start

Architecture

Two on-chain contracts on Arc, a small off-chain price pipeline, a Next.js app, and Circle's cross-chain token path for inventory.

xStocks price API
      |  poll every 5s
      v
 price service (SQLite, /api/price, /api/candles)
      |  push if price moves >0.1% or every 60s
      v
 relayer ---> PriceOracle (Arc) ---> InventoryMarket (Arc) <--- trader (USDC)
                                          ^
        mNVDA (Sepolia) --lock--> wNVDA (Arc) deposited as inventory
                 Bridge Kit + Circle CCTPx

Contracts on Arc

  • PriceOracle. Holds the latest price, publish time and session. Only authorised relayers can update it. Guards reject non-positive prices, wide confidence, non-increasing publish times and moves above a per-update deviation cap.
  • InventoryMarket. Holds USDC and wNVDA, quotes and executes buy and sell, applies spreads, caps and exposure limits. It has owner functions to deposit, withdraw, set parameters and pause.

Addresses are on Contracts. Sources are in contracts/arc/src, compiled with solc 0.8 (cancun, optimizer 200). A separate contract, the mock provider token mNVDA, lives on Sepolia in contracts/sepolia/src, with Foundry tests for its accounting.

Oracle and relayer

The relayer (services/price/relayer.mjs) is a small Node process. It reads the price service and calls updatePrice on the oracle. It is a trusted component: the oracle does not verify the price itself. Details are in Oracle and price.

Price service

services/price/server.mjs polls the xStocks NVDAx price endpoint every 5 seconds, stores each tick with our receive time in SQLite, and serves /api/price, /api/candles and /api/ticks. It runs as a systemd unit behind Caddy. The upstream returns only a number with no timestamp and has no history API, which is why we ingest ticks ourselves.

App

A Next.js App Router app (TypeScript, wagmi and viem). It reads quotes, inventory and trades straight from the Arc contracts, reads the price from the price service for the chart, and sends buy and sell transactions from an injected wallet. When a wallet connects, the app moves it to Arc. The app also hosts the landing page, the bridge page and these docs.

Bridge

Inventory moves between Sepolia and Arc through Circle's cross-chain token service (CCTPx) using Bridge Kit, by token id. The library in packages/bridge wraps Bridge Kit behind typed ports and is tested against mocks. The /bridge page in the app has the full interface and its client now calls Bridge Kit through a connected browser wallet. That path has not been tested in a browser yet. See Bridge.

Design records

Decisions are written as ADRs in docs/adr in the repository (asset model, bridging path, inventory market, price parity, compliance stance). Some early ADRs were superseded; the status line at the top of each says so.