15,000 USDC
View results
Submission Details
Severity: gas
Valid

More documentation is preferred

Summary

Code base needs more Natspec comments. Documentation should be consistent and clear for the auditors and devs.

Vulnerability Details

Code base lacks documentation.

Impact

Documentation should be consistent and clear for the auditors and devs.

Tools Used

Manual review

Recommendations

+ /**
+ * @notice This function checks if the latest round data is stale or not.
+ * @dev If the latest round data is stale, the function will revert.
+ * @param priceFeed The Chainlink Oracle price feed.
+ */
function staleCheckLatestRoundData(AggregatorV3Interface priceFeed) // @audit here if the oracle price is stale, the function will revert, then the system will be unusable. This is not right and we need a plan B in this case.
public
view
returns (uint80, int256, uint256, uint256, uint80)
{
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
priceFeed.latestRoundData();
// @audit also check 1. if the answer is more than 0, and check 2. the current roundId is more than the previous roundId.
uint256 secondsSince = block.timestamp - updatedAt;
if (secondsSince > TIMEOUT) revert OracleLib__StalePrice();
return (roundId, answer, startedAt, updatedAt, answeredInRound);
}
+ /**
+ * @notice This function returns the timeout value for the OracleLib
+ */
function getTimeout(AggregatorV3Interface /* chainlinkFeed */ ) public pure returns (uint256) {
return TIMEOUT;
}
}

Support

FAQs

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