DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Invalid

Outdated Pricing Information Returned by getSavedOrSpotOraclePrice() in LibOracle Library

##Summary:
The getSavedOrSpotOraclePrice() function in the LibOracle library may return outdated prices when the offset time is greater than 15 minutes and the price has changed significantly during that time.

Code Location:

  • File: LibOracle.sol

  • Function: getSavedOrSpotOraclePrice

Details:

The getSavedOrSpotOraclePrice() function in the LibOracle library is designed to return either the saved oracle price or the current oracle price depending on the time difference between the saved price and the current time.

function getSavedOrSpotOraclePrice(address asset) internal view returns (uint256) {
if (LibOrders.getOffsetTime() - getTime(asset) < 15 minutes) {
return getPrice(asset);
} else {
return getOraclePrice(asset);
}
}
The issue arises when the time difference (LibOrders.getOffsetTime() - getTime(asset)) is greater than 15 minutes. In this case, the function will return the saved price (getPrice(asset)) even if the market price has changed significantly.

Steps to Reproduce:

  • Set up a scenario where the offset time is greater than 15 minutes.

  • Ensure that the market price of the asset has changed significantly during this time.

Expected Behavior:

The getSavedOrSpotOraclePrice() function should return the most up-to-date price, regardless of the time difference, to accurately reflect the current market conditions.

Actual Behavior:

If the time difference exceeds 15 minutes, the function will return the saved price, potentially leading to outdated and inaccurate pricing information.

Proposed Fix:

To address this issue, consider updating the logic in getSavedOrSpotOraclePrice() to always fetch the most current oracle price, regardless of the time difference.

function getSavedOrSpotOraclePrice(address asset) internal view returns (uint256) {
return getOraclePrice(asset);
}

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other
0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Vague generalities

Support

FAQs

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