@@ -18,12 +18,11 @@ import "./IRewardsManager.sol";
18
18
* total rewards for the Subgraph are split up for each Indexer based on much they have Staked on
19
19
* that Subgraph.
20
20
*/
21
- contract RewardsManager is RewardsManagerV1Storage , GraphUpgradeable , IRewardsManager {
21
+ contract RewardsManager is RewardsManagerV2Storage , GraphUpgradeable , IRewardsManager {
22
22
using SafeMath for uint256 ;
23
23
24
24
uint256 private constant TOKEN_DECIMALS = 1e18 ;
25
25
uint256 private constant MIN_ISSUANCE_RATE = 1e18 ;
26
- uint256 private constant REWARDS_ACCRUAL_SIGNALLED_THRESHOLD = 100e18 ;
27
26
28
27
// -- Events --
29
28
@@ -67,6 +66,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
67
66
_setIssuanceRate (_issuanceRate);
68
67
}
69
68
69
+ // -- Config --
70
+
70
71
/**
71
72
* @dev Sets the issuance rate.
72
73
* The issuance rate is defined as a percentage increase of the total supply per block.
@@ -106,6 +107,24 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
106
107
emit ParameterUpdated ("subgraphAvailabilityOracle " );
107
108
}
108
109
110
+ /**
111
+ * @dev Sets the minimum signaled tokens on a subgraph to start accruing rewards.
112
+ * @dev Can be set to zero which means that this feature is not being used.
113
+ * @param _minimumSubgraphSignal Minimum signaled tokens
114
+ */
115
+ function setMinimumSubgraphSignal (uint256 _minimumSubgraphSignal ) external override {
116
+ // Caller can be the SAO or the governor
117
+ require (
118
+ msg .sender == address (subgraphAvailabilityOracle) ||
119
+ msg .sender == controller.getGovernor (),
120
+ "Not authorized "
121
+ );
122
+ minimumSubgraphSignal = _minimumSubgraphSignal;
123
+ emit ParameterUpdated ("minimumSubgraphSignal " );
124
+ }
125
+
126
+ // -- Denylist --
127
+
109
128
/**
110
129
* @dev Denies to claim rewards for a subgraph.
111
130
* NOTE: Can only be called by the subgraph availability oracle
@@ -156,6 +175,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
156
175
return denylist[_subgraphDeploymentID] > 0 ;
157
176
}
158
177
178
+ // -- Getters --
179
+
159
180
/**
160
181
* @dev Gets the issuance of rewards per signal since last updated.
161
182
*
@@ -228,7 +249,7 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
228
249
uint256 subgraphSignalledTokens = curation ().getCurationPoolTokens (_subgraphDeploymentID);
229
250
230
251
// Only accrue rewards if over a threshold
231
- uint256 newRewards = (subgraphSignalledTokens > REWARDS_ACCRUAL_SIGNALLED_THRESHOLD ) // Accrue new rewards since last snapshot
252
+ uint256 newRewards = (subgraphSignalledTokens > minimumSubgraphSignal ) // Accrue new rewards since last snapshot
232
253
? getAccRewardsPerSignal ()
233
254
.sub (subgraph.accRewardsPerSignalSnapshot)
234
255
.mul (subgraphSignalledTokens)
@@ -272,6 +293,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
272
293
);
273
294
}
274
295
296
+ // -- Updates --
297
+
275
298
/**
276
299
* @dev Updates the accumulated rewards per signal and save checkpoint block number.
277
300
* Must be called before `issuanceRate` or `total signalled GRT` changes
0 commit comments