Skip to content

Commit

Permalink
LiquidationAuction overview
Browse files Browse the repository at this point in the history
  • Loading branch information
uprotocore committed Dec 3, 2023
1 parent b48f444 commit 1c9eda4
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions doc/dev/LiquidationAuction02.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# LiquidationAuction02 Smart Contract Technical Overview

## Contract Overview
The `LiquidationAuction02` contract is focused on asset liquidation in case of collateralized debt positions (CDPs) becoming undercollateralized. It interacts with several other contracts within the system, such as `IVault`, `IVaultManagerParameters`, and `ICDPRegistry`.

## Key Features

### 1. Interfaces
The contract integrates with multiple interfaces to interact with different components of the system:
- `IVault`
- `IVaultManagerParameters`
- `ICDPRegistry`
- `IAssetsBooleanParameters`

### 2. Reentrancy Guard
Implements `ReentrancyGuard` to prevent reentrant calls, enhancing security especially in financial operations.

### 3. Event
Defines an event `Buyout` for logging buyout details.

### 4. Constants
Defines constants like `DENOMINATOR_1E2` and `WRAPPED_TO_UNDERLYING_ORACLE_TYPE` for internal calculations.

### 5. Constructor
Initializes the contract with addresses of `IVaultManagerParameters`, `ICDPRegistry`, and `IAssetsBooleanParameters`.

### 6. Modifiers
- `checkpoint`: Ensures updating the CDP registry after certain actions.

### 7. Main Function: `buyout`
The `buyout` function allows users to buy out collateral from an undercollateralized position.
- Validates that liquidation is triggered.
- Calculates the buyout price and the collateral distribution between the liquidator and the original owner.
- Handles special conditions for asset transfer and position movement based on asset parameters.
- Interacts with `vault` to execute liquidation.

### 8. Private Functions
- `_liquidate`: Internal function to facilitate liquidation logic.
- `_calcLiquidationParams`: Calculates parameters for liquidation including how collateral is distributed and the repayment amount.

## Security Considerations
The use of `ReentrancyGuard` suggests a focus on security, particularly against reentrancy attacks. The contract's functions interact with external contracts, necessitating careful consideration of trust assumptions and interactions.

## Conclusion
`LiquidationAuction02` is a crucial part of the liquidation mechanism in a DeFi ecosystem, handling the process of liquidating undercollateralized positions by calculating and distributing assets between parties involved.

0 comments on commit 1c9eda4

Please sign in to comment.