4ī¸Dynamic Calculator

This module contains calculation functions used for determining user-specific and potential future state values in the NAVI lending and borrowing.

This module includes functions to dynamically calculate a user's health factor, collateral value, loan value, APY, and more, accounting for potential changes in the user's balances.

It is utilized for risk management and user-interface purposes, such as determining whether a user's actions might put their account at risk of liquidation, or providing insights into the potential impact of a user's intended actions on their account.

dynamic_health_factor

Description: This function calculates a user's dynamic health factor, considering potential changes in their supply and borrow balances. It helps assess the user's risk level in relation to liquidation.

Use Cases: This function is used when estimating how a user's health factor would be affected by an increase or decrease in their supplied or borrowed assets. It is critical for risk management and liquidation prevention.

public fun dynamic_health_factor<CoinType>(
  clock: &Clock,
  storage: &mut Storage,
  oracle: &PriceOracle,
  pool: &mut Pool<CoinType>,
  user: address,
  asset: u8,
  estimate_supply_value: u64, 
  estimate_borrow_value: u64, 
  is_increase: bool
): u256 {}

dynamic_calculate_apy

Description: This function calculates the dynamic APY based on changes in a user's supply and borrow balances. It provides both the supply APY and borrow APY.

Use Cases: This function is used to estimate how changes in a user's supply and borrow amounts will impact their expected yield. It is essential for users deciding whether to adjust their positions in a lending pool.

public fun dynamic_calculate_apy<CoinType>(
  clock: &Clock, 
  storage: &mut Storage, 
  pool: &mut Pool<CoinType>, 
  asset: u8, 
  estimate_supply_value: u64, 
  estimate_borrow_value: u64, 
  is_increase: bool
): (u256, u256){}

Last updated