@@ -18,12 +18,11 @@ import "./IRewardsManager.sol";
1818 * total rewards for the Subgraph are split up for each Indexer based on much they have Staked on
1919 * that Subgraph.
2020 */
21- contract RewardsManager is RewardsManagerV1Storage , GraphUpgradeable , IRewardsManager {
21+ contract RewardsManager is RewardsManagerV2Storage , GraphUpgradeable , IRewardsManager {
2222 using SafeMath for uint256 ;
2323
2424 uint256 private constant TOKEN_DECIMALS = 1e18 ;
2525 uint256 private constant MIN_ISSUANCE_RATE = 1e18 ;
26- uint256 private constant REWARDS_ACCRUAL_SIGNALLED_THRESHOLD = 100e18 ;
2726
2827 // -- Events --
2928
@@ -67,6 +66,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
6766 _setIssuanceRate (_issuanceRate);
6867 }
6968
69+ // -- Config --
70+
7071 /**
7172 * @dev Sets the issuance rate.
7273 * 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
106107 emit ParameterUpdated ("subgraphAvailabilityOracle " );
107108 }
108109
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+
109128 /**
110129 * @dev Denies to claim rewards for a subgraph.
111130 * NOTE: Can only be called by the subgraph availability oracle
@@ -156,6 +175,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
156175 return denylist[_subgraphDeploymentID] > 0 ;
157176 }
158177
178+ // -- Getters --
179+
159180 /**
160181 * @dev Gets the issuance of rewards per signal since last updated.
161182 *
@@ -228,7 +249,7 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
228249 uint256 subgraphSignalledTokens = curation ().getCurationPoolTokens (_subgraphDeploymentID);
229250
230251 // 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
232253 ? getAccRewardsPerSignal ()
233254 .sub (subgraph.accRewardsPerSignalSnapshot)
234255 .mul (subgraphSignalledTokens)
@@ -272,6 +293,8 @@ contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsMa
272293 );
273294 }
274295
296+ // -- Updates --
297+
275298 /**
276299 * @dev Updates the accumulated rewards per signal and save checkpoint block number.
277300 * Must be called before `issuanceRate` or `total signalled GRT` changes
0 commit comments