Skip to content

Commit 7475697

Browse files
committed
docs: add comments on safety checks
1 parent bc39f3f commit 7475697

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libraries/ChainlinkDataFeedLib.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import {ErrorsLib} from "./ErrorsLib.sol";
1212
library ChainlinkDataFeedLib {
1313
/// @dev Performs safety checks and returns the latest price of a `feed`.
1414
/// @dev When `feed` is the address zero, returns 1.
15+
/// @dev Notes on safety checks:
16+
/// - A stale period is not checked since the heartbeat of a Chainlink feed is an offchain parameter that can
17+
/// change any time and checking the price deviation onchain is not possible. It was not recommended by the Chailink
18+
/// team either.
19+
/// - The price is not checked to be in the min/max bounds since the check is already performed by Chainlink most of
20+
/// the time. Adding
21+
/// a safety margin would be arbitrary as well since the contract is immutable.
22+
/// - No fallback is used. In case the oracle reverts, Morpho Blue users can still exit their positions but
23+
/// can't be liquidated.
1524
function getPrice(AggregatorV3Interface feed) internal view returns (uint256) {
1625
if (address(feed) == address(0)) return 1;
1726

0 commit comments

Comments
 (0)