DeFiHardhat
35,000 USDC
View results
Submission Details
Severity: low
Valid

0 lookback for LibUsdOracle.getTokenPrice()

Summary

LibUsdOracle.getTokenPrice() doesn't utilize any lookback when fetching the price of WSTETH.

Vulnerability Details

Unlike for WETH, where a standard lookback is applied, for WSTETH, it employs a lookback of 0.

function getTokenPrice(address token, uint256 lookback) internal view returns (uint256) {
if (token == C.WETH) {
uint256 ethUsdPrice = LibEthUsdOracle.getEthUsdPrice(lookback);
if (ethUsdPrice == 0) return 0;
return ethUsdPrice;
}
if (token == C.WSTETH) {
uint256 wstethUsdPrice = LibWstethUsdOracle.getWstethUsdPrice(0);
if (wstethUsdPrice == 0) return 0;
return wstethUsdPrice;
}
revert("Oracle: Token not supported.");
}

Impact

This could lead to inaccuracies in the price calculation for WSTETH.

Tools Used

Manual Review

Recommendations

getTokenPrice() should use the lookback param instead of 0.

Updates

Lead Judging Commences

giovannidisiena Lead Judge
over 1 year ago
giovannidisiena Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Unused lookback parameter

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.