# Smart Liquidation Algorithm

Unlockd's Smart Liquidation Algorithm plays a crucial role in managing multi-collateral loans during liquidation events. This algorithm is specifically designed to address situations where the 7-day Borrower Grace Period has ended without sufficient bids in the marketplace auction to cover the debt.

Here's an insightful look into how this process works, focusing on debt recovery and the integration with External Liquidation Gateways like Reservoir.

## Strategic Selection of Assets for Liquidation

The primary objective of the liquidation algorithm is to recover the amount equivalent to the borrowerโs outstanding debt. This recovery target is the driving factor behind the asset selection process for liquidation.

The algorithm considers the highest bids available in External Liquidation Gateways, such as Reservoir, ensuring that the assets chosen for liquidation are those that can most effectively contribute to repaying the debt.

**Minimizing Impact**: When a loan backed by multiple assets faces liquidation, Unlockdโs algorithm prioritizes minimizing the number of assets liquidated. This approach is aimed at reducing adverse effects on the borrower's remaining assets and mitigating sell pressure in the market.**Optimal Asset Liquidation**: The algorithm selects assets for liquidation based on their bid values to recover the required amount with the least impact. This method ensures that the borrower retains as much value as possible in their loan.

## Examples

**Base Case Example**: For a loan with 3 assets, if the amount to recover is 2500 USDC, and the bids for the assets are 2000 USDC, 500 USDC and 2500 USDC respectively, the algorithm will select the asset with a 2500 USDC bid for liquidation. This selection satisfies the recovery amount while impacting the fewest assets (liquidating 1 asset instead of 2 assets).**Complex Case Example**: In a loan with ten assets and an 8000 USDC recovery target, the algorithm strategically selects assets with bids that cumulatively meet this target while minimizing the number of assets liquidated. For instance, selecting bids of 6000 USDC and 2000 USDC, rather than higher individual bids that exceed the recovery amount.**Higher Recovery Requirement**: If the recovery amount is substantially larger, such as 126000 USDC in a ten asset loan, the algorithm will choose a combination of bids (60000 USDC, 50000 USDC, and 20000 USDC, for example) that collectively meet the target while still aiming to liquidate the fewest assets.

## Key Takeaways

**Debt-Centric Approach**: The algorithmโs focus remains steadfastly on covering the outstanding debt, aligning with Unlockdโs commitment to efficient and fair liquidation processes.**Minimizing Borrower Impact**: By strategically choosing assets for liquidation, the algorithm helps preserve the borrower's remaining asset value as much as possible.

The Smart Liquidation Algorithm is integral to Unlockd's approach to handling complex liquidation scenarios. It reflects a thoughtful balance between ensuring debt recovery and protecting borrowers' interests, especially in cases where marketplace auctions do not fully cover the debt.

For a comprehensive understanding of this algorithm and its role in Unlockd's liquidation process, please refer to our Risk Documentation.

Last updated