# Account Health & Liquidation

Maintaining solvency is the foundation of Moar Market. Every Credit Account must remain healthy — meaning it holds enough asset value to justify its outstanding debt — across all pools it borrows from. This is enforced through real-time on-chain checks using live oracle prices.

***

### ✅ What Makes a Position Healthy?

A Credit Account is considered **healthy** if the value of its total assets is **greater than or equal to** the minimum required collateral based on its borrowings.

This minimum is calculated per asset and pool using Loan-to-Value (LTV) ratios.

Let:

* `Dp` = total debt from pool `p`
* `LTVpa` = loan-to-value ratio for asset `a` in pool `p`

Then:\
**Minimum required asset value** = ∑ (Dp / LTVpa)

This ensures that a user’s Credit Account always holds more asset value than the debt it owes, adjusted for risk via LTVs.

***

### 📊 Understanding LTV and Leverage

Each (pool, asset) pair has its own **LTV** ratio. It defines the maximum borrowing power of a given asset within a specific pool.

For example, an LTV of 80% means that for every $100 worth of that asset, the user can borrow up to $80 from that pool.

Leverage derived from LTV is calculated as:\
**Leverage = LTV / (1 - LTV)**

Different pools may configure different LTVs for the same asset, reflecting varying risk tolerances.

***

### ⚠️ Liquidations

If a Credit Account becomes **unhealthy**, it becomes eligible for liquidation — a process where a whitelisted liquidator repays the **outstanding loan** and seizes a **discounted value of the account’s assets** in return.

This protects the protocol from insolvency and ensures lenders are not exposed to bad debt.

**🔧 How It Works**

A Credit Account typically becomes unhealthy due to:

* A **decline in the value of held assets**, based on real-time oracle prices
* An **increase in the value of borrowed assets**, raising the real debt burden
* **Accrued interest** increasing total debt beyond collateral value

Once unhealthy:

* A **whitelisted liquidator** repays the full outstanding debt
* In return, they receive account assets worth **slightly more than the repaid value**, based on a **liquidation bonus** (e.g. 5%)

**💡 Example**

Suppose:

* A Credit Account owes **$1,000 USDC**
* The pool defines a **5% liquidation bonus**

A liquidator:

* Repays **$1,000 USDC**
* Receives **$1,050 worth of assets** from the account (valued at oracle price)

This closes the debt, secures the protocol, and rewards the liquidator for assuming the liquidation risk.

***

### 🔐 Safety Enforcement

All outbound actions — borrowing, transferring, withdrawing, or exiting strategies — are **blocked unless the Credit Account remains healthy** after the action.

This ensures that **only price changes or interest growth** can cause liquidations, and not direct user actions.
