# Keepers and Liquidators

## Liquidators

Liquidators play a crucial role in safeguarding the stability and viability of the EpsiLoan ecosystem. Here's how the liquidation process works and the rewards involved for liquidators:

**Role of Liquidators:** Liquidators act as the first line of defense in maintaining system viability by settling the debts of borrowers (minters) whose collateral ratio falls below the minimum threshold. This helps preserve the stability of yUSD and ensures the total supply of yUSD remains intact.

**Liquidation Process:** When a borrower is being liquidated, liquidators use their yUSD to settle the borrower's debt. Up to 50% of the borrower's collateral is burned from the liquidator's balance to repay the debt. In return, the liquidator receives the collateral asset, which is worth 109% of the value of the repaid yUSD.

**Liquidator Rewards:** Liquidators are rewarded for their role in the liquidation process. A portion of the collateral asset, at least 1%, goes to the Keeper, while the remainder is received by the liquidator as a reward for their services. These rewards incentivize liquidators to actively participate in the liquidation process and maintain the stability of the system.

Execution by 3rd Parties/Bots: Currently, liquidation can only be executed by 3rd parties or bots. These entities play a crucial role in ensuring the efficient operation of the liquidation mechanism and contribute to the overall health and stability of the EpsiLoan protocol.

In summary, liquidators play a vital role in maintaining the stability and integrity of the EpsiLoan ecosystem by settling the debts of borrowers whose collateral ratio falls below the minimum threshold. Their efforts are rewarded with a portion of the collateral asset, incentivizing active participation in the liquidation process and ensuring the continued viability of the system.



***

## Keepers

Any third party can operate a Keeper Program to monitor the state of each liquidator and borrower (minter) on the EpsiLoan. When a borrower needs to be liquidated, the Keeper can choose to do so immediately using yUSD supplied by the appropriate liquidator in exchange for 1% of the liquidated assets.

In the example provided, Alice's collateral ratio falls below the minimum threshold, putting her at risk of liquidation. Here's a breakdown of the liquidation process involving Bob as the Liquidator and Cathy as the Keeper:

1. **Alice's Situation:** Alice has deposited 10 lrETH (\~$25,000) and minted 21,000 yUSD against her collateral. Her collateral ratio is calculated to be 119%, indicating that she is at risk of liquidation.
2. **Liquidation Initiation:** Cathy, acting as the Keeper, determines that Alice needs to be liquidated due to her low collateral ratio. She initiates the liquidation process.
3. **Bob's Role as the Liquidator:** Bob, who holds 5,000 yUSD, steps in as the Liquidator to repay a portion of Alice's debt. He provides 5,000 yUSD to settle the debt and receives lrETH collateral in return.
4. **Collateral Received by Bob:** Bob receives lrETH collateral equivalent to 109% of the value of the repaid yUSD. In this case, he receives 2.18 lrETH, which is worth 5,450 yUSD.
5. **Keeper's Compensation:** As compensation for facilitating the liquidation, Cathy, the Keeper, receives a portion of the liquidated assets. She receives lrETH equivalent to 1% of the value of the repaid yUSD. In this case, she receives 0.02 lrETH, which is worth 50 yUSD.
6. **Updated Debt and Collateral for Alice:** After the liquidation, Alice's debt is reduced to 15,000 yUSD, and her collateral is adjusted accordingly. She now has 7.8 lrETH remaining as collateral. The updated collateral ratio is calculated to be 130%, indicating an improvement in her financial position.

In summary, the liquidation process involves a Liquidator repaying a borrower's debt in exchange for collateral assets, with a portion of the liquidated assets going to the Keeper as compensation. This mechanism helps maintain the stability and integrity of the EpsiLoan protocol by ensuring that borrowers' collateral ratios remain above the minimum threshold.
