> 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/vault-lifecycle/cancelled.md).

# Cancelled

The **Cancelled** phase is reached when a vault never made it to disbursement — either the funding deadline or the approval deadline passed without the loan going live. It replaces the older behaviour of pushing refunds to every investor in a single call; refunds are now **pulled** by each investor individually.

## How a Vault Gets Cancelled

| Path                          | Trigger                                                     |
| ----------------------------- | ----------------------------------------------------------- |
| **Funding deadline expired**  | RaisingFunds → Cancelled, via `check_funding_expiry()`      |
| **Approval deadline expired** | AwaitingApproval → Cancelled, via `check_approval_expiry()` |

Both calls are permissionless — anyone can trigger them once the relevant deadline has passed.

## What Happens

1. The manager's locked collateral is released back to their available balance — **once**
2. Any borrower collateral pledge is released back to the borrower — **once**
3. The vault transitions to **Cancelled**
4. Each investor then calls `claim_refund(investor, tranche)` for their own position(s) — this burns their own debt tokens and refunds their **net** deposit (the amount actually credited to the vault, i.e. after the protocol fee already taken at deposit time)

{% hint style="info" %}
Refunds are pull-based so that a vault with many investors doesn't require a single transaction to loop over all of them — a cost that scales with the investor count would eventually exceed what a single transaction can do. Each `claim_refund` call costs the same regardless of how many other investors the vault has.
{% endhint %}

## Transition to Finalized

Once `junior_raised + senior_raised == 0` — i.e. every investor has claimed their refund — anyone can call `finalize()`. The vault transitions to **Finalized**, the terminal state.

## Relevant Functions

| Function                          | Caller   | Description                                                  |
| --------------------------------- | -------- | ------------------------------------------------------------ |
| `check_funding_expiry()`          | Anyone   | Move a stalled RaisingFunds vault to Cancelled               |
| `check_approval_expiry()`         | Anyone   | Move a stalled AwaitingApproval vault to Cancelled           |
| `claim_refund(investor, tranche)` | Investor | Pull your own refund and burn your debt tokens               |
| `finalize()`                      | Anyone   | Close the vault once every investor has claimed their refund |

*As of September 2026.*
