@@ -12,6 +12,7 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
12
12
using SafeMath for uint256 ;
13
13
14
14
uint256 private constant TOKEN_DECIMALS = 1e18 ;
15
+ uint256 private constant MIN_ISSUANCE_RATE = 1e18 ;
15
16
16
17
// -- Events --
17
18
@@ -50,6 +51,7 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
50
51
*/
51
52
function initialize (address _controller ) external onlyImpl {
52
53
Managed._initialize (_controller);
54
+ _setIssuanceRate (MIN_ISSUANCE_RATE);
53
55
}
54
56
55
57
/**
@@ -67,7 +69,11 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
67
69
68
70
/**
69
71
* @dev Sets the issuance rate.
70
- * @param _issuanceRate Issuance rate
72
+ * The issuance rate is defined as a percentage increase of the total supply per block.
73
+ * This means that it needs to be greater than 1.0, any number under 1.0 is not
74
+ * allowed and an issuance rate of 1.0 means no issuance.
75
+ * To accomodate a high precision the issuance rate is expressed in wei.
76
+ * @param _issuanceRate Issuance rate expressed in wei
71
77
*/
72
78
function setIssuanceRate (uint256 _issuanceRate ) public override onlyGovernor {
73
79
_setIssuanceRate (_issuanceRate);
@@ -78,6 +84,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
78
84
* @param _issuanceRate Issuance rate
79
85
*/
80
86
function _setIssuanceRate (uint256 _issuanceRate ) internal {
87
+ require (_issuanceRate >= MIN_ISSUANCE_RATE, "Issuance rate under minimun allowed " );
88
+
81
89
// Called since `issuance rate` will change
82
90
updateAccRewardsPerSignal ();
83
91
@@ -165,21 +173,20 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
165
173
* @return newly accrued rewards per signal since last update
166
174
*/
167
175
function getNewRewardsPerSignal () public override view returns (uint256 ) {
168
- IGraphToken graphToken = graphToken ();
169
-
170
176
// Calculate time steps
171
177
uint256 t = block .number .sub (accRewardsPerSignalLastBlockUpdated);
172
178
// Optimization to skip calculations if zero time steps elapsed
173
179
if (t == 0 ) {
174
180
return 0 ;
175
181
}
176
182
177
- // Zero issuance
178
- if (issuanceRate == 0 ) {
183
+ // Zero issuance under a rate of 1.0
184
+ if (issuanceRate <= MIN_ISSUANCE_RATE ) {
179
185
return 0 ;
180
186
}
181
187
182
188
// Zero issuance if no signalled tokens
189
+ IGraphToken graphToken = graphToken ();
183
190
uint256 signalledTokens = graphToken.balanceOf (address (curation ()));
184
191
if (signalledTokens == 0 ) {
185
192
return 0 ;
0 commit comments