Borrower collateral that they are owed can get stuck in Vault and not sent back to them after calling `repay`
First, let's say that a borrower called `borrow` in `LiquidityBorrowingManager`. Then, they call increase `increaseCollateralBalance` with a large collateral amount. A short time later, they decide they want to `repay` so they call `repay`.\\nIn `repay`, we have the following code:\\n```\\n            if (\\n                collateralBalance > 0 &&\\n                (currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION >\\n                Constants.MINIMUM_AMOUNT\\n            ) {\\n                liquidationBonus +=\\n                    uint256(collateralBalance) /\\n                    Constants.COLLATERAL_BALANCE_PRECISION;\\n            } else {\\n                currentFees = borrowing.dailyRateCollateralBalance;\\n            }\\n```\\n\\nNotice that if we have `collateralBalance > 0` BUT `!((currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION > Constants.MINIMUM_AMOUNT)` (i.e. the first part of the if condition is fine but the second is not. It makes sense the second part is not fine because the borrower is repaying not long after they borrowed, so fees haven't had a long time to accumulate), then we will still go to `currentFees = borrowing.dailyRateCollateralBalance;` but we will not do:\\n```\\n                liquidationBonus +=\\n                    uint256(collateralBalance) /\\n                    Constants.COLLATERAL_BALANCE_PRECISION;\\n```\\n\\nHowever, later on in the code, we have:\\n```\\n            Vault(VAULT_ADDRESS).transferToken(\\n                borrowing.holdToken,\\n                address(this),\\n                borrowing.borrowedAmount + liquidationBonus\\n            );\\n```\\n\\nSo, the borrower's collateral will actually not even be sent back to the LiquidityBorrowingManager from the Vault (since we never incremented liquidationBonus). We later do:\\n```\\n            _pay(borrowing.holdToken, address(this), msg.sender, holdTokenBalance);\\n            _pay(borrowing.saleToken, address(this), msg.sender, saleTokenBalance);\\n```\\n\\nSo clearly the user will not receive their collateral back.
You should separate:\\n```\\n            if (\\n                collateralBalance > 0 &&\\n                (currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION >\\n                Constants.MINIMUM_AMOUNT\\n            ) {\\n                liquidationBonus +=\\n                    uint256(collateralBalance) /\\n                    Constants.COLLATERAL_BALANCE_PRECISION;\\n            } else {\\n                currentFees = borrowing.dailyRateCollateralBalance;\\n            }\\n```\\n\\nInto two separate if statements. One should check if `collateralBalance > 0`, and if so, increment liquidationBonus. The other should check `(currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION > Constants.MINIMUM_AMOUNT` and if not, set `currentFees = borrowing.dailyRateCollateralBalance;`.
User's collateral will be stuck in Vault when it should be sent back to them. This could be a large amount of funds if for example `increaseCollateralBalance` is called first.
```\\n            if (\\n                collateralBalance > 0 &&\\n                (currentFees + borrowing.feesOwed) / Constants.COLLATERAL_BALANCE_PRECISION >\\n                Constants.MINIMUM_AMOUNT\\n            ) {\\n                liquidationBonus +=\\n                    uint256(collateralBalance) /\\n                    Constants.COLLATERAL_BALANCE_PRECISION;\\n            } else {\\n                currentFees = borrowing.dailyRateCollateralBalance;\\n            }\\n```\\n