> 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/contract-integration-with-navi/retrieve-pools-info-inside-contract.md).

# Retrieve Pools Info inside Contract

With the provided link, you can access all the interactable interfaces within the NAVI protocol's smart contracts.

### Code Sample: Retrieving Reserve Pool Dynamic Fields

Here’s a sample struct that defines the dynamic fields of a reserve pool:

```rust
struct ReserveData has store {
    id: u8,
    oracle_id: u8,
    coin_type: String,
    is_isolated: bool,
    supply_cap_ceiling: u256,
    borrow_cap_ceiling: u256,
    current_supply_rate: u256,
    current_borrow_rate: u256,
    current_supply_index: u256,
    current_borrow_index: u256,
    supply_balance: TokenBalance,
    borrow_balance: TokenBalance,
    last_update_timestamp: u64,
    ltv: u256,
    treasury_factor: u256,
    treasury_balance: u256,
    borrow_rate_factors: BorrowRateFactors,
    liquidation_factors: LiquidationFactors,
    reserve_field_a: u256,
    reserve_field_b: u256,
    reserve_field_c: u256,
}
```

### Function Example: Retrieving Borrow Cap Ceiling

This function retrieves the `borrow_cap_ceiling` field from the `ReserveData` struct:

```rust
public fun borrow_cap(
    object: &mut ReserveData,
): u256 {
    &object.borrow_cap_ceiling
}
```

This sample demonstrates how to access dynamic reserve pool fields such as the borrowing cap, which plays a crucial role in the risk management and lending/borrowing logic within the protocol.


---

# 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/contract-integration-with-navi/retrieve-pools-info-inside-contract.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.
