When the `JUSDBank.withdraw()` is to another internal account the `ReserveInfo.isDepositAllowed` is not validated
The internal withdraw does not validate if the collateral reserve has activated/deactivated the isDepositAllowed variable\\nThe JUSDBank.withdraw() function has a param called isInternal that helps to indicate if the withdraw amount is internal between accounts or not. When the withdraw is internal the `ReserveInfo.isDepositAllowed` is not validated.\\n```\\nFile: JUSDBank.sol\\n    function _withdraw(\\n        uint256 amount,\\n        address collateral,\\n        address to,\\n        address from,\\n        bool isInternal\\n    ) internal {\\n// rest of code\\n// rest of code\\n        if (isInternal) {\\n            DataTypes.UserInfo storage toAccount = userInfo[to];\\n            _addCollateralIfNotExists(toAccount, collateral);\\n            toAccount.depositBalance[collateral] += amount;\\n            require(\\n                toAccount.depositBalance[collateral] <=\\n                    reserve.maxDepositAmountPerAccount,\\n                JUSDErrors.EXCEED_THE_MAX_DEPOSIT_AMOUNT_PER_ACCOUNT\\n            );\\n// rest of code\\n// rest of code\\n```\\n\\nIn the other hand, the `isDepositAllowed` is validated in the deposit function in the `code line 255` but the withdraw to internal account is not validated.\\n```\\nFile: JUSDBank.sol\\n    function _deposit(\\n        DataTypes.ReserveInfo storage reserve,\\n        DataTypes.UserInfo storage user,\\n        uint256 amount,\\n        address collateral,\\n        address to,\\n        address from\\n    ) internal {\\n        require(reserve.isDepositAllowed, JUSDErrors.RESERVE_NOT_ALLOW_DEPOSIT);\\n```\\n\\nAdditionally, the `ReserveInfo.isDepositAllowed` can be modified via the JUSDOperation.delistReserve() function. So any collateral's deposits can be deactivated at any time.\\n```\\nFile: JUSDOperation.sol\\n    function delistReserve(address collateral) external onlyOwner {\\n        DataTypes.ReserveInfo storage reserve = reserveInfo[collateral];\\n        reserve.isBorrowAllowed = false;\\n        reserve.isDepositAllowed = false;\\n        reserve.isFinalLiquidation = true;\\n        emit RemoveReserve(collateral);\\n    }\\n```\\n
Add a `Reserve.isDepositAllowed` validation when the withdrawal is to another internal account.\\n```\\nFile: JUSDBank.sol\\n    function _withdraw(\\n        uint256 amount,\\n        address collateral,\\n        address to,\\n        address from,\\n        bool isInternal\\n    ) internal {\\n// rest of code\\n// rest of code\\n        if (isInternal) {\\n// Add the line below\\n// Add the line below\\n          require(reserve.isDepositAllowed, JUSDErrors.RESERVE_NOT_ALLOW_DEPOSIT);\\n            DataTypes.UserInfo storage toAccount = userInfo[to];\\n            _addCollateralIfNotExists(toAccount, collateral);\\n            toAccount.depositBalance[collateral] // Add the line below\\n= amount;\\n            require(\\n                toAccount.depositBalance[collateral] <=\\n                    reserve.maxDepositAmountPerAccount,\\n                JUSDErrors.EXCEED_THE_MAX_DEPOSIT_AMOUNT_PER_ACCOUNT\\n            );\\n// rest of code\\n// rest of code\\n```\\n
The collateral's reserve can get deposits via the internal withdraw even when the `Reserve.isDepositAllowed` is turned off making the `Reserve.isDepositAllowed` useless because the collateral deposits can be via `internal withdrawals`.
```\\nFile: JUSDBank.sol\\n    function _withdraw(\\n        uint256 amount,\\n        address collateral,\\n        address to,\\n        address from,\\n        bool isInternal\\n    ) internal {\\n// rest of code\\n// rest of code\\n        if (isInternal) {\\n            DataTypes.UserInfo storage toAccount = userInfo[to];\\n            _addCollateralIfNotExists(toAccount, collateral);\\n            toAccount.depositBalance[collateral] += amount;\\n            require(\\n                toAccount.depositBalance[collateral] <=\\n                    reserve.maxDepositAmountPerAccount,\\n                JUSDErrors.EXCEED_THE_MAX_DEPOSIT_AMOUNT_PER_ACCOUNT\\n            );\\n// rest of code\\n// rest of code\\n```\\n