When entering a leveraged position on Rodeo where funds are borrowed, there is a certain level of liquidation risk. This means that if the price of an asset, for example, ETH falls very quickly, then your Rodeo position may be liquidated, and the initial collateral that you invested could be lost.
To have leverage when opening positions on Rodeo, users are able to borrow an asset from the lending pool and combine that with the existing collateral provided. This multiplies the yield-generating capabilities of the funds that you invest. However, to borrow funds for leverage, liquidity must be provided by lenders who receive interest from fees in exchange for lending out their money. It is crucial that lenders can withdraw their capital at any time and that they do not face any risk of loss as a result of bad debts. To ensure lenders are protected, this liquidation mechanism exists to quickly exit any underwater positions and pay back the lender.
Most of the time, borrowers do not need to worry about liquidations affecting their positions. Care needs to be taken only during sudden market movements where the price of invested assets is at risk of falling substantially in a short period. To prevent liquidations from happening, users can add more collateral to their positions to maintain their debt-to-collateral ratio at a healthy level.
Liquidations on Rodeo can be performed by anyone, in a fully decentralized manner. This is done using bots that monitor investors' positions and then call a smart contract function to initiate the liquidation process. Any bot or third party that performs a liquidation on Rodeo will receive 50% of the reward amount, which is the amount remaining after debts have been paid for the position.
Here is an example of how a liquidation event might take place:
- 1.Alice opens a USDC/WETH Uniswap yield farming position on Rodeo using 3x leverage.
- 2.She supplies $100 USDC of her assets, which is her equity or collateral.
- 3.She borrows $200 USDC, resulting in a combined $300 USDC that can be invested into the strategy.
- 4.Our Rodeo Uniswap strategy contract swaps 50% of the $300 invested USDC into WETH, and deposits both assets into the Uniswap pool.
- 5.Due to external market conditions, the price of ETH on exchanges goes down by 60%.
- 6.The total value of Alice's position is now approximately $210 (down from $300 due to the fall in ETH price), which drops her position's 'health' ratio to below 1.
- 7.A bot makes a liquidation call and liquidates Alice's position. $200 plus the borrowing interest goes to the lending pool, and the $10 remaining is divided between the bot and the Rodeo protocol.
To maintain the health of the Rodeo protocol, we run our own internally built liquidation bot. This system regularly monitors the health of borrowers' positions and liquidates any that have reached an unhealthy state. Anyone is welcome to build their own bot systems for the purpose of liquidating positions on Rodeo; however, the level of competition in the space is normally high.
Liquidation Steps for Developers:
- 1.Call nextPosition() on the Rodeo contract to get the next upcoming position ID. The most recent active position on Rodeo would therefore be this value, minus 1. Rodeo positions start at ID 0 and increase sequentially up to the current ID value.
- 2.To check the current health of a position, call the life() function on the Rodeo contract, passing in the ID of the position you want to query. This will return an integer that represents the health state of the position. A position with a value that is less than 1e18 can be liquidated.
- 3.Call the kill() function on the Rodeo contract to liquidate the position, passing in the position ID. Upon successful liquidation, the sender of the liquidation transaction will receive a payout equivalent to 50% of the remaining balance of the position after debt + interest has been paid off.
No upfront collateral or funds need to be supplied by the bot in order to perform the liquidation; the only cost is the gas fee of the transaction.