In the Stable2.sol contract the decodeWellData function responsible for decoding and validating token decimals from input data. And the function is intended to decode token decimals from the provided data and set default values if they are zero. However the function mistakenly checked decimal0 twice, which could lead to incorrect handling of decimal1 if it is set to 0.
Impact
decimal1 might incorrectly set to 0 instead of 18.
Lines of code
https://github.com/code-423n4/2024-07-basin/blob/main/src/functions/Stable2.sol#L317
Vulnerability details
In the
Stable2.sol
contract thedecodeWellData
function responsible for decoding and validating token decimals from input data. And the function is intended to decode token decimals from the provided data and set default values if they are zero. However the function mistakenly checkeddecimal0
twice, which could lead to incorrect handling ofdecimal1
if it is set to 0.Impact
decimal1
might incorrectly set to 0 instead of 18.Proof of Concept
https://github.com/code-423n4/2024-07-basin/blob/main/src/functions/Stable2.sol#L317
Tools Used
Manual review.
Recommended Mitigation Steps
Consider replace
decimal0
todecimal1
in below function.Assessed type
Decimal