There is an issue in the getWstethEthPrice
function, the absence of an else
condition at the end of the if
statement block will lead to returning nothing at the end. In simple words, this means that if the condition within the if
statement (LibOracleHelpers.getPercentDifference(chainlinkPrice, uniswapPrice) < MAX_DIFFERENCE
) evaluates to false, the function will exit without returning a value.
Without an else
condition, the function may terminate abruptly without providing any meaningful output if the condition in the if
statement is not met. This can lead to unpredictable behavior, making it difficult to determine why the function failed to produce a result.
For example if someone calls getWstethEthPrice
or this is called internally in a function for returning the wstETH/USD
price with the option of using a TWA lookback. And the if
condition fails so this will return no value to the user or any function calling it will get no value in return.
Add an else
condition at the end of the if
statement block to handle cases where the condition is not met. This could involve returning a default value or triggering an error to indicate that the function was unable to compute a valid price.
For example, new code will look like this:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.