JUSDBank users can bypass individual collateral borrow limits
JUSDBank imposes individual borrow caps on each collateral. The issue is that this can be bypassed due to the fact that withdraw and borrow use different methods to determine if an account is safe.\\n```\\n    function borrow(\\n        uint256 amount,\\n        address to,\\n        bool isDepositToJOJO\\n    ) external override nonReentrant nonFlashLoanReentrant{\\n        //     t0BorrowedAmount = borrowedAmount /  getT0Rate\\n        DataTypes.UserInfo storage user = userInfo[msg.sender];\\n        _borrow(user, isDepositToJOJO, to, amount, msg.sender);\\n        require(\\n            _isAccountSafeAfterBorrow(user, getTRate()),\\n            JUSDErrors.AFTER_BORROW_ACCOUNT_IS_NOT_SAFE\\n        );\\n    }\\n```\\n\\nWhen borrowing the contract calls _isAccountSafeAfterBorrow. This imposes a max borrow on each collateral type that guarantees that the user cannot borrow more than the max for each collateral type. The issues is that withdraw doesn't impose this cap. This allows a user to bypass this cap as shown in the example below.\\nExample: Assume WETH and WBTC both have a cap of 10,000 borrow. The user deposits $30,000 WETH and takes a flashloand for $30,000 WBTC. Now they deposit both and borrow 20,000 JUSD. They then withdraw all their WBTC to repay the flashloan and now they have borrowed 20,000 against $30000 in WETH
Always use _isAccountSafeAfterBorrow
Deposit caps can be easily surpassed creating systematic risk for the system
```\\n    function borrow(\\n        uint256 amount,\\n        address to,\\n        bool isDepositToJOJO\\n    ) external override nonReentrant nonFlashLoanReentrant{\\n        //     t0BorrowedAmount = borrowedAmount /  getT0Rate\\n        DataTypes.UserInfo storage user = userInfo[msg.sender];\\n        _borrow(user, isDepositToJOJO, to, amount, msg.sender);\\n        require(\\n            _isAccountSafeAfterBorrow(user, getTRate()),\\n            JUSDErrors.AFTER_BORROW_ACCOUNT_IS_NOT_SAFE\\n        );\\n    }\\n```\\n