function _isSolvent(
	address user,
	uint256 _exchangeRate
) internal view returns (bool) {
	// accrue must have already been called!
	uint256 borrowPart = userBorrowPart[user];
	if (borrowPart == 0) return true;
	uint256 collateralShare = userCollateralShare[user];
	if (collateralShare == 0) return false;

	Rebase memory _totalBorrow = totalBorrow;

	return
		yieldBox.toAmount(
			collateralId,
			collateralShare *
				(EXCHANGE_RATE_PRECISION / FEE_PRECISION) *
				collateralizationRate,
			false
		) >=
		// Moved exchangeRate here instead of dividing the other side to preserve more precision
		(borrowPart * _totalBorrow.elastic * _exchangeRate) /
			_totalBorrow.base;
}
yieldBox.toAmount(
			collateralId,
			collateralShare *
				(EXCHANGE_RATE_PRECISION / FEE_PRECISION) *
				collateralizationRate,
			false
		)
    function _toAmount(
        uint256 share,
        uint256 totalShares_,
        uint256 totalAmount,
        bool roundUp
    ) internal pure returns (uint256 amount) {
        // To prevent reseting the ratio due to withdrawal of all shares, we start with
        // 1 amount/1e8 shares already burned. This also starts with a 1 : 1e8 ratio which
        // functions like 8 decimal fixed point math. This prevents ratio attacks or inaccuracy
        // due to 'gifting' or rebasing tokens. (Up to a certain degree)
        totalAmount++;
        totalShares_ += 1e8;
	function _computeMaxAndMinLTVInAsset(
		uint256 collateralShare,
		uint256 _exchangeRate
	) internal view returns (uint256 min, uint256 max) {
		uint256 collateralAmount = yieldBox.toAmount(
			collateralId,
			collateralShare,
			false
		);

		max = (collateralAmount * EXCHANGE_RATE_PRECISION) / _exchangeRate;
		min = (max * collateralizationRate) / FEE_PRECISION;
	}
[PASS] test_borrow_repay() (gas: 118001)
Logs:
  ===BORROW===
  UserBorrowPart: 745372500000000000000
  Total Borrow Base: 745372500000000000000
  Total Borrow Elastic: 745372500000000000000
  ===356 days passed===
  Total Borrow Elastic: 749089151896269477984
  ===Solvency#1 => multiply by share===
  A: 749999999999925000000750007499999924999
  B: 749089151896269477984000000000000000000
  ===Solvency#2 => multiply by amount===
  A: 749999999999925000000750000000000000000
  B: 749089151896269477984000000000000000000
  ===Result===
  Solvency#1.A != Solvency#2.A

Test result: ok. 1 passed; 0 failed; finished in 16.69ms
