fn update_state_on_borrow(
		who: &T::AccountId,
		pool_id: CurrencyId,
		borrow_amount: Balance,
		account_borrows: Balance,
	) -> DispatchResult {
		let pool_data = Self::get_pool_data(pool_id);

		// Calculate the new borrower and total borrow balances, failing on overflow:
		// account_borrows_new = account_borrows + borrow_amount
		// total_borrows_new = total_borrows + borrow_amount
		let account_borrow_new = account_borrows
			.checked_add(borrow_amount)
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;
		let new_total_borrows = pool_data
			.total_borrowed
			.checked_add(borrow_amount)
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;

		// Write the previously calculated values into storage.
		Self::set_pool_total_borrowed(pool_id, new_total_borrows);

		Self::set_user_total_borrowed_and_interest_index(&who, pool_id, account_borrow_new, pool_data.borrow_index);

		Ok(())
	}
/// Updates the new borrower balance and pool total borrow balances during the borrow operation.
/// Also sets the global borrow_index to user interest index.
/// - `who`: The AccountId whose borrow balance should be calculated.
/// - `pool_id`: PoolID whose total borrow balance should be calculated.
/// - `borrow_amount`: The amount of the underlying asset to borrow.
/// - `account_borrows`: The borrow balance of account.
///
/// calculates: `account_borrows_new = account_borrows + borrow_amount`,
///             `total_borrows_new = total_borrows + borrow_amount`.
Updates the new borrower balance and pool total borrow balances during the borrow operation.
Also sets the global borrow_index to user interest index.
`who`: The AccountId whose borrow balance should be calculated.
`pool_id`: PoolID whose total borrow balance should be calculated.
`borrow_amount`: The amount of the underlying asset to borrow.
`account_borrows`: The borrow balance of account.


Updates the new borrower balance and pool total borrow balances during the borrow operation . Also sets the global borrow_index to user interest index . ` who ` : The AccountId whose borrow balance should be calculated . ` pool_id ` : PoolID whose total borrow balance should be calculated . ` borrow_amount ` : The amount of the underlying asset to borrow . ` account_borrows ` : The borrow balance of account .
fn update_state_on_borrow(
		who: &T::AccountId,
		pool_id: CurrencyId,
		borrow_amount: Balance,
		account_borrows: Balance,
	) -> DispatchResult {
		let pool_data = Self::get_pool_data(pool_id);
		// Calculate the new borrower and total borrow balances, failing on overflow:
		// account_borrows_new = account_borrows + borrow_amount
		// total_borrows_new = total_borrows + borrow_amount
		let account_borrow_new = account_borrows
			.checked_add(borrow_amount)
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;
		let new_total_borrows = pool_data
			.total_borrowed
			.checked_add(borrow_amount)
			.ok_or(Error::<T>::BorrowBalanceOverflow)?;
		// Write the previously calculated values into storage.
		Self::set_pool_total_borrowed(pool_id, new_total_borrows);
		Self::set_user_total_borrowed_and_interest_index(&who, pool_id, account_borrow_new, pool_data.borrow_index);
		Ok(())
	}
fn update_state_on_borrow ( who : & T :: AccountId , pool_id : CurrencyId , borrow_amount : Balance , account_borrows : Balance , ) -> DispatchResult { let pool_data = Self :: get_pool_data ( pool_id ) ; // Calculate the new borrower and total borrow balances, failing on overflow: // account_borrows_new = account_borrows + borrow_amount // total_borrows_new = total_borrows + borrow_amount let account_borrow_new = account_borrows . checked_add ( borrow_amount ) . ok_or ( Error :: < T > :: BorrowBalanceOverflow ) ? ; let new_total_borrows = pool_data . total_borrowed . checked_add ( borrow_amount ) . ok_or ( Error :: < T > :: BorrowBalanceOverflow ) ? ; // Write the previously calculated values into storage. Self :: set_pool_total_borrowed ( pool_id , new_total_borrows ) ; Self :: set_user_total_borrowed_and_interest_index ( & who , pool_id , account_borrow_new , pool_data . borrow_index ) ; Ok ( ( ) ) }
Updates the new borrower balance and pool total borrow balances during the borrow operation.
Updates the new borrower balance and pool total borrow balances during the borrow operation .
who
&T::AccountId
pool_id
CurrencyId
borrow_amount
Balance
account_borrows
Balance
who
&T::AccountId
pool_id
CurrencyId
borrow_amount
Balance
account_borrows
Balance