Technical Overview
Off-chain orderbook and risk engine
The orderbook and matching engine component of the system lives off-chain. This component receives maker and taker orders combined with their associated signatures and matches orders appropriately. Once matched the orders are pushed to the on-chain smart contracts described below. All orders are evaluated based on their validity as an order and the sub-accounts ability to make the trade given their margin. The off-chain risk engine is responsible for being aware of a sub-accounts margin to determine whether new positions can be opened or if the subaccount is unhealthy and must be liquidated. The off-chain system is also responsible for posting accurate index prices, mark prices and funding amounts. The offchain engine has no control of user funds and a user can deposit and withdraw at any time. A withdrawal may not be processed if a user's margin account is unhealthy or withdrawing would make the user's margin account unhealthy.
For in-depth technical details of the API and Infrastructure deployments refer to API Integration Docs
On-chain settlement and risk engine
Within the rysk smart contracts, all of the user state is stored. This represents the ground truth on which the entire system operates, thus it is not possible for the system to misrepresent or move funds without permission of the user or unless health requirements are violated. All final settlements and balance changes ultimately occur on chain facilitated by orders and actions pushed up by the off-chain engine.
Last updated