@@ -23,6 +23,10 @@ contract Minter is Manager, IMinter {
2323
2424 // Per round inflation rate
2525 uint256 public inflation;
26+ // Max per round inflation rate
27+ uint256 public maxInflation;
28+ // Min per round inflation rate
29+ uint256 public minInflation;
2630 // Change in inflation rate per round until the target bonding rate is achieved
2731 uint256 public inflationChange;
2832 // Target bonding rate
@@ -70,15 +74,26 @@ contract Minter is Manager, IMinter {
7074 * @param _inflation Base inflation rate as a percentage of current total token supply
7175 * @param _inflationChange Change in inflation rate each round (increase or decrease) if target bonding rate is not achieved
7276 * @param _targetBondingRate Target bonding rate as a percentage of total bonded tokens / total token supply
77+ * @param _maxInflation Inflation rate ceiling as a percentage of current total token supply
78+ * @param _minInflation Inflation rate floor as a percentage of current total token supply
7379 */
7480 constructor (
7581 address _controller ,
7682 uint256 _inflation ,
7783 uint256 _inflationChange ,
78- uint256 _targetBondingRate
84+ uint256 _targetBondingRate ,
85+ uint256 _maxInflation ,
86+ uint256 _minInflation
7987 ) Manager (_controller) {
8088 // Inflation must be valid percentage
8189 require (MathUtils.validPerc (_inflation), "_inflation is invalid percentage " );
90+ // Inflation bounds must be valid percentages
91+ require (MathUtils.validPerc (_maxInflation), "_maxInflation is invalid percentage " );
92+ require (MathUtils.validPerc (_minInflation), "_minInflation is invalid percentage " );
93+ // Inflation floor should be >= 0
94+ require (_minInflation >= 0 , "_minInflation must be >= 0 " );
95+ // Inflation floor should be lower or equal to the ceiling
96+ require (_minInflation <= _maxInflation, "_minInflation must be <= _maxInflation " );
8297 // Inflation change must be valid percentage
8398 require (MathUtils.validPerc (_inflationChange), "_inflationChange is invalid percentage " );
8499 // Target bonding rate must be valid percentage
@@ -87,6 +102,8 @@ contract Minter is Manager, IMinter {
87102 inflation = _inflation;
88103 inflationChange = _inflationChange;
89104 targetBondingRate = _targetBondingRate;
105+ maxInflation = _maxInflation;
106+ minInflation = _minInflation;
90107 }
91108
92109 /**
@@ -115,6 +132,38 @@ contract Minter is Manager, IMinter {
115132 emit ParameterUpdate ("inflationChange " );
116133 }
117134
135+ /**
136+ * @notice Set maxInflation. Only callable by Controller owner
137+ * @param _maxInflation New inflation cap as a percentage of total token supply
138+ */
139+ function setMaxInflation (uint256 _maxInflation ) external onlyControllerOwner {
140+ // Must be valid percentage
141+ require (MathUtils.validPerc (_maxInflation), "_maxInflation is invalid percentage " );
142+ // Inflation ceiling should be higher or equal to the floor
143+ require (_maxInflation >= minInflation, "_maxInflation must be >= minInflation " );
144+
145+ maxInflation = _maxInflation;
146+
147+ emit ParameterUpdate ("maxInflation " );
148+ }
149+
150+ /**
151+ * @notice Set minInflation. Only callable by Controller owner
152+ * @param _minInflation New inflation floor as a percentage of total token supply
153+ */
154+ function setMinInflation (uint256 _minInflation ) external onlyControllerOwner {
155+ // Must be valid percentage
156+ require (MathUtils.validPerc (_minInflation), "_minInflation is invalid percentage " );
157+ // Inflation floor should be >= 0
158+ require (_minInflation >= 0 , "_minInflation must be >= 0 " );
159+ // Inflation floor should be lower or equal to the ceiling
160+ require (_minInflation <= maxInflation, "_minInflation must be <= maxInflation " );
161+
162+ minInflation = _minInflation;
163+
164+ emit ParameterUpdate ("minInflation " );
165+ }
166+
118167 /**
119168 * @notice Migrate to a new Minter by transferring the current Minter's LPT + ETH balance to the new Minter
120169 * @dev Only callable by Controller owner
@@ -240,13 +289,20 @@ contract Minter is Manager, IMinter {
240289 currentBondingRate = MathUtils.percPoints (totalBonded, totalSupply);
241290 }
242291
243- if (currentBondingRate < targetBondingRate) {
292+ // Adjust inflation based on current bonding rate and target bonding rate, ensuring it stays within the floor and ceiling
293+ if ((currentBondingRate < targetBondingRate && inflation < maxInflation) || inflation < minInflation) {
244294 // Bonding rate is below the target - increase inflation
245- inflation = inflation.add (inflationChange);
246- } else if (currentBondingRate > targetBondingRate) {
295+ if (inflation.add (inflationChange) > maxInflation) {
296+ // If inflation would go above the ceiling, set it to the ceiling
297+ inflation = maxInflation;
298+ } else {
299+ inflation = inflation.add (inflationChange);
300+ }
301+ } else if ((currentBondingRate > targetBondingRate && inflation > minInflation) || inflation > maxInflation) {
247302 // Bonding rate is above the target - decrease inflation
248- if (inflationChange > inflation) {
249- inflation = 0 ;
303+ if (minInflation.add (inflationChange) > inflation) {
304+ // If inflation would go below the floor, set it to the floor
305+ inflation = minInflation;
250306 } else {
251307 inflation = inflation.sub (inflationChange);
252308 }
0 commit comments