@@ -26,7 +26,7 @@ contract PriceFeed is PriceFeedStorage, IPriceFeed {
2626
2727 /// @notice Returns the latest price obtained from the Oracle. Called by Zero functions that require a current price.
2828 /// It uses the main price feed and fallback to the backup one in case of an error. If both fail return the last
29- /// good price seen.
29+ /// good price seen. Function will rever if got false success flag from the medianizer contract.
3030 /// @dev It's also callable by anyone externally
3131 /// @return The price
3232 function fetchPrice () external override returns (uint256 ) {
@@ -39,7 +39,8 @@ contract PriceFeed is PriceFeedStorage, IPriceFeed {
3939 emit PriceFeedBroken (index, address (priceFeeds[index]));
4040 }
4141 }
42- return lastGoodPrice;
42+
43+ revert ("PriceFeed: Price feed price is stale " );
4344 }
4445
4546 /// @notice Allows users to setup the main and the backup price feeds
@@ -50,8 +51,7 @@ contract PriceFeed is PriceFeedStorage, IPriceFeed {
5051 require (_index < priceFeeds.length , "Out of bounds when setting the price feed " );
5152 checkContract (_newPriceFeed);
5253 priceFeeds[_index] = IExternalPriceFeed (_newPriceFeed);
53- (uint256 price , bool success ) = priceFeeds[_index].latestAnswer ();
54- require (success, "PriceFeed: Price feed must be working " );
54+ (uint256 price , bool _ ) = priceFeeds[_index].latestAnswer ();
5555 emit PriceFeedUpdated (_index, _newPriceFeed);
5656 return price;
5757 }
@@ -61,4 +61,8 @@ contract PriceFeed is PriceFeedStorage, IPriceFeed {
6161 lastGoodPrice = _currentPrice;
6262 emit LastGoodPriceUpdated (_currentPrice);
6363 }
64+
65+ function getPriceFeedAtIndex (uint8 _index ) external view returns (address ) {
66+ return address (priceFeeds[_index]);
67+ }
6468}
0 commit comments