> For the complete documentation index, see [llms.txt](https://docs.frax.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frax.finance/fraxlend/advanced-concepts/vault-account.md).

# Vault Account

The **Vault Account** is a struct used for accounting in the Fraxlend Pair:

```solidity
struct VaultAccount {
    uint128 amount;
    uint128 shares;
}
```

The **Vault Account** contains two elements:

1. **`amount`** - represents a total amount
2. **`shares`** - represents claims against the amount

#### Lending Accounting

In lending, **`amount`** represents the total amount of assets deposited and the interest accrued.

When lenders deposit assets, the amount of assets deposited increases **`amount`,** the **`shares`** value is also increased by an amount such that the ratio between **`amount`**/**`shares`** remains unchanged.

When interest is accrued, **`amount`** is increased and **`shares`** remains the same.  Each lender's share of the underlying assets are measured in shares.

When lenders remove liquidity, they redeem shares for the underlying asset.  The **`shares`** amount will be decreased by the number of shares redeemed, the **`amount`** will be decreased such that the ratio between **`amount`**/**`shares`** remains unchanged.

**Borrow Accounting**

In borrowing, **`amount`** represents the total amount of assets borrowed and the interest accrued.

When borrowers receive assets, the number of tokens received increases **`amount`,** the **`shares`** value is also increased by an amount such that the ratio between **`amount`**/**`shares`** remains unchanged.

When interest is accrued, **`amount`** is increased and **`shares`** remains the same.  Each borrower's debt is measured in shares.

When borrower's repay debt, **`amount`** is decremented by the amount of assets returned, **`shares`** is decreased by an amount such that the ratio of **`amount`**/**`shares`** remain unchanged.  An individual borrowers shares balance is decremented by this number of shares.


---

# 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.frax.finance/fraxlend/advanced-concepts/vault-account.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.
