> For the complete documentation index, see [llms.txt](https://naviprotocol.gitbook.io/navi-protocol-developer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://naviprotocol.gitbook.io/navi-protocol-developer-docs/smart-contract-overview/storage.md).

# Storage

This module provides key information related to the reserves in the lending pool and user-specific data, such as asset holdings and balances. They are crucial for tracking the state of the protocol and individual user interactions, helping developers and users manage their assets within the NAVI protocol.

### get\_reserves\_count

> **Description:** This function returns the number of reserve assets available in the storage pool. It provides an overview of how many different assets are being managed in the lending protocol.&#x20;

> **Use Cases:** This function is used when a developer or user needs to know the total number of asset reserves in the pool, typically for pool status checks or when initializing interactions with multiple reserves.

```rust
public fun get_reserves_count(
    storage: &Storage
): u8 {}
```

### get\_user\_assets

> **Description:** This function retrieves the list of assets and their respective balances held by a specific user within the storage pool. It returns vectors representing the asset IDs and their corresponding values.

> **Use Cases:** This function is used to get a comprehensive view of a user's asset holdings in the lending pool, useful for portfolio management or determining eligibility for borrowing and rewards.

```rust
public fun get_user_assets(
    storage: &Storage, 
    user: address
): (vector<u8>, vector<u8>) {}

```

### get\_user\_balance

> **Description:** This function returns the balance of a specific asset for a given user, including both supply and borrow amounts. It is essential for tracking the user's positions within the lending protocol.

> **Use Cases:** This function is used when a user or developer needs to check the current balance of an asset supplied or borrowed by a specific user, which is critical for monitoring positions and potential liquidation risks.

```rust
public fun get_user_balance(
    storage: &mut Storage, 
    asset: u8, 
    user: address
): (u256, u256) {}

```


---

# 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://naviprotocol.gitbook.io/navi-protocol-developer-docs/smart-contract-overview/storage.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.
