fund loss because calculated Interest would be 0 in getCurrentState() due to division error
function `getCurrentState()` Gets the current state of pool variables based on the current time and other functions use it to update the contract state. it calculates interest accrued for debt from the last timestamp but because of the division error in some cases the calculated interest would be 0 and it would cause borrowers to pay no interest.\\nThis is part of `getCurrentState()` code that calculates interest:\\n```\\n // 2. Get the time passed since the last interest accrual\\n        uint _timeDelta = block.timestamp - _lastAccrueInterestTime;\\n        \\n        // 3. If the time passed is 0, return the current values\\n        if(_timeDelta == 0) return (_currentTotalSupply, _accruedFeeShares, _currentCollateralRatioMantissa, _currentTotalDebt);\\n        \\n        // 4. Calculate the supplied value\\n        uint _supplied = _totalDebt + _loanTokenBalance;\\n        // 5. Calculate the utilization\\n        uint _util = getUtilizationMantissa(_totalDebt, _supplied);\\n\\n        // 6. Calculate the collateral ratio\\n        _currentCollateralRatioMantissa = getCollateralRatioMantissa(\\n            _util,\\n            _lastAccrueInterestTime,\\n            block.timestamp,\\n            _lastCollateralRatioMantissa,\\n            COLLATERAL_RATIO_FALL_DURATION,\\n            COLLATERAL_RATIO_RECOVERY_DURATION,\\n            MAX_COLLATERAL_RATIO_MANTISSA,\\n            SURGE_MANTISSA\\n        );\\n\\n        // 7. If there is no debt, return the current values\\n        if(_totalDebt == 0) return (_currentTotalSupply, _accruedFeeShares, _currentCollateralRatioMantissa, _currentTotalDebt);\\n\\n        // 8. Calculate the borrow rate\\n        uint _borrowRate = getBorrowRateMantissa(_util, SURGE_MANTISSA, MIN_RATE, SURGE_RATE, MAX_RATE);\\n        // 9. Calculate the interest\\n        uint _interest = _totalDebt * _borrowRate * _timeDelta / (365 days * 1e18); // does the optimizer optimize this? or should it be a constant?\\n        // 10. Update the total debt\\n        _currentTotalDebt += _interest;\\n```\\n\\ncode should support all the ERC20 tokens and those tokens may have different decimals. also different pools may have different values for MIN_RATE, SURGE_RATE, MAX_RATE. imagine this scenario:\\ndebt token is USDC and has 6 digit decimals.\\nMIN_RATE is 5% (2 * 1e16) and MAX_RATE is 10% (1e17) and in current state borrow rate is 5% (5 * 1e16)\\ntimeDelta is 2 second. (two seconds passed from last accrue interest time)\\ntotalDebt is 100M USDC (100 * 1e16).\\neach year has about 31M seconds (31 * 1e6).\\nnow code would calculate interest as: `_totalDebt * _borrowRate * _timeDelta / (365 days * 1e18) = 100 * 1e6 * 5 * 1e16 * 2 / (31 * 1e16 * 1e18) = 5 * 2 / 31 = 0`.\\nso code would calculate 0 interest in each interactions and borrowers would pay 0 interest. the debt decimal and interest rate may be different for pools and code should support all of them.
don't update contract state(lastAccrueInterestTime) when calculated interest is 0. add more decimal to total debt and save it with extra 1e18 decimals and transferring or receiving debt token convert the token amount to more decimal format or from it.
borrowers won't pay any interest and lenders would lose funds.
```\\n // 2. Get the time passed since the last interest accrual\\n        uint _timeDelta = block.timestamp - _lastAccrueInterestTime;\\n        \\n        // 3. If the time passed is 0, return the current values\\n        if(_timeDelta == 0) return (_currentTotalSupply, _accruedFeeShares, _currentCollateralRatioMantissa, _currentTotalDebt);\\n        \\n        // 4. Calculate the supplied value\\n        uint _supplied = _totalDebt + _loanTokenBalance;\\n        // 5. Calculate the utilization\\n        uint _util = getUtilizationMantissa(_totalDebt, _supplied);\\n\\n        // 6. Calculate the collateral ratio\\n        _currentCollateralRatioMantissa = getCollateralRatioMantissa(\\n            _util,\\n            _lastAccrueInterestTime,\\n            block.timestamp,\\n            _lastCollateralRatioMantissa,\\n            COLLATERAL_RATIO_FALL_DURATION,\\n            COLLATERAL_RATIO_RECOVERY_DURATION,\\n            MAX_COLLATERAL_RATIO_MANTISSA,\\n            SURGE_MANTISSA\\n        );\\n\\n        // 7. If there is no debt, return the current values\\n        if(_totalDebt == 0) return (_currentTotalSupply, _accruedFeeShares, _currentCollateralRatioMantissa, _currentTotalDebt);\\n\\n        // 8. Calculate the borrow rate\\n        uint _borrowRate = getBorrowRateMantissa(_util, SURGE_MANTISSA, MIN_RATE, SURGE_RATE, MAX_RATE);\\n        // 9. Calculate the interest\\n        uint _interest = _totalDebt * _borrowRate * _timeDelta / (365 days * 1e18); // does the optimizer optimize this? or should it be a constant?\\n        // 10. Update the total debt\\n        _currentTotalDebt += _interest;\\n```\\n