> For the complete documentation index, see [llms.txt](https://piggybank.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://piggybank.gitbook.io/docs/vault-infrastructure/vault-lifecycle.md).

# Vault Lifecycle

## Vault Lifecycle

The vault operates on an epoch-based system where deposits and redemptions are processed in batches. This design enables efficient management while maintaining user liquidity.

<figure><img src="/files/dM7wdRZ2jYbRzUd8eTHF" alt=""><figcaption></figcaption></figure>

### Epoch Progression

Each epoch represents a management period. When an admin calls `roll_epoch`:

1. Performance from epoch n-2 is declared
2. Deposits from epoch n-1 are withdrawn
3. Redemptions from epoch n-2 become claimable
4. Epoch counter increments

### Deposit Flow

Users can deposit at any time during an epoch:

1. User transfers underlying tokens to vault
2. Vault mints liquid tokens based on current exchange rate
3. Deposits accumulate until epoch roll
4. Admin withdraws deposits for strategy execution

The exchange rate calculation:

```
minted_lst = deposited_underlying * lst_supply / underlying_represented_by_lst
```

### Redemption Flow

Redemption occurs in three phases:

#### Phase 1: Redemption Request

* User burns liquid tokens
* System creates redemption record
* Redemption queues for processing

#### Phase 2: Processing (Epoch + 1)

* Admin processes redemptions during epoch roll
* Underlying allocated for claims

#### Phase 3: Claim (Epoch + 2)

* User claims underlying tokens
* Redemption record marked complete

### Performance Reporting

Performance impacts all liquid token holders proportionally. When positive performance is reported:

* Managed assets increase
* LST/underlying exchange rate improves

When negative performance is reported:

* Managed assets decrease
* LST/underlying exchange rate decreases

The constant exchange rate during an epoch ensures fair treatment of all deposits and redemptions within that period.


---

# 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://piggybank.gitbook.io/docs/vault-infrastructure/vault-lifecycle.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.
