Technical Details
Last updated
Last updated
Liquidations are a method to protect both the health of the platform and the user. All users' positions are monitored frequently to determine the health of their positions with respect to current market conditions as is described in the Dynamic Risk Management section above.
The Ratio Risk Analysis engine continually monitors the health of each user vault by tracking the market price of the LP, the fair price as determined by the balance of the pool, and the slippage incurred if the position must be liquidated.
When a position becomes unhealthy a message is sent to the Ratio Finance application which alerts the user in their vault. It is important that users also sign up for our Dialect notification system which will send alert messages by email, text message, and/or telegram. When a liquidation notification is received users can add more collateral or pay back some debt to their vault to avoid liquidation. The amounts to deposit or payback to return to a healthy position are displayed in the user vaults. If the vault health reaches the liquidation threshold, the vault will be partially liquidated in an amount that will bring the vault to a healthy position with some buffer to avoid cascading liquidations.
When a liquidation event is triggered for a vault, the contract will harvest the user rewards and remove a portion of the LP from the yield farm determined by the Ratio Risk Analysis engine. The LP will be unwound into its underlying assets on the corresponding AMM. Rewards and assets will then be sold into USDr via the cheapest route on Jupiter. The majority of the USDr will be burned to cover the vault debt and bring the vault back to a healthy position. The remaining USDr (the fees calculated in advance) will be sent to the Ratio treasury. The user vault LP and debt positions will then be updated.
In the case that USDr is off-peg at a price greater than 1 USD, the protocol will sell the assets into USDC instead of USDr. The USDC tokens will be held in a reserved treasury vault specifically the back the excess USDr on the market.
In times of low liquidity the liquidation engine may be switched to a manual process as an emergency measure taken by the Ratio Finance team. The liquidation engine may also default to manual liquidation if for some reason, e.g., multiple failures to complete asset swaps on Jupiter, the full liquidation process fails to complete.
The process for manual liquidation is still monitered in the usual manner of the liquidation engine, meaning that user vaults are monitered for unhealthy collateral to debt positions and LP tokens and rewards are removed from yield farms and unwound into underlying assets. Instead of automatically being swapped on Jupiter for USDr, the assets are sent to a dedicated liquidation treasury. The corresponding user debt is then cleared from the vault account. The assets are sold manually by the Ratio Finance team and the resulting USDr is then burned.