πŸ’»How does LenoLend work?

Health Factor

Users can borrow against their supplied assets. All positions must be over-collateralized. The risk of a position can be understood through the Health Factor, which represents the combined collateral ratios of the borrowed assets.

Computation

The Health Factor (HF) is computed per account instead of per asset.

Each asset on Leno has a configuration value collateral factor which indicates the expected price stability factor.

The higher the factor, the higher expectation of the stability of the price of the corresponding asset.

To compute the current health factor for the account, we need to know the current prices of all collateral and borrowed assets.

Now we can compute the health factor:

If the health factor is higher than 100%, it means the account is in a good state and can't be liquidated.

The higher the % of health factor is, the safer the user’s collateral is.

  • Health Factor > 130%: Green (Relatively safe)

  • Heath Factor between 115% to 130%: Orange (Please pay closer attention to positions)

  • Health Factor between 100% to 115%: Red (Please improve Health Factor)

  • Health Factor < 100%: Partially Liquidation.

If the health factor is more than 100%, it means the account can be partially liquidated and can't borrow more without repaying some amount of the existing assets or providing more collateral assets.

Interest Rate Model

Leno Network uses a compounding interest model similar to Aave.

Each asset defines interest rate configuration with the following values:

  • Target Utilization - the utilization rate targeted by the model, e.g. 80% borrowed comparing to the total supplied.

  • Target Utilization APR - the constant to use as a base for computing compounding APR at the target utilization. (for 1 millisecond)

  • max Utilization APR - the constant to use as a base for computing compounding APR at the 100% utilization. (for 1 millisecond)

  • Reserve Ratio - the percentage of the acquired interest reserved for the platform.

Based on these values we define 3 points of utilization: 0%, target utilization and 100%. For each of these points we have the r constant: 1.0, target utilization APR and max utilization APR respectively.

To compute the APR, we can use the following formula:

where MS PER YEAR is the number of milliseconds in a year equal to 31536000000.

Based on the current supplied, reserved and borrowed balances, the current utilization is defined using the following formula:

To compute the current APR, we need to find the current r constant based on the linear interpolation between utilization points:

Note: TU APR = Target Utilization APR.

To calculate the amount of interest acquired for the duration of t milliseconds, we can use the following formula:

The interest are distributed to reserved and supplied, based on reserve ratio, so the new values are: reserved interest = interest Γ— reserve ratio new reserved = reserved + reserved interest new supplied = supplied + (interest - reserved interest) new borrowed = borrowed + interest

You can refer to the picture below to better understand the mechanism as well as how to calculate the interest rate.

Liquidations

Introduction

A liquidation is triggered when an account's Health Factor goes below 100%, due to its collateral value not being sufficient to cover the debt value. This might happen when the collateral decreases in value or the borrowed debt increases in value.

Leno's liquidation mechanism is designed to make liquidators compete for the profit that they make during liquidations to minimize the loss taken by unhealthy accounts. This is achieved by introducing a variable discount with variable liquidation size, Instead of offering a fixed profit that is used in other protocols.

Liquidation rules

Liquidations on Leno follow 3 basic rules:

  1. The initial health factor of the liquidated accounts has to be below 100%

  2. The discounted sum of the taken collateral should be less than the sum of repaid assets

  3. The final health factor of the liquidated accounts has to stay below 100%

The first rule only allows liquidating accounts in an unhealthy state. The second rule prevents from taking more collateral than the repaid sum (after discount). The third rule prevents the liquidator from repaying too much of the borrowed assets, only enough to bring closer to the 100%.

A liquidation action consists of the following:

  • address - the address that is being liquidated

  • in assets - the assets and corresponding amounts to repay form borrowed assets

  • out assets - the assets and corresponding amounts to take from collateral assets

The Liquidation Bonus (Discount) is computed based on the initial health factor of the liquidated account:

Now we can compute the taken discounted collateral sum and the repaid borrowed sum:

Once the action is completed, we can compute the final values and verify the liquidation rules:

  1. health factor < 100%

  2. new health factor < 100%

Liquidation example

Address juno123...456 supplied to collateral 1000 Juno and borrowed 4000 axlUSDC.

Let's say (note: the numbers are hypothetical for illustration purposes only):

  • the price of Juno is 10

  • the price of the axlUSDC is 1

  • the collateral factor of Juno is 0.5

  • the collateral factor of axlUSDC is 1

The health factor of 0x123...456 is the following:

Let's say the price of Juno drops to 8

he health factor is 100%, so the account still can't be liquidated.

Let's say the price of Juno drops to 7

The health factor is below 100%, so the account can be liquidated. The discount is the following:

It means anyone can repay some axlUSDC and take some Juno from juno123...456 with 6.25% discount.

Address juno456...321 decides to liquidate juno123...456

juno456...321 wants to repay 1000 axlUSDC, we can compute the maximum sum of the collateral to take:

And based on the Juno price, we can compute the maximum amount:

But to avoid risk, juno456...321 takes 152 Juno - a bit less to avoid price fluctuation for the duration of the transaction.

Let's compute the liquidation action:

Now checking the liquidation rules:

  • The initial health factor of the liquidated accounts has to be below 100% (87.5% < 100%)

  • The discounted sum of the taken collateral should be less than the sum of repaid assets (997.5 <= 1000)

  • The final health factor of the liquidated accounts has to stay below 100% (98.93% < 100%)

All rules were satisfied, so the liquidation was successful.

Now, let's compute the profit of juno456...321 (or the loss for juno123...456) for this liquidation:

Notes:

  • During the time when the price of Juno was falling from 8 to 7, if someone liquidated juno123...456, they would have made less profit, by liquidating a smaller amount with a smaller collateral discount.

  • To fully realize the profit, juno456...321 has to make another transaction to swap received 152 Juno for axlUSDC, which may involve extra fees and transactional risks. That's why liquidators may wait for higher discount.

Last updated