Smart Contract Topology
Nyxor separates market operations into five modular contract layers:Component Roles
1. MarketSchedule (MarketSchedule.sol)
- Encodes real-world equity market trading hours (default 14:30–21:00 UTC Mon–Fri).
- Manages
PRE_CLOSEwarning windows (1 hour prior to close) andREOPEN_COOLDOWN(15 minutes post-open). - Enforces full weekend closures (Saturday and Sunday).
2. MarketClock (MarketClock.sol)
- Returns
effectiveNow(). In production, this proxiesblock.timestamp. - In
demoMode == true, allows governance/keeper addresses to warp timestamps across phase boundaries to demonstrate market transitions deterministically.
3. MarketHoursRiskPolicy (MarketHoursRiskPolicy.sol)
- Dynamically evaluates maximum allowable leverage based on
MarketSchedule.phaseAt(timestamp). - Tightens leverage linearly from 20x down to 5x during
PRE_CLOSE. - Restricts trading to
reduce-onlyduringCLOSED.
4. PerpMarket (PerpMarket.sol)
- Manages isolated-margin perpetual positions, opening/closing trades, and liquidations.
- Queries the risk policy before order execution: transactions exceeding the active leverage or open interest caps revert.
5. LiquidityVault (LiquidityVault.sol)
- Pools institutional margin collateral (
USDx). - Underwrites trader profits and absorbs liquidations.
- Features isolated accounting between the Standard (Naive) and Guarded vaults to demonstrate solvency differentials.