Vulnerability: Oracle slippage rate is used for checking primary and secondary ratio
Severity: medium

Description:
The oracle slippage rate (oraclePriceDeviationLimitPercent) is used for checking the ratio of the primary and secondary tokens to be deposited into the pool.\\nAs a result, changing the `oraclePriceDeviationLimitPercent` setting to increase or decrease the allowable slippage between the spot and oracle prices can cause unexpected side-effects to the `_checkPrimarySecondaryRatio` function, which might break the `reinvestReward` function that relies on the `_checkPrimarySecondaryRatio` function under certain condition.\\nThe `_checkPriceLimit` function is for the purpose of comparing the spot price with the oracle price. Thus, the slippage (oraclePriceDeviationLimitPercent) is specially selected for this purpose.\\n```\\nFile: StrategyUtils.sol\\n    function _checkPriceLimit(\\n        StrategyContext memory strategyContext,\\n        uint256 oraclePrice,\\n        uint256 poolPrice\\n    ) internal pure {\\n        uint256 lowerLimit = (oraclePrice * \\n            (VaultConstants.VAULT_PERCENT_BASIS - strategyContext.vaultSettings.oraclePriceDeviationLimitPercent)) / \\n            VaultConstants.VAULT_PERCENT_BASIS;\\n        uint256 upperLimit = (oraclePrice * \\n            (VaultConstants.VAULT_PERCENT_BASIS + strategyContext.vaultSettings.oraclePriceDeviationLimitPercent)) / \\n            VaultConstants.VAULT_PERCENT_BASIS;\\n\\n        if (poolPrice < lowerLimit || upperLimit < poolPrice) {\\n            revert Errors.InvalidPrice(oraclePrice, poolPrice);\\n        }\\n    }\\n```\\n\\nHowever, it was observed that `_checkPriceLimit` function is repurposed for checking if the ratio of the primary and secondary tokens to be deposited to the pool is more or less proportional to the pool's balances within the `_checkPrimarySecondaryRatio` function during reinvestment.\\nThe `oraclePriceDeviationLimitPercent` setting should not be used here as it does not involve any oracle data. Thus, the correct way is to define another setting specifically for checking if the ratio of the primary and secondary tokens to be deposited to the pool is more or less proportional to the pool's balances.\\n```\\nFile: Curve2TokenPoolUtils.sol\\n    function _checkPrimarySecondaryRatio(\\n        StrategyContext memory strategyContext,\\n        uint256 primaryAmount, \\n        uint256 secondaryAmount, \\n        uint256 primaryPoolBalance, \\n        uint256 secondaryPoolBalance\\n    ) private pure {\\n        uint256 totalAmount = primaryAmount + secondaryAmount;\\n        uint256 totalPoolBalance = primaryPoolBalance + secondaryPoolBalance;\\n\\n        uint256 primaryPercentage = primaryAmount * CurveConstants.CURVE_PRECISION / totalAmount;        \\n        uint256 expectedPrimaryPercentage = primaryPoolBalance * CurveConstants.CURVE_PRECISION / totalPoolBalance;\\n\\n        strategyContext._checkPriceLimit(expectedPrimaryPercentage, primaryPercentage);\\n\\n        uint256 secondaryPercentage = secondaryAmount * CurveConstants.CURVE_PRECISION / totalAmount;\\n        uint256 expectedSecondaryPercentage = secondaryPoolBalance * CurveConstants.CURVE_PRECISION / totalPoolBalance;\\n\\n        strategyContext._checkPriceLimit(expectedSecondaryPercentage, secondaryPercentage);\\n    }\\n```\\n

Impact:
Changing the `oraclePriceDeviationLimitPercent` setting to increase or decrease the allowable slippage between the spot price and oracle price can cause unexpected side-effects to the `_checkPrimarySecondaryRatio` function, which might break the `reinvestReward` function that relies on the `_checkPrimarySecondaryRatio` function under certain condition.\\nAdditionally, the value chosen for the `oraclePriceDeviationLimitPercent` is to compare the spot price with the oracle price. Thus, it might not be the optimal value for checking if the ratio of the primary and secondary tokens deposited to the pool is more or less proportional to the pool's balances.

Recommended mitigation:
There is a difference between the slippage for the following two items:\\nAllowable slippage between the spot price and oracle price\\nAllowable slippage between the ratio of the primary and secondary tokens to be deposited to the pool against the pool's balances\\nSince they serve a different purposes, they should not share the same slippage. Consider defining a separate slippage setting and function for checking if the ratio of the primary and secondary tokens deposited to the pool is more or less proportional to the pool's balances.