> 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/payments-and-emi.md).

# Payments & EMI

Trilobyte uses an **Equated Monthly Instalment (EMI)** model for loan repayments. Each payment is a fixed amount calculated at disbursement, covering both principal and interest.

## EMI Calculation

The EMI is calculated using the standard amortisation formula:

$$
EMI = P \times \frac{r(1+r)^n}{(1+r)^n - 1}
$$

Where:

* $P$ = Principal (loan amount)
* $r$ = Monthly interest rate (annual rate ÷ 12)
* $n$ = Number of monthly payments (loan term)

{% hint style="info" %}
All math is **integer-only** — Soroban has no floating-point support. Trilobyte uses 10¹² internal precision scaling and ceiling-rounds the final EMI to ensure the borrower always repays at least the full amount owed.
{% endhint %}

## Payment Split

Each payment is split into two pools based on the vault's **split ratio**:

| Pool          | Purpose                                                 | Accessible By                |
| ------------- | ------------------------------------------------------- | ---------------------------- |
| **EMI Pool**  | Investor yield — proportional to split ratio (e.g. 80%) | Investors via `claim_yield`  |
| **Cash Pool** | Borrower operating capital — remainder (e.g. 20%)       | Borrower via `withdraw_cash` |

For example, with a split ratio of 80, a **gross** payment of 10,000 USDC splits:

* **8,000 USDC** → EMI pool (investor yield)
* **2,000 USDC** → Cash pool — from which the 0.5% protocol fee is taken (→ \~1,950 USDC to the borrower)

Because only the EMI share repays the loan, the borrower **grosses up** the payment so that `split_ratio%` of it covers one investor instalment — i.e. `gross = ceil(EMI × 100 / split_ratio)`. The contract exposes `get_required_payment` / `get_current_period_payment` for the exact amount due.

## Payment Schedule

* Payments are due every **30 days** (30/360 day-count convention)
* The first payment is due 30 days after disbursement
* Each payment advances the `next_due` date by 30 days
* The loan term sets the EMI schedule, but the loan **completes when the outstanding balance reaches zero** — not on a fixed payment count

## Principal Amortisation

Each EMI payment contains both an interest component and a principal component:

$$
\text{interest} = \text{outstanding} \times \frac{\text{annual\_rate}}{12}
$$

$$
\text{principal} = \text{EMI} - \text{interest}
$$

The outstanding principal decreases with each payment. Early payments are interest-heavy, while later payments are principal-heavy — standard amortisation behaviour.

## Protocol Fee

A **0.5% protocol fee** applies to every repayment — but **after the split, and only from the borrower's cash share**. Investor (EMI) yield is never reduced by the fee:

1. Gross payment received (e.g. 10,000 USDC)
2. Split by ratio first (e.g. 8,000 → EMI pool, 2,000 → cash share)
3. The 0.5% fee (50 USDC) is taken from the cash share → 1,950 to the cash pool, 50 to the treasury

See [Fees](/protocol-mechanics/fees.md) for the full model (including the fee clamp).

## Yield Claiming

Investors claim their share of the EMI pool proportionally:

$$
\text{claimable} = \frac{\text{balance}}{\text{total\_supply}} \times \text{emi\_pool} - \text{already\_claimed}
$$

* `balance` = Investor's debt token balance
* `total_supply` = Total debt token supply
* `emi_pool` = Total accumulated EMI pool
* `already_claimed` = Amount the investor has already claimed

Claims can be made at any time during the **Active** or **FullyRepaid** phases.

## Token Precision

All amounts use **7 decimal places** (Stellar standard). For example:

* 1 USDC = `10_000_000` (10⁷)
* 0.5% fee = `50_000` in 7-decimal format


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.trilobyte.finance/protocol-mechanics/payments-and-emi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
