- Manually, by adding more funds to the position, or
 - Automatically, by enabling auto-mode, provided their wallet maintains sufficient balance. (in the future)
 

LTV (Loan-to-Value) & Liquidation Logic
LTV (Loan-to-Value) measures how much the borrower has borrowed compared to the current value of their position (LP + collateral).- 
Formula:
LTV = Debt / Position Value - If the LTV gets too high (e.g., 85–90%), it means the borrower’s position is no longer safely over-collateralised and is at risk.
 
Partial Liquidation Logic (Individual Risk Control)
Partial liquidation is a protocol-level risk-mitigation step that sells a portion of an over-leveraged borrower’s position when their Loan-to-Value (LTV) climbs above a preset threshold, yet before a full liquidation is required. The sale proceeds are used to repay part of the borrower’s debt, pushing the LTV back into a safer range.- Partial liquidation is designed as a borrower-friendly safeguard and a way to safeguard lenders’ funds from being completely lost, offering a chance to stabilise their position before full liquidation is triggered, especially during volatile market conditions.
 - Trigger: When an individual borrower’s LTV crosses the partial threshold (e.g., 85%).
 - Action: A calculated portion of their LP position is closed. The resulting assets are used to repay part of the debt.
 - Goal: Bring the LTV back to a safer range (e.g., down to 75%) without liquidating the entire position.
 - Why: This protects lender funds while giving borrowers a fairer chance to recover compared to immediate full liquidation.
 
One-Time Liquidation Logic
- Partial liquidation is triggered once per liquidation cycle.
 - If the borrower adds more funds and LTV drops below the safe threshold, they become eligible for partial liquidation again in the future.
 - For now, partial liquidation is only applied to blue-chip and mid-cap assets
 
Precision-Based Recovery (Not Fixed Slice)
Unlike protocols that liquidate a fixed slice (e.g., 50%), our system calculates the exact value needed to recover 80% of the lender’s principal, based on:- The borrower’s leverage
 - Current LTV
 - Position size and debt
 
borrowed amount = debt in calculations.
Example Scenario
Let’s say:partial_threshold = 80 %full_threshold = 90 %safe_threshold = 70 %
- Borrower LTV hits 80 %
- Partial liquidation triggers, the flag is set.
 
 - Borrower does nothing, LTV reaches 91 %
- Full liquidation triggers.
 
 - If, after partial liquidation, the borrower adds more collateral, the LTV drops to 65 %
- System resets the flag; they get another shot.
 
 
Trigger Rules
| Condition | Action | 
|---|---|
LTV ≥ partial_threshold and has_been_partially_liquidated = false | → Do partial liquidation (e.g. 50 %), then set has_been_partially_liquidated = true | 
LTV ≥ full_threshold and has_been_partially_liquidated = true | → Fully liquidate the remaining position | 
LTV < safe_threshold (e.g. user tops up collateral) | → Reset has_been_partially_liquidated = false | 
Deleveraging (System-Wide Risk Control)

- To ensure enough liquidity is available for lenders to withdraw their funds at any time.
 - To reduce systemic risk in the pool by lowering the average leverage across all borrowers.
 - Trigger: Utilisation of the lending pool exceeds a critical limit (e.g., 95%) and lenders may not be able to withdraw.
 - Action: A portion of all borrower positions are liquidated proportionally, e.g., user 1 has 50 → both repay 10% of their debt.
 
Debt to liquidate
ΔB = totalBorrowed − (U_target × totalDeposits) ΔB = B − U_target · D Amount to liquidate per user For every borroweri with current debt Debtᵢ:
- 
Every borrower repays the same percentage of their outstanding debt:
percentage_to_repay = ΔB / B - 
After liquidation, each borrower’s new debt is
Debtᵢ_new = Debtᵢ − liquidateᵢ