> For the complete documentation index, see [llms.txt](https://docs.trilobyte.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trilobyte.finance/protocol-mechanics/default-and-risk-management.md).

# 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 a pre-default workout

Renegotiation is a **pre-default** tool — a way to restructure a struggling loan *before* it tips into default:

* While a loan is **Active**, the manager can `propose_renegotiation` with a new rate and term.
* If approved, the EMI is recalculated on the **outstanding** principal and the vault stays Active.
* Once a loan has **defaulted**, it is terminal — the manager's collateral has already been slashed, so a defaulted loan cannot be renegotiated.

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