Qubic DEX is a proof of concept decentralized exchange built on the Qubic Network. It demonstrates how traders can connect their wallets, deposit crypto as collateral, and open leveraged long or short positions directly on-chain. The system uses smart contracts written in C++ to handle four main modules: 1️⃣ **CollateralVault** — manages user deposits and withdrawals. 2️⃣ **PositionManager** — records trades and calculates profit/loss. 3️⃣ **PriceOracle** — feeds real-time market prices to the contracts. 4️⃣ **LiquidationEngine** — monitors open positions and force-closes trades if they reach unsafe loss levels. On the frontend, the app uses **Next.js**, **React**, and **Tailwind CSS**, with WalletConnect and an optional **MetaMask Snap** for signing transactions securely. Users can view live price charts, open new positions, track liquidation prices, and monitor their order history — all through a sleek, modern UI. This project shows how Qubic’s custom RPC network, WebSockets, and wallet integrations can be combined to build a fully on-chain DEX with leverage trading, liquidation protection, and simple on-ramp/off-ramp logic — ready to expand for more assets or advanced trading features in the future.
8 Jul 2025