File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -379,17 +379,22 @@ contract UFragmentsPolicy is Ownable {
379
379
// We limit the supply delta, based on recent supply history.
380
380
if (rebasePercentage < 0 ) {
381
381
int256 maxSupplyInHistory = currentSupply;
382
- for (uint8 i = 1 ; i < epochLookback && epoch > i; i++ ) {
383
- int256 epochSupply = supplyHistory[epoch - i].toInt256Safe ();
382
+ for (
383
+ uint256 e = ((epoch > epochLookback) ? (epoch - epochLookback) : 0 );
384
+ e < epoch;
385
+ e++
386
+ ) {
387
+ int256 epochSupply = supplyHistory[e].toInt256Safe ();
384
388
if (epochSupply > maxSupplyInHistory) {
385
389
maxSupplyInHistory = epochSupply;
386
390
}
387
391
}
388
- int256 allowedSupplyMinimum = maxSupplyInHistory
389
- .mul (ONE.sub (tolerableDeclinePercentage))
390
- .div (ONE);
391
- newSupply = (newSupply > allowedSupplyMinimum) ? newSupply : allowedSupplyMinimum;
392
- require (newSupply <= currentSupply);
392
+ int256 allowedMin = maxSupplyInHistory.mul (ONE.sub (tolerableDeclinePercentage)).div (
393
+ ONE
394
+ );
395
+ if (newSupply < allowedMin) {
396
+ newSupply = allowedMin;
397
+ }
393
398
}
394
399
395
400
return newSupply.sub (currentSupply);
You can’t perform that action at this time.
0 commit comments