Skip to content

Commit 5541c61

Browse files
authored
Merge pull request #84 from NeriteOrg/oracle-updates
Oracle updates
2 parents 4b1668b + 52de156 commit 5541c61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contracts/src/PriceFeeds/tBTCPriceFeed.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ contract tBTCPriceFeed is CompositePriceFeed {
5454
if (_isRedemption && _withinDeviationThreshold(tbtcUsdPrice, btcUsdPrice, BTC_TBTC_DEVIATION_THRESHOLD)) {
5555
// If it's a redemption and within 2%, take the max of (tBTC-USD, BTC-USD) to prevent value leakage and convert to tBTC-USD
5656
tbtcUsdPrice = LiquityMath._max(tbtcUsdPrice, btcUsdPrice);
57+
}else{
58+
// Take the minimum of (market, canonical) in order to mitigate against upward market price manipulation.
59+
tbtcUsdPrice = LiquityMath._min(tbtcUsdPrice, btcUsdPrice);
5760
}
5861

5962
// Otherwise, just use tBTC-USD price: USD_per_tBTC.
@@ -62,7 +65,7 @@ contract tBTCPriceFeed is CompositePriceFeed {
6265
}
6366

6467
function _getCanonicalRate() internal view override returns (uint256, bool) {
65-
return (1, false); // always return 1 BTC per tBTC by default.
68+
return (1 * 10 ** 18, false); // always return 1 BTC per tBTC by default.
6669
}
6770
}
6871

0 commit comments

Comments
 (0)