Incorrect function call leads to stale borrowing fees
Due to an incorrect function call while getting the total borrow fees, the returned fees will be an inaccurate and stale amount. Which will have an impact on liquidity providers\\nAs said the function getTotalBorrowingFees:\\n```\\nfunction getTotalBorrowingFees(DataStore dataStore, address market, address longToken, address shortToken, bool isLong) internal view returns (uint256) {\\n    uint256 openInterest = getOpenInterest(dataStore, market, longToken, shortToken, isLong);\\n    uint256 cumulativeBorrowingFactor = getCumulativeBorrowingFactor(dataStore, market, isLong);\\n    uint256 totalBorrowing = getTotalBorrowing(dataStore, market, isLong);\\n    return openInterest * cumulativeBorrowingFactor - totalBorrowing;\\n}\\n```\\n\\ncalculates the fess by calling getCumulativeBorrowingFactor(...):\\nwhich is the wrong function to call because it returns a stale borrowing factor. To get the actual borrowing factor and calculate correctly the borrowing fees, GMX should call the `getNextCumulativeBorrowingFactor` function:\\nWhich makes the right calculation, taking into account the stale fees also:\\n```\\n    uint256 durationInSeconds = getSecondsSinceCumulativeBorrowingFactorUpdated(dataStore, market.marketToken, isLong);\\n    uint256 borrowingFactorPerSecond = getBorrowingFactorPerSecond(\\n        dataStore,\\n        market,\\n        prices,\\n        isLong\\n    );\\n\\n    uint256 cumulativeBorrowingFactor = getCumulativeBorrowingFactor(dataStore, market.marketToken, isLong);\\n\\n    uint256 delta = durationInSeconds * borrowingFactorPerSecond;\\n    uint256 nextCumulativeBorrowingFactor = cumulativeBorrowingFactor + delta;\\n    return (nextCumulativeBorrowingFactor, delta);\\n```\\n
In order to mitigate the issue, call the function `getNextCumulativeBorrowingFactor` instead of the function `getCumulativeBorrowingFactor()` for a correct accounting and not getting stale fees
Ass fee calculation will not be accurate, liquidity providers will be have a less-worth token because pending fees are not accounted in the pool's value
```\\nfunction getTotalBorrowingFees(DataStore dataStore, address market, address longToken, address shortToken, bool isLong) internal view returns (uint256) {\\n    uint256 openInterest = getOpenInterest(dataStore, market, longToken, shortToken, isLong);\\n    uint256 cumulativeBorrowingFactor = getCumulativeBorrowingFactor(dataStore, market, isLong);\\n    uint256 totalBorrowing = getTotalBorrowing(dataStore, market, isLong);\\n    return openInterest * cumulativeBorrowingFactor - totalBorrowing;\\n}\\n```\\n