How to Avoid Liquidation Risk in Leveraged Yield Farming?

Eric | Eternal Finance
Eternal Finance
Published in
3 min readFeb 16, 2023

Have you heard of the saying — “High risk, high reward”? Leveraged yield farming allows users to generate more returns. However, the risks associated with leveraged yield farming should not go unnoticed because liquidation is a significant risk.

Let’s say you open a leveraged position, and the amount added from your capital acts as collateral. If the collateral provided can no longer repay the debt it owes, it is at risk of getting liquidated and may lose some or all underlying collateral.

Each protocol runs on different liquidation parameters. For example, the liquidation threshold of ETH/USDT is 80%, and ETH/YFI is 60% on Alpha Homora with Uniswap pool.

Liquidation Example

Terms to understand before calculating liquidation:

  1. Debt Value: The value of the borrowed tokens
  2. Position Value: The value of your farming position
  3. The Debt Ratio: Debt Value ÷ Position Value
  4. Equity Value: Position Value — Debt Value

For this example:

Let’s say the price of Token A is US$0.5 while Token B is US$2

  1. User opens a 3x leveraged Token A-Token B leveraged yield farming position
  2. The user supplies 5,000 Token B (US$10,000) and borrows 40,000 Token A (US$20,000).
  3. The assets supplied and borrowed by the user convert to a 50:50 proportion for creating the LP tokens, as the position now has 30,000 Token A (US$15,000) and 7,500 Token B (US$15,000). The total position value remains unchanged at US$30,000.
  4. The current Debt Ratio of the user’s position is US$20,000/US$30,000 = ~ 66.67%

After a day, there is no trading fee, and reinvesting yield farming reward, the price of Token A is now US$0.6, and Token B is now US$1.5:

  1. The total position has 23,717.08 Token A and 9,486.83 Token B, according to Constant Product Formula (x * y = k)
  2. The New Debt Value would be US$24,000 (i.e., 40,000 Token A*US$0.6)
  3. The Total Position Value would be US$28,460.50 (i.e., 23,717.08 Token A*US$0.6 + 9,486.83 Token B*US$1.5)
  4. The new Debt Ratio of this position would be US$24,000/US$28,460.50 = 84.33%.
  5. Since the liquidation threshold of this pair is 83.33%, it will trigger the liquidation bot to close the position.
  6. The net equity value before paying the liquidation fee will be US$4,460.50. After deducting a 5% fee, the user will receive 2824.98 Token B (~$4,237.475) in his wallet.

How to Avoid Liquidation Risk

Farm less volatile assets — Farming assets such as stablecoins have a lower chance of liquidation, and farming high-market cap assets like ETH are less risky than new low-market cap tokens.

Add more collateral — As mentioned above, every protocol has its liquidation threshold. You can increase your safety buffer by adding more collateral once your asset drops close to the liquidation threshold.

Conclusion

Liquidation occurs when the debt ratio exceeds the liquidation threshold. In most cases, the smart contracts will close your position, repay the loan borrowed, and return any remaining assets to your wallet. Calculating liquidation risk is complicated, and risk management is vital as miscalculations might cause losses. A DeFi protocol like Eternal Finance provides Pseudo Market-Neutral Strategies to minimize the impact of impermanent loss and leverage the yield generated concurrently. Eternal Finance’s strategies operate on Capital Protection Ratios and liquidation thresholds to help users recover the better part of their capital.

About Eternal Finance

Eternal Finance is revolutionising the DeFi space with a one-of-a-kind portal that links VAMPIRES seeking safe and attractive APY with SORCERERS looking to maximize their returns with leverage and alpha.

Vampire playgrounds 🛝

🧛🏻‍♂️ Eternal Finance | 🧛🏻‍♂️ Twitter | 🧛🏻‍♂️ Discord | 🧛🏻‍♂️ Blog | 🧛🏻‍♂️ Docs

--

--

Eric | Eternal Finance
Eternal Finance

Eternal Finance is the First Automated and Leveraged Yield Farming Protocol built for PancakeSwap.