NAVI Protocol Developer Docs
  • 🖥️Build with NAVI Protocol
  • 📖Smart Contract Overview
    • 1️Lending Core
    • 2️Flash Loan
    • 3️Calculator
    • 4️Dynamic Calculator
    • 5️Storage
  • 🕓Decentralized Oracle
    • 💽Oracle Interface
  • 🗺️Contract Configuration
    • 1️⃣Get the Latest Package ID
    • 2️⃣Get Pools Config and Oracle Price Feeds
    • 3️⃣Get Flashloan Config
  • 🛩️NAVI SDK
    • 1️Getting Started
    • 2️Retrieve Info & Data
    • 3️Interactions With NAVI
    • 4️PTB Functions
    • 5️Other Ways to Interact with NAVI
    • 6️Demo
  • 📲NAVI UI SDK
    • ⭐Getting Started
    • 🅰️Aggregator Components
  • 🎧Contract Integration with NAVI
    • 1️⃣Retrieve Pools Info inside Contract
    • 2️⃣Integration with Account Cap
    • 3️⃣Demo
  • 🏅NAVI Aggregator
    • 1️⃣Getting Started
    • 2️⃣Aggregator SDK
    • 3️⃣Aggregator API
    • 🛜Contact Page
  • NAVI Bridge
    • 🚀Quick Start
    • 📄Bridge SDK
  • 📊NAVI Uptime Status Page
  • 📚NAVI API Collection
    • NAVI API
    • afSui, haSui, vSui API
  • ❓FAQ
Powered by GitBook
On this page
  • Code Sample: Retrieving Reserve Pool Dynamic Fields
  • Function Example: Retrieving Borrow Cap Ceiling
  1. Contract Integration with NAVI

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:

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:

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.

PreviousContract Integration with NAVINextIntegration with Account Cap

Last updated 7 months ago

🎧
1️⃣