fn calculate_user_borrow_balance(
		who: &T::AccountId,
		underlying_asset: CurrencyId,
		pool_borrow_index: Rate,
	) -> BalanceResult {
		let user_borrow_underlying = <LiquidityPools<T>>::get_user_borrow_balance(&who, underlying_asset);

		// If user_borrow_balance = 0 then borrow_index is likely also 0.
		// Rather than failing the calculation with a division by 0, we immediately return 0 in this case.
		if user_borrow_underlying.is_zero() {
			return Ok(Balance::zero());
		};

		let user_borrow_index = <LiquidityPools<T>>::get_user_borrow_index(&who, underlying_asset);

		// Calculate new user borrow balance using the borrow index:
		// recent_user_borrow_balance = user_borrow_balance * pool_borrow_index / user_borrow_index
		let recent_user_borrow_underlying = Rate::from_inner(user_borrow_underlying)
			.checked_mul(&pool_borrow_index)
			.and_then(|v| v.checked_div(&user_borrow_index))
			.map(|x| x.into_inner())
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;
		Ok(recent_user_borrow_underlying)
	}
/// Calculate the borrow balance of account based on pool_borrow_index calculated beforehand.
///
/// - `who`: The address whose balance should be calculated.
/// - `underlying_asset`: ID of the currency, the balance of borrowing of which we calculate.
/// - `pool_borrow_index`: borrow index for the pool
///
/// Returns the borrow balance of account in underlying assets.
Calculate the borrow balance of account based on pool_borrow_index calculated beforehand.
`who`: The address whose balance should be calculated.
`underlying_asset`: ID of the currency, the balance of borrowing of which we calculate.
`pool_borrow_index`: borrow index for the pool

Returns the borrow balance of account in underlying assets.
Calculate the borrow balance of account based on pool_borrow_index calculated beforehand . ` who ` : The address whose balance should be calculated . ` underlying_asset ` : ID of the currency the balance of borrowing of which we calculate . ` pool_borrow_index ` : borrow index for the pool Returns the borrow balance of account in underlying assets .
fn calculate_user_borrow_balance(
		who: &T::AccountId,
		underlying_asset: CurrencyId,
		pool_borrow_index: Rate,
	) -> BalanceResult {
		let user_borrow_underlying = <LiquidityPools<T>>::get_user_borrow_balance(&who, underlying_asset);
		// If user_borrow_balance = 0 then borrow_index is likely also 0.
		// Rather than failing the calculation with a division by 0, we immediately return 0 in this case.
		if user_borrow_underlying.is_zero() {
			return Ok(Balance::zero());
		};
		let user_borrow_index = <LiquidityPools<T>>::get_user_borrow_index(&who, underlying_asset);
		// Calculate new user borrow balance using the borrow index:
		// recent_user_borrow_balance = user_borrow_balance * pool_borrow_index / user_borrow_index
		let recent_user_borrow_underlying = Rate::from_inner(user_borrow_underlying)
			.checked_mul(&pool_borrow_index)
			.and_then(|v| v.checked_div(&user_borrow_index))
			.map(|x| x.into_inner())
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;
		Ok(recent_user_borrow_underlying)
	}
fn calculate_user_borrow_balance ( who : & T :: AccountId , underlying_asset : CurrencyId , pool_borrow_index : Rate , ) -> BalanceResult { let user_borrow_underlying = < LiquidityPools < T > > :: get_user_borrow_balance ( & who , underlying_asset ) ; // If user_borrow_balance = 0 then borrow_index is likely also 0. // Rather than failing the calculation with a division by 0, we immediately return 0 in this case. if user_borrow_underlying . is_zero ( ) { return Ok ( Balance :: zero ( ) ) ; } ; let user_borrow_index = < LiquidityPools < T > > :: get_user_borrow_index ( & who , underlying_asset ) ; // Calculate new user borrow balance using the borrow index: // recent_user_borrow_balance = user_borrow_balance * pool_borrow_index / user_borrow_index let recent_user_borrow_underlying = Rate :: from_inner ( user_borrow_underlying ) . checked_mul ( & pool_borrow_index ) . and_then ( | v | v . checked_div ( & user_borrow_index ) ) . map ( | x | x . into_inner ( ) ) . ok_or ( Error :: < T > :: BorrowBalanceOverflow ) ? ; Ok ( recent_user_borrow_underlying ) }
Calculate the borrow balance of account based on pool_borrow_index calculated beforehand.
Calculate the borrow balance of account based on pool_borrow_index calculated beforehand .
who
&T::AccountId
underlying_asset
CurrencyId
pool_borrow_index
Rate
who
&T::AccountId
underlying_asset
CurrencyId
pool_borrow_index
Rate