Trades
The execution of trades involves many components of both the Variational Protocol and the Omni app.
Quotes
Variational uses a request-for-quote (RFQ) system: users announce their intention to open a trade, and have the option to accept or reject any subsequently provided quotes. Within Omni, quotes are always provided by the Omni Liquidity Provider (OLP).
Settlement Pools
Settlement pools are smart contracts created and maintained by the Variational protocol that hold margin for both parties involved in a peer-to-peer trade. Within Omni, settlement pools always contain margin from the user (taker) and OLP (maker).
Flow of a Trade
Trades are executed through the following flow:
User requests a quote from the Omni Liquidity Provider (OLP) by interacting with the Omni frontend.
OLP provides the user with a quote.
If the user wishes to accept the quote from OLP and open a position, they can submit the trade.
The Omni frontend relays this information to the Omni backend, which verifies the user's authentication token, performs a variety of risk checks, ensures that the user has enough free collateral in their account for the trade, and ensures that the final fill price is not outside of the user's defined slippage tolerance.
If all checks pass, the trade enters a sequential order queue on the Omni backend.
Once the trade is first in the que, the Variational protocol's margin & liquidation engine will check to see if OLP has enough margin in the user's settlement pool for the trade. If it does not, the treasury manager will deposit OLP funds into the settlement pool to act as margin for the trade.
Once both the user and OLP have posted enough margin into the settlement pool, the trade is considered cleared and open, and is tracked on the Omni backend.
Now that the trade is open, the margin & liquidation engine will periodically check to ensure the position has enough margin on both sides. If the user is liquidated, both the user and OLP's initial margin will be withdrawn from the settlement pool and returned to the OLP vault. If OLP is liquidated, OLP's initial margin is added to the user's initial margin and the treasury manager refills OLP's margin to continue covering its initial position.
Simultaneously, the settlement & funding rate engine will periodically calculate and track funding rates and payments associated with the position, which are managed inside the settlement pool.
Last updated