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.
Last updated