@@ -23,6 +23,10 @@ contract Minter is Manager, IMinter {
23
23
24
24
// Per round inflation rate
25
25
uint256 public inflation;
26
+ // Max per round inflation rate
27
+ uint256 public maxInflation;
28
+ // Min per round inflation rate
29
+ uint256 public minInflation;
26
30
// Change in inflation rate per round until the target bonding rate is achieved
27
31
uint256 public inflationChange;
28
32
// Target bonding rate
@@ -70,15 +74,26 @@ contract Minter is Manager, IMinter {
70
74
* @param _inflation Base inflation rate as a percentage of current total token supply
71
75
* @param _inflationChange Change in inflation rate each round (increase or decrease) if target bonding rate is not achieved
72
76
* @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
73
79
*/
74
80
constructor (
75
81
address _controller ,
76
82
uint256 _inflation ,
77
83
uint256 _inflationChange ,
78
- uint256 _targetBondingRate
84
+ uint256 _targetBondingRate ,
85
+ uint256 _maxInflation ,
86
+ uint256 _minInflation
79
87
) Manager (_controller) {
80
88
// Inflation must be valid percentage
81
89
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 " );
82
97
// Inflation change must be valid percentage
83
98
require (MathUtils.validPerc (_inflationChange), "_inflationChange is invalid percentage " );
84
99
// Target bonding rate must be valid percentage
@@ -87,6 +102,8 @@ contract Minter is Manager, IMinter {
87
102
inflation = _inflation;
88
103
inflationChange = _inflationChange;
89
104
targetBondingRate = _targetBondingRate;
105
+ maxInflation = _maxInflation;
106
+ minInflation = _minInflation;
90
107
}
91
108
92
109
/**
@@ -115,6 +132,38 @@ contract Minter is Manager, IMinter {
115
132
emit ParameterUpdate ("inflationChange " );
116
133
}
117
134
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
+
118
167
/**
119
168
* @notice Migrate to a new Minter by transferring the current Minter's LPT + ETH balance to the new Minter
120
169
* @dev Only callable by Controller owner
@@ -240,13 +289,20 @@ contract Minter is Manager, IMinter {
240
289
currentBondingRate = MathUtils.percPoints (totalBonded, totalSupply);
241
290
}
242
291
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) {
244
294
// 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) {
247
302
// 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;
250
306
} else {
251
307
inflation = inflation.sub (inflationChange);
252
308
}
0 commit comments