The Shutdown module is not available in Probity V1


Shutdown is an action that will stop normal operations of Probity, calculates the current system balances and allow holders of system currency to redeem for a share of the collateral assets up to the pegged value of the system currency.

Step 1: Initiate Shutdown

When shutdown is initiated, shutdown state of all the core probity contracts will be set to true. Essentially stopping all normal operation. At this step, we also store finalUtilizationRatio , the utilization ratio at the time shutdown is initiated.

Step 2: Set final asset prices

For each asset, a final asset price must be set after shutdown has been initiated. This price will be used in calculating asset's value and check whether vaults are under collateralize.

Step 3: Process under collateralize vaults

While the debt positions holders are required to maintain a collateral ratio that is above 100%, they are only obligated to give assets up to the value of the debt amount. So, any collateral assets from debt positions holders up to the debt amount is grabbed by the shutdown and the rest is freed to be withdrawn by the user.
During this process, it is important to process all under collateralize vaults. This will help determine how much under the peg the system currency is based on current positions.

Step 4: Wait until auctions are finished

During the shutdown, new auctions are not allowed to start but the existing auctions will keep on going and since the result of auction will affect the final accounting. Probity should wait until all auctions are finished.
Governance address can control the auction wait period which should help make sure the all the auctions are properly finished before moving to the next step

Step 5: Use reserve to fill in gaps

By this step, shutdown module should have processed all under collateralize vaults and auctions should be ended. We should know the system currency gap caused by under collateralize vaults and finalized system debt and system reserve
If there are system reserve , these should be used to settle the system debt first, and any extra should be used to fill the system currency gap .

Step 6: Calculate equity position holder obligation and process User Equity position

After Step 5 is completed and system currency gap is zero, this step should be skipped. In the case that the gap is non zero, the equity position holder's asset (that is used to mint system currency) will be used to fill the gap. To achieve this, we first need to calculate the obligationRatio . This is calculated as follow:
Equity position * final utilization Ratio * ( gap / total system currency)
Once the obligationRatio is cacluated, all equity position holder's vault should be processed to fill the gap.

Step 7: Calculate Redeem ratio

By this step, we should know the final coll gap and total supply .
We calculate the redeem ratio for each asset as following:
(Theoretical max coll - coll gap) / total supply
** Theoretical max collateral is debt positions opened using this asset divided by final asset price

Step 8: Redeem collateral

During this step, user who has returned the system currencies will be able to redeem each assets based on the redeem ratio.

Step 9: Redeem BondTokens

This step can only take place if system reserves is non zero after step 5.
This allows bond token holder to redeem a share of the system reserves or up to the face value of the bondToken.