# Default & Risk Management

Trilobyte has multiple layers of protection to manage risk and protect investors when borrowers fail to repay.

## Risk Layers

```
Layer 1: Late Fees          → Financial penalty for overdue payments
Layer 2: Grace Period        → Time buffer before default
Layer 3: Manager Collateral  → Skin in the game — slashed on default
Layer 4: Delinquency Tracking → Blocks risky managers from new vaults
Layer 5: Renegotiation       → Restructure terms to avoid default
Layer 6: Credit Limits       → Cap manager exposure
```

## Late Fees

When a payment is overdue (`now > next_due`), the Pool Manager can apply a **late fee**:

* **Rate**: 18% per annum, calculated monthly
* **Effect**: Increments missed payment counter, advances next due date
* **Purpose**: Financial penalty that signals vault distress

## Grace Period

Every vault has a configurable **grace period** (default: 30 days). This is the window between a missed payment due date and when default can be triggered.

* During the grace period, the borrower can still make payments to prevent default
* The manager can apply late fees and attempt to resolve the situation
* After the grace period expires, **anyone** can call `check_default()` to trigger default

## Default Trigger

Default is triggered by calling `check_default()` when:

1. The vault is in the **Active** phase
2. The current time exceeds `next_due + grace_period`

Default is **permissionless** — anyone can trigger it. This prevents managers from colluding with borrowers to avoid consequences.

## Consequences of Default

When default is triggered:

| Action                      | Detail                                                      |
| --------------------------- | ----------------------------------------------------------- |
| **Phase transition**        | Vault moves to `Defaulted`                                  |
| **Collateral slashed**      | Manager's locked collateral is seized for investor recovery |
| **Delinquency flag**        | Manager is marked delinquent in Globals                     |
| **Outstanding decremented** | Manager's outstanding principal is reduced in Globals       |
| **Events emitted**          | `VaultDefaulted`, `ManagerMarkedDelinquent`                 |

## Manager Collateral

Pool Managers must deposit collateral before creating vaults. This is their "skin in the game":

* **Deposit**: `deposit_collateral(manager, token, amount)` — stake tokens in Globals
* **Lock**: When a vault is created via the Factory, collateral is locked proportional to the principal
* **Release**: On `FullyRepaid`, the locked collateral is released
* **Slash**: On `Defaulted`, the locked collateral is slashed and transferred for investor recovery

The **collateral ratio** is a global setting that determines what percentage of the principal must be covered by collateral.

## Delinquency Tracking

Managers with defaulted vaults are flagged as **delinquent**:

* The Factory checks `is_delinquent(manager)` before allowing vault creation
* Delinquent managers are **blocked** from creating new vaults
* Only an **Operations Admin** can clear delinquency via `clear_delinquency(caller, manager)` after review
* A `delinquency_count` tracks the total number of defaults per manager

## Credit Limits

Each Pool Manager has a **maximum credit limit** (`max_credit`) set by the Operations Admin:

* The Factory checks `outstanding_principal + new_principal ≤ max_credit` before deployment
* Prevents a single manager from over-leveraging the protocol
* Can be adjusted via `set_manager_credit_limit(caller, manager, max_credit)`

## Renegotiation as Recovery

Even after default, a vault can be restructured:

* The manager can **propose renegotiation** from the Defaulted phase
* If approved, the vault returns to Active with new terms and a recalculated EMI
* This provides a path to recovery when the borrower's situation can be salvaged

{% hint style="info" %}
Trilobyte's risk model is inspired by traditional structured finance, where first-loss capital (manager collateral), credit limits, and workout procedures (renegotiation) work together to protect senior investors.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilobyte.finance/protocol-mechanics/default-and-risk-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
