Architecture and Workflow
Last updated
Last updated
A liquidity provider (LP) supplies assets to Aqua (for example, 10 $WBTC).
Market makers provide collateral and are assigned credits from Aqua to hold long or short positions in Aqua. Other than borrowing from Aqua, makers can also use their own capital to fulfil orders that come through Native.
User (Taker) connects his wallet and uses the trading GUI on any of the protocol which has integrated with Native to send trade (alternatively the order may be coming from a connected aggregator such as 1inch). He specifies the assets, the chains and desired amount and asks for an indicative quote.
Market makers will respond with a quote that they are willing to sell at and the best quote is shown on the user's GUI.
If the user accepts the quote, the user will commit to the swap by clicking the Swap button triggering a request for firm quote
The market maker providing the quote will sign to confirm that the quote, assets involved and amount are correct.
All information will be shown to the user before he signs off the transaction in his wallet.
There are three possible scenarios:
The maker settles the trade using borrowed capital from Aqua. In this case, the exchange of assets will be done directly between Aqua and the user without any asset transfer to the market maker. A respective long and short position will be opened in the winning market maker's ledger.
The maker settles the trade using his own capital. In this case, Aqua is not used, and assets are exchanged between maker and taker in accordance with the signed transaction.
The maker settles the trade by borrowing capital from Aqua with their own collateral. In this case, the maker needs to indicate the amount of assets to borrow, which are then exchanged directly between Aqua and the user. A respective long and short position will be opened in the maker's ledger. The exchange of the remaining amount occurs between the maker's inventory and the user.
(Optional) Market makers hedge their beta exposure on CEXs, with a position opposing their risk exposure with Aqua.
The trading cycle completes, with the user receiving their token, Aqua holding inventory and custody on balance of the trade and Market makers with both long and short positions opened, gaining risk exposure in Aqua. As a result, market makers hedge in CEXs to reduce this risk.
At T0, Aqua starts off with an inventory balance of K.
At T1, when a user makes a swap, Aqua transacts directly with the user based on the pricing provided by PMM1 and associates this trade with PMM1, updating the balance of PMM1 for long/short on each involved token. All token custody stays within Aqua. PMM1 will hedge their risk exposure in Aqua by opening opposite positions in CEX.
At T2, PMM1 deposits all of their tokens in short position into Aqua in exchange for all of its tokens in long position, resulting in a multiple-to-multiple swap between PMM and Aqua, and clearing of its credit line.