You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Safe to increment the sequence after checking this is the expected number (no overflow for the age of universe even with 1000 reward claims per second)
215
235
batchSequence = batch.sequence +1;
216
236
217
237
for (uint256 i =0; i < batch.recipients.length; i++) {
218
238
nodl.mint(batch.recipients[i], batch.amounts[i]);
219
239
}
240
+
nodl.mint(msg.sender, submitterRewardAmount);
220
241
221
242
emitBatchMinted(batchSum, claimed);
222
243
}
223
244
245
+
/**
246
+
* @dev Sets the reward percentage for the batch submitter.
247
+
* @param newPercentage The new reward percentage to be set.
248
+
* Requirements:
249
+
* - Caller must have the DEFAULT_ADMIN_ROLE.
250
+
* - The new reward percentage must be less than 100.
251
+
*/
252
+
function setBatchSubmitterRewardPercentage(uint256newPercentage) external {
253
+
_checkRole(DEFAULT_ADMIN_ROLE);
254
+
_mustBeLessThan100(newPercentage);
255
+
batchSubmitterRewardPercentage = newPercentage;
256
+
}
257
+
224
258
/**
225
259
* @dev Internal function to update the rewards quota if the current block timestamp is greater than or equal to the quota renewal timestamp.
226
260
* @notice This function resets the rewards claimed to 0 and updates the quota renewal timestamp based on the reward period.
@@ -251,6 +285,17 @@ contract Rewards is AccessControl, EIP712 {
251
285
claimed = newClaimed;
252
286
}
253
287
288
+
/**
289
+
* @dev Checks if the given percentage value is less than or equal to 100.
290
+
* @param percent The percentage value to check.
291
+
* @dev Throws an exception if the value is greater than 100.
292
+
*/
293
+
function _mustBeLessThan100(uint256percent) internalpure {
294
+
if (percent >100) {
295
+
revertOutOfRangeValue();
296
+
}
297
+
}
298
+
254
299
/**
255
300
* @dev Internal check to ensure the `sequence` value is expected for `receipent`.
256
301
* @param receipent The address of the receipent to check.
0 commit comments