# Liquidation

Taking on a leveraged position as a yield farmer comes with increased opportunity, but also increased risk. One of these significant risks is that of liquidation. When taking on a leveraged position, this position is monitored by a debt ratio. This is measured as the amount of debt taken on by a user at entry by the value of the position at present.
Once an open position is such that the collateral provided to it can no longer repay the debt it owes, it is at risk of forced closure or liquidation and loss of some or all underlying collateral of the user.
An example of this would be someone taking out a position under the following conditions:
Pool: ETH-USDC WLP
Collateral: 10 ETH
Starting Leverage: x 3
This would make the debt size 20ETH
This would make the position size/position value 30ETH worth of ETH-USDC WLP at the time of opening the position.
This would make the debt ratio 20/30 = 66.66%
For ease of explaining lets just say ETH : eleETH is 1:1 (this isn't the case in reality).
Each position, based on a variety of factors, including the volatility of the underlying assets and leverage of the position has what is called a ‘Liquidation Leverage’ this is a the point of leverage, that if a position were to meet or go past the position would be susceptible to liquidation. Let’s say the ‘Liquidation Leverage’ for the ETH-USDC WLP position above is 3.33.
Now lets imagine the price of ETH-USDC WLP drops by 10%, the position value would drop by 10%. This would make the debt ratio:
(Debt) / (Position Value) = 20 / 27 = 74.07%.
To calculate the current leverage of this position:
ETH-USDC WLP borrowed / (ETH-USDC WLP current position size - ETH-USDC WLP borrowed)
20 / (27-20) = 2.857
This current leverage remains below that of the Liquidation Leverage and is still safe from liquidation. But as it has increased and is at more risk, and it would be wise to monitor the position. At this (or any point in the process) the leveraged yield farmer can manage their position in a variety of ways, including:
Withdrawing from this position - At this point the user could close their position. If they were to do this, the first thing the platform would do is repay the debt position (20ETH) to the eleETH Bank. The remaining 7 ETH would then be returned to the yield farmer.
Adding more collateral - At this point the user could also add additional collateral to their position to improve their debt ratio. They could do this by depositing additional collateral, in the form of either ETH, USDC or a combination of both. The more they add, the lower their Debt Ratio and Current Leverage Position will become, reducing their liquidation risk.
To further explore this example, lets say the price of ETH-USDC WLP drops 20% from the entry price. This would make the debt ratio:
(Debt) / (Position Value) = 20 / 24 = 83.33%.
Current leverage in this position = ETH-USDC WLP borrowed / (ETH-USDC WLP current position size - ETH-USDC WLP borrowed)
20 / (24-20) = 5
This is now above the Liquidation Leverage number and the position is at risk of being liquidated.
How liquidation occurs
The ‘All Positions’ tab of the Eleven Finance Yield Farming platform allows anyone to monitor current leveraged yield farming positions and their respective debt ratios. If any of these debt ratios meet or exceed the 100% for that pool the liquidate function can be called by anyone. Using the example above, where the ETH-USDC WLP Debt Ratio is > 100%, the liquidation function can be called by anyone. In calling this function the first priority and action that occurs is that the debt position is repaid. In the case above, with a debt position of 20ETH outstanding in the total position size is 24ETH. There is 20ETH Debt to be repaid to the eleETH Bank. After this occurs there is 4ETH outstanding. Following this the caller of the liquidation function is entitled to a reward of 1% of the position value - in this case it would be 0.24 WTH. Following this the remaining amount is returned to the yield farmer (3.76 ETH in this case).
** Please note in the example above, and in any borrowing position, the position value is subject to the interest rate. This would reduce the position value at current rate for the platform, updated on a per second basis. This would be factored into the above calculations **