You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prices are clamped via `_clampPriceUpscaled()` after every manual or automatic update:
190
194
191
-
Prices are bounded from below:
192
195
```solidity
193
-
if (currentPriceUpScaled < minimumPriceUpscaled) {
194
-
currentPriceUpScaled = minimumPriceUpscaled
196
+
function _clampPriceUpscaled(uint64 priceUpScaled) private pure returns (uint64) {
197
+
if (priceUpScaled < MINIMUM_PRICE_UPSCALED) {
198
+
priceUpScaled = MINIMUM_PRICE_UPSCALED;
199
+
}
200
+
if (priceUpScaled > MAX_CURRENT_PRICE_UPSCALED) {
201
+
priceUpScaled = MAX_CURRENT_PRICE_UPSCALED;
202
+
}
203
+
return priceUpScaled;
195
204
}
196
205
```
197
206
198
-
This prevents prices from becoming too low and disincentivizing storage.
207
+
-**Minimum floor** prevents prices from becoming too low and disincentivizing storage.
208
+
-**Maximum ceiling** ensures `(currentPriceUpScaled >> 10)` fits in `uint32`, so `currentPrice()` cannot silently truncate and under-report relative to the stored upscaled value.
199
209
200
210
## Integration with Other Contracts
201
211
@@ -264,10 +274,11 @@ error UnexpectedZero(); // Redundancy must be > 0
0 commit comments