How It Works

Roles

There are two roles in the Mystic RFQ process:

  • The Solver - the RFQ participant that is providing short-term liquidity for the issuer;

  • The Manager - the issuer or platform that has created the auction and can set its parameters: the premiums the Solvers receive, what entities can participate in each auction (e.g. US entities only), if the auction is public or private.

To note that Solvers only engage with Managers and vice-versa. Mystic never touches any asset.

Process Overview

There are 4 stages to the lifecycle of an auction on Mystic via the RFQ API, namely:

  1. Detection - Mystic adds an instant redemption request or money market liquidation to its feed, for Solvers to see;

  2. Order Submission - Solvers send Mystic their bids;

  3. Solver Selection - Mystic assesses all bids and chooses the best one;

  4. Settlement - Winning bid settles the outstanding opportunity.

All of this happens in milliseconds, giving the users an instant UX. Let us now look at each step in more detail:

1. Detection

The protocol continuously monitors requests by instant redemption partners and the relevant money market accounts to be liquidated. In the case of liquidations, when an account’s Health Factor reaches < 1, it is flagged as liquidatable and added to our API feed. As for instant redemption requests, when an integrated Manager receives a request, that request is then echoed to Solvers via the Mystic API.

2. Order Submission

Solvers query the feed, evaluate available RFQ opportunities and respond with signed RFQ orders (via POST /rfq-order). Orders use token permits so Solvers don’t need to transfer tokens upfront.

3. Solver Selection

Mystic evaluates all quotes and selects the best order for each opportunity (read, best price). To note, multiple RFQ fills may occur per opportunity.

4. Settlement Contract Flow

Settlement can occur for either liquidations or for instant redemptions. Let's first look at the flow for liquidations for a Morpho market, which will happen atomically through a flashloan:

  1. Mystic selects the best RFQ order(s) for the underwater account;

  2. Via Bundlerarrow-up-right, Mystic calls GeneralAdapter.morphoFlashloan() to borrow the amount needed to repay the outstanding debt;

  3. Inside the flashloan callback, Morpho.liquidate(account, borrowedAsset, collateralAsset, amount) is called using the flash-borrowed funds, which releases the position's collateral;

  4. Still inside the callback, Mystic calls the RFQ contract's 0xSettlement.fillRFQOrder(order, sig) with the winning Solver's bid and token permit, effectively giving them the trade and sending them the position's collateral in exchange for the position's debt asset (e.g. USDC);

  5. Mystic repays flash loan with the assets received from Solver;

  6. Fees are distributed to the Solver minus a protocol fee;

  7. Solver redeems the collateral for their original asset (optional).

As for the case of an instant redemption, the flow is much simpler:

  1. Mystic selects the best RFQ order(s) for instant redemption request;

  2. Mystic calls the RFQ contract's 0xSettlement.fillRFQOrder(order, sig) with the winning Solver's bid and token permit, effectively giving them the trade and sending them the asset to be redeemed in exchange for their assets (e.g. USDC);

  3. Fees are distributed to the Solver minus a protocol fee;

  4. Solver redeems the redeemed asset for their original asset (optional).

Last updated