Liquidations
A Liquidation is the process where a Vault that fell below the Minimum Collateral Ratio is closed, its funds are withdrawn and the debt paid by an external Participant. Liquidations/Liquidators are key in keeping the stablecoins pegs because their job is maintaining the protocol with enough collateral to back up their price.
When does a liquidation occur?
A Vault's Liquidation is open as soon as the collateral ratio of the Vault falls below the Minimum Collateral Ratio unless the protocol is in Panic Mode (learn more about it here).
The Liquidation occurs when a Liquidator pays out the Vault's debt by depositing the current debt's amount in the stablecoin denomination issued when the Vault was created.
You can calculate your expected profit like this:
DV = Debt Value = $10,000
CD = Collateral deposited = $XLM 115,011.3301124
CP = Collateral price = $0.0936
CN = DV / CP = Collateral needed = $XLM 106,837.6068
FF = Flat fee = 0.005
FP = CP * FF = Fee paid = $XLM 575.0566506
CR = CD - FP = Collateral received = $XLM 114,436.2735
PC = CR - CN = Profit in collateral asset = $XLM 7,598.666662
Profit in terms of stablecoin = PC * CP = $711.2351996
In the example above, a Vault with a debt of $10,000 was in Liquidation mode at a collateral price of $0.0936 and a deposit of $XLM 115,011.3301124. You as a Liquidator, pay back its debt by depositing $10,000 in the Vault's stablecoin denomination and you get back the collateral deposited ($XLM 115,011.330112) minus the current Protocol's fee ($XLM 575.0566506).
You ended up with a total of $XLM 114,436.2735 which is valued at $10,711.2352 and that means you profited from the Liquidation a total of $711.2351996 in terms of your initial deposit.
Can I lose funds while liquidating a Vault?
If you liquidate below 100% of the Collateral Ratio, you will end up with less value in collateral than the one you used to pay the Vault's debt and liquidate it. This scenario is unlike to happen because more Liquidators would have liquidated it already to get the profits.
In order yo avoid such loses we suggest always checking the current Collateral Ratio of the Vault before trying to liquidate it.