This is a bot contract that automates the monitoring of borrowers' health factors and triggers liquidation when their health factors fall below a set threshold (e.g., 85%). The bot integrates with Gelato to automate the execution of liquidations, ensuring timely and efficient repayment of under-collateralized loans.
- Automated Health Factor Monitoring: The bot continuously monitors the health factor of each borrower's loan/request in real-time using live price data from oracles.
- Dynamic Liquidation Threshold: Triggers liquidation when a borrower's health factor falls below the defined threshold (e.g., 85%).
- Gelato Integration: Utilizes Gelato to automate the liquidation process, making it easy for liquidators to execute liquidations without manual intervention.
- Supports Multiple Collateral Tokens: Dynamically calculates the total collateral value based on multiple tokens and fetches real-time prices from the protocol contract.
The health factor (HF) is calculated to determine the safety of a loan. The formula is:
[ \text{HF} = \frac{\text{Collateral Value} \times \text{Liquidation Threshold}}{\text{Loan Repayment}} ]
- Collateral Value: The total value of all tokens deposited as collateral.
- Liquidation Threshold: The percentage at which a loan becomes eligible for liquidation (e.g., 85%).
- Loan Amount: The total amount borrowed by the borrower.
If the health factor falls below 1, the loan is under-collateralized, and liquidation is triggered.
- The bot monitors each loan’s health factor based on real-time price feeds from oracles.
- When the health factor falls below the liquidation threshold, the bot prepares an execution payload.
- The payload is sent to Gelato, which automates the liquidation process by repaying a portion of the loan on behalf of the borrower in exchange for the liquidated collateral.
-
Clone the repository:
git clone https://github.com/LendBit-p2p/LendBit-Automate-Checker.git cd LendBit-Automate-Checker
-
Install dependencies:
forge install/npm install
After setting up, deploy the bot to any of the evm chains supported by gelato.
The bot will:
- Monitor all active loans.
- Recalculate the health factor for each loan using real-time price data.
- Trigger liquidation when necessary by sending the execution payload to Gelato.
The bot interacts with Gelato to automate liquidations. The payload includes:
- Loan/Request ID: The unique identifier for the loan being monitored.
For detailed instructions on integrating with Gelato, refer to their official documentation.
If you encounter issues or need assistance, feel free to reach out:
- Email: support@lendbit.com
- Community: Join our Discord