Module 0xd5044d9f4b80910ef7b8910a68d2ac257d14319fb9315ddce1ca5190878bc8ea::generic_logic

@title Generic Logic module @author Aave @notice Implements protocol-level logic to calculate and validate the state of a user

use 0x1::object;
use 0xa888dd108ea636a234c973b8b72b9cadf0c7ae94d6f355c64dde9fdc275724ee::reserve_config;
use 0xa888dd108ea636a234c973b8b72b9cadf0c7ae94d6f355c64dde9fdc275724ee::user_config;
use 0xc1b23ac8ce67df6361b241bfa30a22c9b177fe39c471334a514eea977e6673a9::oracle;
use 0xd5044d9f4b80910ef7b8910a68d2ac257d14319fb9315ddce1ca5190878bc8ea::a_token_factory;
use 0xd5044d9f4b80910ef7b8910a68d2ac257d14319fb9315ddce1ca5190878bc8ea::pool;
use 0xd5044d9f4b80910ef7b8910a68d2ac257d14319fb9315ddce1ca5190878bc8ea::variable_debt_token_factory;
use 0xd63343bff7977cb364b17dcdcdeb64e77b7bc9b4ec252f481ace51b6de3bbd96::math_utils;
use 0xd63343bff7977cb364b17dcdcdeb64e77b7bc9b4ec252f481ace51b6de3bbd96::wad_ray_math;

Function calculate_user_account_data

@notice Calculates the user data across the reserves. @dev It includes the total liquidity/collateral/borrow balances in the base currency used by the price feed, the average Loan To Value, the average Liquidation Ratio, and the Health factor. @param user_config_map The user configuration map @param reserves_count The number of reserves @param user The address of the user @param user_emode_category The category of the user in the emode @param emode_ltv The ltv of the user in the emode @param emode_liq_threshold The liquidation threshold of the user in the emode @return The total collateral of the user in the base currency used by the price feed @return The total debt of the user in the base currency used by the price feed @return The average ltv of the user @return The average liquidation threshold of the user @return The health factor of the user @return True if the user has a zero-LTV asset enabled as collateral

public fun calculate_user_account_data(user_config_map: &user_config::UserConfigurationMap, reserves_count: u256, user: address, user_emode_category: u8, emode_ltv: u256, emode_liq_threshold: u256): (u256, u256, u256, u256, u256, bool)

Function calculate_available_borrows

@notice Calculates the maximum amount that can be borrowed depending on the available collateral, the total debt and the average Loan To Value @param total_collateral_in_base_currency The total collateral in the base currency used by the price feed @param total_debt_in_base_currency The total borrow balance in the base currency used by the price feed @param ltv The average loan to value @return The amount available to borrow in the base currency of the used by the price feed

public fun calculate_available_borrows(total_collateral_in_base_currency: u256, total_debt_in_base_currency: u256, ltv: u256): u256