> For the complete documentation index, see [llms.txt](https://docs.uniocean.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uniocean.io/protocol-and-infrastructure/protocol/risk-management.md).

# Risk Management & Incentives

## Risk Monitoring and Exposure Controls

* **Market-Wide Open Interest (OI) Caps:** The protocol establishes a strict upper bound on systemic exposure via a `MaxMarketOpenNotional` parameter. The state machine strictly validates the core OI invariant (*OI\_long ≈ OI\_short*).
* **Per-Account Position Sizing:** The network enforces a `MaxPositionNotional` cap at the subaccount level to prevent excessive concentration by a single entity.
* **Pre-Execution Margin Validation:** Before a derivative limit order is considered valid for matching, the protocol evaluates its margin sufficiency against the absolute latest Oracle mark price.
* **On-Chain Risk Index:** The module maintains a highly optimized, queryable "Risk Index" that categorizes active positions by their margin health (equity versus maintenance requirement).

## Circuit Breakers and Emergency Halts

* **Global Trading Halts:** Governance can explicitly toggle global execution flags, instantly disabling all order entry and matching for the entire Spot or Derivatives ecosystem.
* **Per-Market Gating:** Individual markets can be isolated and paused. Governance can intervene to suspend a specific market or aggressively adjust its Initial and Maintenance Margin Ratios (IMR/MMR) to force deleveraging.
* **Emergency Settlement:** In severe crisis scenarios (such as an irrecoverable Oracle failure), governance can bypass standard lifecycle phases and execute an Emergency Settlement at a manually provided price.

## Liquidation Engine

Uniocean employs a hybrid liquidation architecture, supporting both manual execution payloads submitted by third-party liquidators and a native automated fallback engine.

### Dual-Case Settlement Logic

1. **Positive Equity (Healthy Liquidation):** If collateral remains after closing the position, the protocol extracts a liquidator reward and an Insurance Fund contribution directly from the surplus margin. Any remaining equity is safely returned to the trader.
2. **Negative Equity (Bankruptcy):** If the position clears at a deficit, the market's Insurance Fund injects capital to cover the loss, ensuring the winning counterparty is fully paid while still compensating the liquidator.

## Trading Incentives

* **Tiered Fee Discounts:** Dynamic maker and taker fee discounts based on actively staked Uniocean tokens combined with rolling 30-day trading volume. Discount tiers are cached with a TTL boundary for state machine performance.
* **Automated Reward Campaigns:** Epoch-based trading reward campaigns where market participants accumulate reward points proportional to their trading volume. At campaign conclusion, the protocol automatically distributes assets pro-rata to traders based on accumulated points.
