NINEDocs
Launching on Elysium
Open app
Developers

Contracts

Planned · subject to audit

The planned public interfaces for NinePerps, NineVault and NineOracle. They show how the protocol is meant to be called; they are not deployed code.

Addresses

ContractElysium (99901)
NinePerpsPublished at launch on the official site and X only
NineVault (nUSD)Published at launch on the official site and X only
NineOraclePublished at launch on the official site and X only
$NINEPublished at launch on the official site and X only

INinePerps

Two-step trading: requestOpen / requestClose record the request at time t; fill executes it with a price whose hcTs is in [t + D, t + D + W]. fill, liquidate and takeProfit are permissionless.

INinePerps.solsolidityPlanned
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title INinePerps — requests, fills, positions, liquidation, take-profit.
/// @notice Planned · subject to audit. Not deployed. Signatures may change.
interface INinePerps {
    enum Side { Long, Short }
    enum Kind { Open, Close }

    struct Position {
        address owner;
        bytes32 market;      // e.g. keccak256("BTC")
        Side    side;
        uint128 margin;      // USDC, 6 decimals
        uint32  leverage;    // 1 … 999, capped by NineRisk
        uint128 entry;       // HyperCore mark at fill, 1e8
        uint64  openedAt;    // block timestamp (ms)
    }

    event Requested(uint256 indexed id, address indexed trader, bytes32 indexed market, Kind kind, uint64 t);
    event Filled(uint256 indexed id, uint256 indexed positionId, uint128 price, uint64 hcTs);
    event Expired(uint256 indexed id, uint128 refunded);
    event Closed(uint256 indexed positionId, uint128 price, int256 pnl, uint256 fee, bool takeProfit);
    event Liquidated(uint256 indexed positionId, address indexed liquidator, uint128 price, uint256 leftover);

    /// Open request. Fills only at a price with hcTs in [t + D, t + D + W].
    function requestOpen(bytes32 market, Side side, uint128 margin, uint32 leverage) external returns (uint256 id);

    /// Close request for an open position. Same future-price rule.
    function requestClose(uint256 positionId) external returns (uint256 id);

    /// Anyone may fill. Reverts outside the window or if a price check fails.
    function fill(uint256 id) external;

    /// Anyone may liquidate once equity <= 10% of margin.
    function liquidate(uint256 positionId) external;

    /// Anyone may trigger once pnl >= 9 * margin.
    function takeProfit(uint256 positionId) external;

    function position(uint256 positionId) external view returns (Position memory);
}

INineVault

Deposits mint nUSD immediately. Withdrawals are queued to the current 72-hour epoch and claimed after it ends.

INineVault.solsolidityPlanned
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title INineVault — USDC vault (ERC-4626 style), LP token nUSD.
/// @notice Planned · subject to audit. Not deployed. Signatures may change.
interface INineVault {
    event Deposit(address indexed caller, address indexed receiver, uint256 assets, uint256 shares);
    event WithdrawRequested(address indexed owner, uint256 shares, uint64 indexed epoch);
    event WithdrawClaimed(address indexed owner, uint256 shares, uint256 assets, uint64 indexed epoch);

    /// Deposit USDC, mint nUSD at the current share price.
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);

    /// Queue shares for the current 72 h epoch.
    function requestWithdraw(uint256 shares) external returns (uint64 epoch);

    /// Redeem queued shares after the epoch ends, at the share price at that time.
    function claim(uint64 epoch) external returns (uint256 assets);

    function totalAssets() external view returns (uint256);

    /// beta * TVL minus current worst-case payout on the net side.
    function payoutHeadroom() external view returns (uint256);
}

INineOracle

One read returns everything the risk engine needs. read reverts if any sanity check fails, so a bad price can never reach a fill.

INineOracle.solsolidityPlanned
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title INineOracle — HyperCore mark, mid, oracle and depth, with sanity checks.
/// @notice Planned · subject to audit. Not deployed. Signatures may change.
interface INineOracle {
    enum Mode { SignedKeeper, Precompile } // v0, v1 (switch behind the timelock)

    struct Price {
        uint128 mark;        // 1e8
        uint128 mid;         // 1e8
        uint128 oracle;      // Hyperliquid oracle, 1e8
        uint128 depthBid;    // USD depth within -10 bps
        uint128 depthAsk;    // USD depth within +10 bps
        uint64  hcBlock;
        uint64  hcTs;        // HyperCore timestamp (ms)
    }

    /// Reverts unless: now - hcTs <= 1,000 ms; |mark - mid| / mark <= 15 bps;
    /// |mark - oracle| / mark <= 50 bps.
    function read(bytes32 market) external view returns (Price memory);

    function mode() external view returns (Mode);
}

Units and conventions

  • USDC amounts use 6 decimals. Prices use 1e8.
  • Timestamps are milliseconds, to match HyperCore's hcTs.
  • Markets are identified by bytes32 keys.

Running a keeper

Keepers are permissionless: watch Requested events and new blocks, call fill on the first eligible block, and call liquidate or takeProfit when a position crosses. Liquidators earn half the leftover equity.

Last edited 2026-12Docs v0.1Launching on Elysium