Liquidations

Profit from the safeguarding of bad debt

The trenUSD token serves as a collateral-backed stablecoin without relying on algorithmic mechanisms. In this design, each $1 of trenUSD is required to maintain more than $1 worth of collateral support. As market conditions fluctuate, the value of the collateral will naturally change. Similar to traditional DeFi lending platforms, Tren Finance depends on liquidation processes to ensure that trenUSD consistently remains overcollateralized.

A liquidation event occurs when a borrower's Health Factor drops to 0%, indicating eligibility for liquidation. This process allows liquidators to seize control of the borrower's collateral, sell it, and utilize the proceeds to repay the outstanding debt while earning a liquidation fee.

Tren Finance currently employs a full-collateral liquidation approach. When a position is flagged for liquidation, a liquidator seizes the borrower's entire collateral to settle their borrowing position. Following the conclusion of the liquidation event, the liquidated borrower is left with only the amount they initially borrowed.

This liquidation method is particularly suitable for assets with limited liquidity and significant price slippage when liquidated.

Liquidation Process

  1. Initialization: The process commences by updating the exchange rate and invoking the accrue function.

  2. Variable Setup: Variables are initialized to record the total collateral shares, borrow amounts, and borrow parts involved in the liquidation.

  3. User Assessment: The function systematically evaluates each user's solvency, ensuring their collateral meets the required threshold. If a user is found to be insolvent, the liquidation process proceeds.

  4. Calculations: For each insolvent user, the function computes their borrow part, borrow amount, and collateral share. It then updates these values for the user accordingly.

  5. Event Emission: Throughout the process, the function emits events to log actions such as collateral removal, loan repayment, and liquidation.

  6. Totals Tracking: The function keeps a running tally of the overall collateral shares, borrow amounts, and borrow parts.

  7. Verification: After processing all users, the function verifies if at least one user was insolvent; otherwise, it reverts.

  8. Update and Distribution: The function proceeds to update the total borrow values, both elastic and base, along with total collateral shares. It calculates a distribution amount, earmarked for sharing with sTREN holders as a portion of the liquidation sum.

  9. Borrow Shares Calculation: The total borrow amount is converted into borrow shares.

  10. Collateral Transfer: The JuiceBox initiates the transfer of collateral to the to address.

  11. Swapping (Optional): If a swapper is provided, the function invokes the swapper's swap function to execute the actual swap operation. This involves supplying the collateral and borrow shares.

  12. Asset Transfer: Finally, the JuiceBox facilitates the transfer of trenUSD (the borrowed asset) to the msg.sender, who acted as the liquidator.

Last updated

Logo