Health
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. Borrowers 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.
Types of Assets
Borrowers understand three types of assets:
Raw
TOKEN0, i.e. any amount ofTOKEN0owned by theBorrowerRaw
TOKEN1, i.e. any amount ofTOKEN1owned by theBorrowerUniswap V3 Positions in
Borrower.UNISWAP_POOL, which are made up ofTOKEN0and/orTOKEN1.The amount of each token varies with price.To save gas, uncollected earned fees are not included as assets
The
Borrowercan own and manage as many Uniswap positions as you want, but only the ones stored inslot0will count as assets.slot0can 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.
Types of Liabilities
Borrowers 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).
Solvency
To be solvent, total assets must be greater than total liabilities:
assets>liabilities
Expanding for more specificity and evaluating in terms of TOKEN1 using price P, we get:
The uniswapPositionValue is given in the Uniswap V3 Whitepaper, Equations 6.29 and 6.30 (where P is the current price, and Pl,Pu are the lower and upper bound of the position, respectively):
uni0=⎩⎨⎧liquidity⋅(Pl1−Pu1)liquidity⋅(P1−Pu1)0P<PlPl≤P<PuPu≤P
uni1=⎩⎨⎧0liquidity⋅(P−Pl)liquidity⋅(Pu−Pl)P<PlPl≤P<PuPu≤P
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:
value=⎩⎨⎧liquidity⋅(PlP−PuP)liquidity⋅(2P−Pl−PuP)liquidity⋅(Pu−Pl)P<PlPl≤P<PuPu≤P
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.
Probe Prices
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:
Probe Prices=TWAP⋅e±nSigma⋅IV
Health
To be healthy, a Borrower must be solvent at both Probe Prices. If it isn't, it can be liquidated.
Implications
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
nSigmabecause it changes the risk profile of the market. Users should be made aware well before the change takes effect.
A note on asset calculation
Borrows and raw asset amounts do not change w.r.t price, but the amounts underlying a Uniswap position do. This is important both in two parts of the solvency check:
assessing the Uniswap positions themselves
assessing
shortfallwhen computing the liquidation incentive
The Asset struct is populated with the necessary data in Borrower._getAssets:
Last updated