lib-base.trove.collateralratioisbelowcritical

Home > @mosaic/lib-base > Trove > collateralRatioIsBelowCritical

Trove.collateralRatioIsBelowCritical() method

Whether the collateralization ratio is less than the CRITICAL_COLLATERAL_RATIO at a given price.

Signature:

collateralRatioIsBelowCritical(price: Decimalish): boolean;

Parameters

ParameterTypeDescription

price

Returns:

boolean

Example

Can be used to check whether the Mosaic protocol is in recovery mode by using it on the return value of getTotal(). For example:

const total = await mosaic.getTotal();
const price = await mosaic.getPrice();

if (total.collateralRatioIsBelowCritical(price)) {
  // Recovery mode is active
}

Last updated