RageTrade senior vault USDC deposits are subject to utilization caps which can lock deposits for long periods of time leading to UXD instability
RageTrade senior vault requires that it maintains deposits above and beyond the current amount loaned to the junior vault. Currently this is set at 90%, that is the vault must maintain at least 10% more deposits than loans. Currently the junior vault is in high demand and very little can be withdrawn from the senior vault. A situation like this is far from ideal because in the even that there is a strong depeg of UXD a large portion of the collateral could be locked in the vault unable to be withdrawn.\\nDnGmxSeniorVault.sol\\n```\\nfunction beforeWithdraw(\\n    uint256 assets,\\n    uint256,\\n    address\\n) internal override {\\n    /// @dev withdrawal will fail if the utilization goes above maxUtilization value due to a withdrawal\\n    // totalUsdcBorrowed will reduce when borrower (junior vault) repays\\n    if (totalUsdcBorrowed() > ((totalAssets() - assets) * maxUtilizationBps) / MAX_BPS)\\n        revert MaxUtilizationBreached();\\n\\n    // take out required assets from aave lending pool\\n    pool.withdraw(address(asset), assets, address(this));\\n}\\n```\\n\\nDnGmxSeniorVault.sol#beforeWithdraw is called before each withdraw and will revert if the withdraw lowers the utilization of the vault below a certain threshold. This is problematic in the event that large deposits are required to maintain the stability of UXD.
I recommend three safeguards against this:\\nMonitor the current utilization of the senior vault and limit deposits if utilization is close to locking positions\\nMaintain a portion of the USDC deposits outside the vault (i.e. 10%) to avoid sudden potential liquidity crunches\\nCreate functions to balance the proportions of USDC in and out of the vault to withdraw USDC from the vault in the event that utilization threatens to lock collateral
UXD may become destabilized in the event that the senior vault has high utilization and the collateral is inaccessible
```\\nfunction beforeWithdraw(\\n    uint256 assets,\\n    uint256,\\n    address\\n) internal override {\\n    /// @dev withdrawal will fail if the utilization goes above maxUtilization value due to a withdrawal\\n    // totalUsdcBorrowed will reduce when borrower (junior vault) repays\\n    if (totalUsdcBorrowed() > ((totalAssets() - assets) * maxUtilizationBps) / MAX_BPS)\\n        revert MaxUtilizationBreached();\\n\\n    // take out required assets from aave lending pool\\n    pool.withdraw(address(asset), assets, address(this));\\n}\\n```\\n