When you engage in leveraged yield farming, you borrow assets to provide more liquidity to a DEX/AMM pool and earn higher yields. All your farming position ( = your liquidity in the pool) serves as collateral, which grows with accumulated yields.
However, there's a risk associated with borrowing. Your borrowed value may grow relative to the position value — due to price changes in the market or accrued borrowing interest. Axly needs to ensure that value of your position is always sufficient to cover the debt. So, liquidation is necessary to protect lenders.
If the position health goes below 0%, the position will be partially liquidated. In such a case, Axly withdraws a portion of liquidity from the pool and repays the debt, withholding a liquidation fee.
Liquidation reduces both your position value and debt value, and their ratio becomes healthy again. In contrast to the total liquidation, the farming position continues generating income and can grow again if the price goes in the opposite direction.
Position health indicates how safe is your debt value relative to your position value.
DebtValue is a debt value
LiquidationThreshold is a parameter of the borrowed asset
PositionValue is the value of your liquidity in the farming pool
CollateralFactor is a parameter of the pool's LP token
The amount to be liquidated is set so that the health of the position becomes slightly greater than 0.