UniProxy.properDepositRatio - Proper ratio will not prevent liquidity imbalance for all possible scenarios
`UniProxy.properDepositRatio` purpose is to be used as a mechanism to prevent liquidity imbalance. The idea is to compare the deposit ratio with the `hypeRatio`, which is the ratio between the tokens held by the `Hypervisor` contract. In practice, however, this function will not prevent a skewed deposit ratio in many cases. `deposit1 / deposit0` might be a huge number, while `10^16 <= depositRatio <= 10^18`, and 10^16 <= `hypeRatio` <= 10^18. Let us consider the case where `hype1 / hype0 >= 10`, that means `hypeRatio = 10^18`, and now if `deposit1 / deposit0` = 10^200 for example, `depositRatio = 10^18`, and the transaction will pass, which is clearly not intended.\\n```\\nfunction properDepositRatio(\\n  address pos,\\n  uint256 deposit0,\\n  uint256 deposit1\\n) public view returns (bool) {\\n  (uint256 hype0, uint256 hype1) = IHypervisor(pos).getTotalAmounts();\\n  if (IHypervisor(pos).totalSupply() != 0) {\\n    uint256 depositRatio = deposit0 == 0 ? 10e18 : deposit1.mul(1e18).div(deposit0);\\n    depositRatio = depositRatio > 10e18 ? 10e18 : depositRatio;\\n    depositRatio = depositRatio < 10e16 ? 10e16 : depositRatio;\\n    uint256 hypeRatio = hype0 == 0 ? 10e18 : hype1.mul(1e18).div(hype0);\\n    hypeRatio = hypeRatio > 10e18 ? 10e18 : hypeRatio;\\n    hypeRatio = hypeRatio < 10e16 ? 10e16 : hypeRatio;\\n    return (FullMath.mulDiv(depositRatio, deltaScale, hypeRatio) < depositDelta &&\\n            FullMath.mulDiv(hypeRatio, deltaScale, depositRatio) < depositDelta);\\n  }\\n  return true;\\n}\\n```\\n
Resolution\\nFixed in GammaStrategies/[email protected]9a7a3dd by deleting the `properDepositRatio` function.\\nConsider removing the cap of [0.1,10] both for `depositRatio` and for `hypeRatio`.
```\\nfunction properDepositRatio(\\n  address pos,\\n  uint256 deposit0,\\n  uint256 deposit1\\n) public view returns (bool) {\\n  (uint256 hype0, uint256 hype1) = IHypervisor(pos).getTotalAmounts();\\n  if (IHypervisor(pos).totalSupply() != 0) {\\n    uint256 depositRatio = deposit0 == 0 ? 10e18 : deposit1.mul(1e18).div(deposit0);\\n    depositRatio = depositRatio > 10e18 ? 10e18 : depositRatio;\\n    depositRatio = depositRatio < 10e16 ? 10e16 : depositRatio;\\n    uint256 hypeRatio = hype0 == 0 ? 10e18 : hype1.mul(1e18).div(hype0);\\n    hypeRatio = hypeRatio > 10e18 ? 10e18 : hypeRatio;\\n    hypeRatio = hypeRatio < 10e16 ? 10e16 : hypeRatio;\\n    return (FullMath.mulDiv(depositRatio, deltaScale, hypeRatio) < depositDelta &&\\n            FullMath.mulDiv(hypeRatio, deltaScale, depositRatio) < depositDelta);\\n  }\\n  return true;\\n}\\n```\\n