# For Pool Managers

This guide explains how Pool Managers operate within Trilobyte — from onboarding to vault management.

## What is a Pool Manager?

Pool Managers are **professional underwriters** who bridge borrowers and investors. They evaluate businesses, structure loans, and take financial responsibility for the vaults they create by staking collateral.

## Getting Started

### 1. Get Approved

Pool Managers must be approved by the protocol's **Operations Admin**:

* An Ops Admin calls `add_pool_manager(caller, manager)` to register your address
* Then calls `approve_pool_manager(manager, caller, max_credit)` to activate you with a **credit limit**
* Your credit limit caps the total outstanding principal across all your active vaults

### 2. Deposit Collateral

Before creating vaults, you must deposit collateral:

* Call `deposit_collateral(manager, token, amount)` on the Globals contract
* Collateral must cover a percentage of each vault's principal (set by the global `collateral_ratio`)
* Collateral is locked when you create a vault and released when the vault is fully repaid

{% hint style="warning" %}
Your collateral is **slashed** if any of your vaults default. This is your skin in the game — it aligns your incentives with investors.
{% endhint %}

## Creating a Vault

### 1. Structure the Loan

Negotiate terms with the borrower off-chain:

* **Principal** — Loan amount (must be within global min/max bounds)
* **Interest rate** — Annual rate in basis points (must exceed global minimum)
* **Loan term** — Duration in months (must be within global min/max bounds)
* **Split ratio** — Percentage of payments routed to the EMI pool (1–99)
* **Permissioned** — Whether to restrict investors to an allowlist
* **Funding deadline** — Optional deadline for full funding (0 = no deadline)
* **Approval deadline** — Optional deadline for your approval after funding (0 = no deadline)
* **Grace period** — Seconds after a missed payment before default can be triggered

### 2. Deploy via Factory

Call `create_vault(params, salt)` on the Factory contract. The Factory will:

1. Verify you are an approved, active manager
2. Check you are **not delinquent** (no previous defaults)
3. Check your **credit limit** (`outstanding + principal ≤ max_credit`)
4. Validate all loan parameters against global settings
5. **Lock your collateral** proportional to the principal
6. **Increment your outstanding principal**
7. Deploy a new Vault smart contract

### 3. Manage the Allowlist (Permissioned Vaults)

For permissioned vaults, manage who can invest:

* `add_to_allowlist(caller, investor)` — Allow an address to deposit
* `remove_from_allowlist(caller, investor)` — Revoke access

## Managing Active Vaults

### Approve & Disburse

Once the vault is fully funded (phase = AwaitingApproval):

* Call `approve_and_disburse(caller)` to release funds to the borrower
* This calculates the EMI, sets the payment schedule, and transitions to Active

### Monitor Repayments

Track vault health using query functions:

| Function                | What It Shows               |
| ----------------------- | --------------------------- |
| `get_payments_made()`   | Number of payments received |
| `get_outstanding()`     | Remaining principal         |
| `get_next_due()`        | Next payment due date       |
| `get_missed_payments()` | Consecutive missed payments |
| `get_late_fees()`       | Accumulated late fees       |
| `get_emi_pool()`        | Total investor yield pool   |
| `get_cash_pool()`       | Total borrower cash pool    |

### Apply Late Fees

If a payment is overdue (`now > next_due`):

* Call `apply_late_fee(caller)` to apply an 18% p.a. penalty
* This increments the missed payments counter and advances the next due date
* Use this to signal vault distress and incentivise borrower repayment

### Renegotiation

When terms need adjustment:

1. Call `propose_renegotiation(caller, new_interest_rate, new_loan_term)` — enters Renegotiation phase
2. Review the proposal, then either:
   * `approve_renegotiation(caller)` — Apply new terms, recalculate EMI, return to Active
   * `reject_renegotiation(caller)` — Cancel and restore previous phase

Renegotiation can be proposed from both **Active** and **Defaulted** phases.

## Collateral Management

| Function                                     | Description                                    |
| -------------------------------------------- | ---------------------------------------------- |
| `deposit_collateral(manager, token, amount)` | Stake collateral tokens                        |
| `withdraw_collateral(manager, amount)`       | Withdraw unlocked (staked − locked) collateral |
| `get_manager_collateral(manager)`            | View staked and locked amounts                 |
| `get_available_collateral(manager)`          | View withdrawable balance                      |

### Collateral Lifecycle

```
Deposit → Staked
               ↓ (vault created)
            Locked
               ↓ (vault fully repaid)
            Released → Staked (withdrawable)
               ↓ (vault defaulted)
            Slashed (lost)
```

## Delinquency

If one of your vaults defaults:

* You are marked **delinquent** in the Globals contract
* You are **blocked** from creating new vaults via the Factory
* Your `delinquency_count` is incremented
* Only an **Operations Admin** can clear your delinquency after review

{% hint style="danger" %}
Delinquency is a serious flag. It indicates a failure in underwriting or borrower management. The Operations Admin will review the circumstances before clearing it.
{% endhint %}

## Key Constraints

| Constraint                      | Enforced By |
| ------------------------------- | ----------- |
| Must be approved and active     | Factory     |
| Must not be delinquent          | Factory     |
| Outstanding ≤ credit limit      | Factory     |
| Sufficient collateral           | Factory     |
| Parameters within global bounds | Factory     |


---

# 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/user-guides/for-pool-managers.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.
