`Reserves` should not be considered part of the available liquidity while calculating the interest rate
The implementation is different from the documentation regarding the interest rate formula.\\nThe formula given in the docs:\\nCalculates Borrow rate per second:\\n$$ Borrow Rate Per Second = c3 \\cdot (util \\cdot c1 + util^{32} \\cdot c1 + util^{64} \\cdot c2) \\div secsPerYear $$\\nwhere, $util = borrows \\div (liquidity - reserves + borrows)$\\n$$ util=borrows \\div (liquidity−reserves+borrows) $$\\n```\\n    function getRateFactor() internal view returns (uint) {\\n        return (block.timestamp == lastUpdated) ?\\n            0 :\\n            ((block.timestamp - lastUpdated)*1e18)\\n            .mulWadUp(\\n                rateModel.getBorrowRatePerSecond(\\n                    asset.balanceOf(address(this)),\\n                    borrows\\n                )\\n            );\\n    }\\n```\\n\\nHowever, the current implementation is taking all the balance as the liquidity:\\n```\\n    function getBorrowRatePerSecond(\\n        uint liquidity,\\n        uint borrows\\n    )\\n        external\\n        view\\n        returns (uint)\\n    {\\n        uint util = _utilization(liquidity, borrows);\\n        return c3.mulDivDown(\\n            (\\n                util.mulWadDown(c1)\\n                + util.rpow(32, SCALE).mulWadDown(c1)\\n                + util.rpow(64, SCALE).mulWadDown(c2)\\n            ),\\n            secsPerYear\\n        );\\n    }\\n```\\n\\n```\\n    function _utilization(uint liquidity, uint borrows)\\n        internal\\n        pure\\n        returns (uint)\\n    {\\n        uint totalAssets = liquidity + borrows;\\n        return (totalAssets == 0) ? 0 : borrows.divWadDown(totalAssets);\\n    }\\n```\\n
Issue `Reserves` should not be considered part of the available liquidity while calculating the interest rate\\nThe implementation of `getRateFactor()` can be updated to:\\n```\\nfunction getRateFactor() internal view returns (uint) {\\n    return (block.timestamp == lastUpdated) ?\\n        0 :\\n        ((block.timestamp - lastUpdated)*1e18)\\n        .mulWadUp(\\n            rateModel.getBorrowRatePerSecond(\\n                asset.balanceOf(address(this)) - reserves,\\n                borrows\\n            )\\n        );\\n}\\n```\\n\\nSentiment Team\\nRemoved reserves from LToken and added an alternate mechanism to collect direct fees.\\nLead Senior Watson\\noriginationFee may result in the borrower account becoming liquidatable immediately (aka WP-M2).\\nSentiment Team\\nFixed as recommended. PR here.\\nLead Senior Watson\\nriskEngine.isBorrowAllowed should be removed as it's no longer needed.\\nSentiment Team\\nPushed a commit to remove the redundant call to riskEngine. PR here.
Per the docs, when calculating the interest rate, `util` is the ratio of available liquidity to the `borrows`, available liquidity should not include reserves.\\nThe current implementation is using all the balance as the `liquidity`, this will make the interest rate lower than expectation.\\nPoC\\nGiven:\\n`asset.address(this) + borrows = 10000`\\n`reserves = 1500, borrows = 7000`\\nExpected result:\\nWhen calculating `getRateFactor()`, available liquidity should be `asset.balanceOf(address(this)) - reserves = 1500, util = 7000 / 8500 = 0.82`, `getBorrowRatePerSecond() = 9114134329`\\nActual result:\\nWhen calculating `getRateFactor()`, `asset.balanceOf(address(this)) = 3000, util = 0.7e18`, `getBorrowRatePerSecond() = 7763863430`\\nThe actual interest rate is only `7763863430 / 9114134329 = 85%` of the expected rate.
```\\n    function getRateFactor() internal view returns (uint) {\\n        return (block.timestamp == lastUpdated) ?\\n            0 :\\n            ((block.timestamp - lastUpdated)*1e18)\\n            .mulWadUp(\\n                rateModel.getBorrowRatePerSecond(\\n                    asset.balanceOf(address(this)),\\n                    borrows\\n                )\\n            );\\n    }\\n```\\n