PerpDepository.netAssetDeposits variable can prevent users to withdraw with underflow error
PerpDepository.netAssetDeposits variable can prevent users to withdraw with underflow error\\n```\\n    function _depositAsset(uint256 amount) private {\\n        netAssetDeposits += amount;\\n\\n\\n        IERC20(assetToken).approve(address(vault), amount);\\n        vault.deposit(assetToken, amount);\\n    }\\n```\\n\\n```\\n    function _withdrawAsset(uint256 amount, address to) private {\\n        if (amount > netAssetDeposits) {\\n            revert InsufficientAssetDeposits(netAssetDeposits, amount);\\n        }\\n        netAssetDeposits -= amount;\\n\\n\\n        vault.withdraw(address(assetToken), amount);\\n        IERC20(assetToken).transfer(to, amount);\\n    }\\n```\\n\\nThe problem here is that when user deposits X assets, then he receives Y UXD tokens. And when later he redeems his Y UXD tokens he can receive more or less than X assets. This can lead to situation when netAssetDeposits variable will be seting to negative value which will revert tx.\\nExample. 1.User deposits 1 WETH when it costs 1200$. As result 1200 UXD tokens were minted and netAssetDeposits was set to 1. 2.Price of WETH has decreased and now it costs 1100. 3.User redeem his 1200 UXD tokens and receives from perp protocol 1200/1100=1.09 WETH. But because netAssetDeposits is 1, then transaction will revert inside `_withdrawAsset` function with underflow error.
As you don't use this variable anywhere else, you can remove it. Otherwise you need to have 2 variables instead: totalDeposited and totalWithdrawn.
User can't redeem all his UXD tokens.
```\\n    function _depositAsset(uint256 amount) private {\\n        netAssetDeposits += amount;\\n\\n\\n        IERC20(assetToken).approve(address(vault), amount);\\n        vault.deposit(assetToken, amount);\\n    }\\n```\\n