# Oracle Integration

### Oracle Integration

The Symmio Options Protocol uses secure, decentralized price feeds to power settlement, liquidation, and real-time solvency checks. Its oracle system is built on the **Muon Network**, which provides cryptographically verified price data using a distributed validator set.

## Muon Network

* **Threshold Signature Scheme (TSS):** Prevents single points of failure.
* **Schnorr Signatures:** Enables efficient multi-party signature verification.
* **Gateway Validation Layer:** Adds an off-chain signature from a trusted gateway.
* **Decentralized Validation:** Multiple validators must agree on price updates.

## Oracle Architecture

| Component              | Purpose                                           |
| ---------------------- | ------------------------------------------------- |
| **MuonOracle**         | Main on-chain oracle contract for price delivery  |
| **Schnorr Verifier**   | Performs cryptographic verification of signatures |
| **Gateway Signature**  | Ensures a second, trusted source signs data       |
| **SettlementPriceSig** | Encapsulates verified price + metadata for trades |

## Verification Process

```solidity
function verifyTSSAndGW(
    bytes32 _data,
    bytes calldata _reqId,
    SchnorrSign calldata _signature,
    bytes calldata _gatewaySignature
) external view;
```

1. **TSS Verification:**

   Uses Schnorr signatures and public key matching to validate data from Muon.
2. **Gateway Signature:**

   Validates an additional ECDSA signature from a trusted gateway signer.
3. **Integrity Checks:**

   Confirms request freshness, symbol correctness, and data authenticity.

#### Key Integration Points

**1. Trade Settlement**

* Prices are verified during trade execution.
* Verified price is used to calculate PnL and finalize trades.

**2. Liquidation Triggers**

* Collateral prices and unrealized PnL are validated before liquidation.
* Oracle data ensures fair execution and risk isolation.

**3. Real-Time Risk Monitoring**

* Party-level PnL is updated using oracle-verified snapshots.
* Enables automated flagging of risky accounts.

## Role in Liquidation Lifecycle

| Phase     | Oracle Role                                             |
| --------- | ------------------------------------------------------- |
| Flagging  | Real-time collateral valuation for solvency checks      |
| Execution | Provides final settlement prices and deficit validation |
| Closure   | Supports asset redistribution based on verified values  |

## Oracle Data Flow

<figure><img src="https://1257875949-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYQhBmTCs9MwhhuPQrV5v%2Fuploads%2Fx6ILa3DkMQx8JKVHz9Ur%2Fimage.png?alt=media&#x26;token=8da28ce7-53b1-4934-a8af-58599250a49e" alt=""><figcaption></figcaption></figure>
