We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: the current version of GeneralConvexStrategy.sol doesn't compile as far as I can see.
using SafeMath for uint8; ==> could lead to using uint8.
Using uint8 might lead to overflows. The Solidity compiler 6.12 gives the following warning when doing 10**uint8variable:
Warning: Result of exponentiation has type uint8 and thus might overflow.
Luckily because balances(..) is an uint256 the code of getMostPremium() doesn't go wrong.
metavault/contracts/v3/strategies/GeneralConvexStrategy.sol
Line 14 in 8f35c3d
Lines 107 to 110 in 8f35c3d
replace:
with:
And use typecasts to change uint8 to uint256 before doing non-trivial calculations:
uint256 balance0 = IStableSwap3Pool(stableSwapPool).balances(0).mul(10**uint256(decimalMultiples[0]));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Vulnerability details
Note: the current version of GeneralConvexStrategy.sol doesn't compile as far as I can see.
using SafeMath for uint8; ==> could lead to using uint8.
Using uint8 might lead to overflows. The Solidity compiler 6.12 gives the following warning when doing 10**uint8variable:
Luckily because balances(..) is an uint256 the code of getMostPremium() doesn't go wrong.
Proof of concept
metavault/contracts/v3/strategies/GeneralConvexStrategy.sol
Line 14 in 8f35c3d
metavault/contracts/v3/strategies/GeneralConvexStrategy.sol
Lines 107 to 110 in 8f35c3d
Recommended mitigation steps
replace:
with:
And use typecasts to change uint8 to uint256 before doing non-trivial calculations:
uint256 balance0 = IStableSwap3Pool(stableSwapPool).balances(0).mul(10**uint256(decimalMultiples[0]));
The text was updated successfully, but these errors were encountered: