Detailed description of the impact of this finding.
In the _swap() function, the discrepancy lies in the usage of the variable specifiedAmount instead of roundedSpecifiedAmount when checking the final balance in the _swap() function.
In the code snippet, when specifiedToken == SpecifiedToken.X, the correct calculation for the final X balance should be xi + roundedSpecifiedAmount. However, the code uses xi + specifiedAmount instead.
Similarly, if specifiedToken == SpecifiedToken.Y, it uses yi + specifiedAmount.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Recommended Mitigation Steps
Recommend to use roundedSpecifiedAmount instead of specifiedAmount in _checkBalances() call.
For example:
Lines of code
https://github.com/code-423n4/2023-08-shell/blob/c61cf0e01bada04c3d6055acb81f61955ed600aa/src/proteus/EvolvingProteus.sol#L549 https://github.com/code-423n4/2023-08-shell/blob/c61cf0e01bada04c3d6055acb81f61955ed600aa/src/proteus/EvolvingProteus.sol#L552
Vulnerability details
Impact
Detailed description of the impact of this finding.
In the
_swap()
function, the discrepancy lies in the usage of the variablespecifiedAmount
instead ofroundedSpecifiedAmount
when checking the final balance in the_swap()
function.In the code snippet, when
specifiedToken == SpecifiedToken.X
, the correct calculation for the final X balance should bexi + roundedSpecifiedAmount
. However, the code usesxi + specifiedAmount
instead. Similarly, ifspecifiedToken == SpecifiedToken.Y
, it usesyi + specifiedAmount
.Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
Tools Used
Recommended Mitigation Steps
Recommend to use
roundedSpecifiedAmount
instead ofspecifiedAmount
in_checkBalances()
call. For example:Assessed type
Invalid Validation