Health
Last updated
Last updated
The information provided by Aloe Labs, Inc. (“we,” “us” or “our”) on docs.aloe.capital (the “Site”) is for general informational purposes only. All information on the Site is provided in good faith, however we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information on the Site.
Under no circumstance shall we have any liability to you for any loss or damage of any kind incurred as a result of the use of the site or reliance on any information provided on the site. Your use of the site and your reliance on any information on the site is solely at your own risk.
Borrower
health is a key parameter in Aloe II. Borrower
s must be healthy after any actions taken in Borrower.modify
's callback, and if they become unhealthy over time (due to interest accrual, price movement, or IV increase), they can be liquidated. This page explains the variables that go into health and how it's calculated so that you can understand BalanceSheet.isHealthy
and BalanceSheet.computeLiquidationIncentive
.
Borrower
s understand three types of assets:
Raw TOKEN0
, i.e. any amount of TOKEN0
owned by the Borrower
Raw TOKEN1
, i.e. any amount of TOKEN1
owned by the Borrower
Uniswap V3 Positions in Borrower.UNISWAP_POOL
, which are made up of TOKEN0
and/or TOKEN1.
The amount of each token varies with price.
To save gas, uncollected earned fees are not included as assets
The Borrower
can own and manage as many Uniswap positions as you want, but only the ones stored in slot0
will count as assets. slot0
can hold up to 3 positions.
It'd be straightforward to count Lender
shares as assets too (simply calling lender.underlyingBalance
), but that increases risks for lenders and makes liquidations more complicated.
Borrower
s can borrow from LENDER0
and/or LENDER1
. Those borrows are augmented by the need for a liquidation incentive (at most ×1.05) and a small leverage constraint (always ×1.005).
To be solvent, total assets must be greater than total liabilities:
In some cases we only care about the total value of the position, in terms of TOKEN1
. In those cases, we can simplify like so:
All of these equations are implemented in the LiquidityAmounts
library.
The liquidationIncentive
is based on the assets that a liquidator would have to swap in order to repay all debt:
For example, if an account has 100 TOKEN0
as collateral, and (for some reason) borrows 50 TOKEN0
, the incentive would be 0. The debt can be repaid in-kind; no swap is necessary, so the liquidator doesn't need to be compensated for inventory risk.
If, on the other hand, the account had borrowed TOKEN1
, the incentive would be non-zero. Before repaying the debt, the liquidator would have to swap the collateral (TOKEN0
) for TOKEN1
. They must be compensated for slippage and/or inventory risk.
Regardless of the incentive, the Borrower
's ante is used to pay for liquidators' gas costs.
Checking solvency at the current price is insufficient-by the time it detects danger, it's too late to do anything about it. Instead, we want to consider future prices and make sure the Borrower
is solvent in all "likely" scenarios. Implied volatility (IV) allows us to do just that.
With Black-Scholes assumptions, the daily IV represents one standard deviation of price movement in a 24 hour period. Aloe has nSigma = 5
by default, meaning it considers 5 standard deviations of price movement. This number defines a "likely" scenario and is governable on a per-market basis.
Given IV and nSigma
, it's easy to calculate Probe Prices:
To be healthy, a Borrower
must be solvent at both Probe Prices. If it isn't, it can be liquidated.
Uncollected Uniswap fees do not count as assets
As in other lending protocols, health depends on the current price
When IV is high, you'll need more collateral because the effective LTV is lower
IV can change by about 4%/day. This could be the difference between 90% and 75% LTV, so always keep an eye on your health! Liquidation warnings can help with this.
Governance should exercise extreme caution if changing nSigma
because it changes the risk profile of the market. Users should be made aware well before the change takes effect.
Expanding for more specificity and evaluating in terms of TOKEN1
using price , we get:
The uniswapPositionValue
is given in the Uniswap V3 Whitepaper, Equations 6.29 and 6.30 (where is the current price, and are the lower and upper bound of the position, respectively):