fn update_state_on_repay(
		who: &T::AccountId,
		pool_id: CurrencyId,
		repay_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 - repay_amount
		// total_borrows_new = total_borrows - repay_amount
		let account_borrow_new = account_borrows
			.checked_sub(repay_amount)
			.ok_or(Error::<T>::RepayAmountTooBig)?;
		let total_borrows_new = pool_data
			.total_borrowed
			.checked_sub(repay_amount)
			.ok_or(Error::<T>::RepayAmountTooBig)?;

		// Write the previously calculated values into storage.
		Self::set_pool_total_borrowed(pool_id, total_borrows_new);
		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 repay 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.
/// - `repay_amount`: The amount of the underlying asset to repay.
/// - `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 repay 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.
`repay_amount`: The amount of the underlying asset to repay.
`account_borrows`: The borrow balance of account.


Updates the new borrower balance and pool total borrow balances during the repay 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 . ` repay_amount ` : The amount of the underlying asset to repay . ` account_borrows ` : The borrow balance of account .
fn update_state_on_repay(
		who: &T::AccountId,
		pool_id: CurrencyId,
		repay_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 - repay_amount
		// total_borrows_new = total_borrows - repay_amount
		let account_borrow_new = account_borrows
			.checked_sub(repay_amount)
			.ok_or(Error::<T>::RepayAmountTooBig)?;
		let total_borrows_new = pool_data
			.total_borrowed
			.checked_sub(repay_amount)
			.ok_or(Error::<T>::RepayAmountTooBig)?;
		// Write the previously calculated values into storage.
		Self::set_pool_total_borrowed(pool_id, total_borrows_new);
		Self::set_user_total_borrowed_and_interest_index(&who, pool_id, account_borrow_new, pool_data.borrow_index);
		Ok(())
	}
fn update_state_on_repay ( who : & T :: AccountId , pool_id : CurrencyId , repay_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 - repay_amount // total_borrows_new = total_borrows - repay_amount let account_borrow_new = account_borrows . checked_sub ( repay_amount ) . ok_or ( Error :: < T > :: RepayAmountTooBig ) ? ; let total_borrows_new = pool_data . total_borrowed . checked_sub ( repay_amount ) . ok_or ( Error :: < T > :: RepayAmountTooBig ) ? ; // Write the previously calculated values into storage. Self :: set_pool_total_borrowed ( pool_id , total_borrows_new ) ; 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 repay operation.
Updates the new borrower balance and pool total borrow balances during the repay operation .
who
&T::AccountId
pool_id
CurrencyId
repay_amount
Balance
account_borrows
Balance
who
&T::AccountId
pool_id
CurrencyId
repay_amount
Balance
account_borrows
Balance