# RaisingFunds

The **RaisingFunds** phase is the initial state of every vault. During this phase, the vault is open for investor deposits.

## What Happens

* Investors call `deposit(investor, amount)` to fund the vault
* For each deposit, 1:1 **SEP-41 debt tokens** (tVLT) are minted to the investor
* A **0.5% protocol fee** is deducted from each deposit and sent to the treasury
* The vault tracks each investor's deposit amount and adds them to the investor list
* In **permissioned vaults**, only allowlisted addresses can deposit

## Key Rules

* Individual deposits can be any amount, but the total cannot exceed the principal
* Investors can **withdraw** their deposit at any time during this phase (debt tokens are burned)
* The phase transitions automatically to **AwaitingApproval** when total deposits equal the principal

## Funding Deadline

If the vault was created with a `funding_deadline`, the vault can be cancelled if it fails to raise the full principal by the deadline.

* Anyone can call `check_funding_expiry()` after the deadline passes
* All investor deposits are refunded
* The manager's locked collateral is released
* The vault transitions directly to **Finalized**

{% hint style="warning" %}
If no funding deadline is set (`funding_deadline = 0`), the vault remains in RaisingFunds indefinitely until fully funded.
{% endhint %}

## Relevant Functions

| Function                             | Caller   | Description                                     |
| ------------------------------------ | -------- | ----------------------------------------------- |
| `deposit(investor, amount)`          | Investor | Deposit funds and mint debt tokens              |
| `withdraw(investor, amount)`         | Investor | Withdraw deposit and burn debt tokens           |
| `check_funding_expiry()`             | Anyone   | Cancel vault if funding deadline passed         |
| `add_to_allowlist(caller, investor)` | Manager  | Add investor to allowlist (permissioned vaults) |


---

# 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/vault-lifecycle/raising-funds.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.
