@@ -38,7 +38,6 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
3838 error Token__ETHTransferFailed ();
3939 error Token__OnlyDAO ();
4040 error Token__DAOAlreadySet ();
41- error Token__InvalidBiasValidator ();
4241 error Token__DistributionTooEarly ();
4342 error Token__InvalidInterval ();
4443
@@ -277,50 +276,30 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
277276 // ============ Emissions & Halving ============
278277
279278 /**
280- * @notice Distribute validator rewards with configurable bias validator
279+ * @notice Distribute validator rewards
281280 * @param _approvedValidators List of validators that voted
282281 * @param _validatorReward Total reward amounts for validators
283282 * @param _distributionId Current distribution ID for events
284- * @param _biasValidator Address of validator to receive bias (replaces tx.origin)
285- * @dev 10% of validator rewards go to bias validator, remaining 90% split equally among all validators
286- * @dev Bias validator receives both the bias amount and their equal share
283+ * @param _dustValidator Validator that gets the scraps (proposal creator)
287284 */
288285 function _distributeValidatorRewards (
289286 address [] memory _approvedValidators ,
290287 PaymentAmounts memory _validatorReward ,
291288 uint256 _distributionId ,
292- address _biasValidator
289+ address _dustValidator
293290 ) internal {
294291 uint8 _nValidators = uint8 (_approvedValidators.length );
295292
296- // Validate bias validator is in the approved list
297- bool biasValidatorFound = false ;
298- for (uint256 i = 0 ; i < _nValidators; i++ ) {
299- if (_approvedValidators[i] == _biasValidator) {
300- biasValidatorFound = true ;
301- break ;
302- }
303- }
304- if (! biasValidatorFound) revert Token__InvalidBiasValidator ();
305-
306- // Calculate bias amount (10% of total validator reward goes to bias validator)
307- uint256 snoBiasAmount = (uint256 (_validatorReward.sno) * 10 ) / 100 ;
308- uint256 ethBiasAmount = (uint256 (_validatorReward.eth) * 10 ) / 100 ;
309-
310- // Remaining 90% to be split equally among all validators
311- uint256 snoRemainingPool = uint256 (_validatorReward.sno) -
312- snoBiasAmount;
313- uint256 ethRemainingPool = uint256 (_validatorReward.eth) -
314- ethBiasAmount;
293+ // Remaining pool to be split equally among validators
294+ uint256 snoPool = uint256 (_validatorReward.sno);
295+ uint256 ethPool = uint256 (_validatorReward.eth);
315296
316- uint256 snoPerValidator = snoRemainingPool / _nValidators;
317- uint256 ethPerValidator = ethRemainingPool / _nValidators;
297+ uint256 snoPerValidator = snoPool / _nValidators;
298+ uint256 ethPerValidator = ethPool / _nValidators;
318299
319300 // Handle dust/remainder
320- uint256 snoRemainder = snoRemainingPool -
321- (snoPerValidator * _nValidators);
322- uint256 ethRemainder = ethRemainingPool -
323- (ethPerValidator * _nValidators);
301+ uint256 snoRemainder = snoPool - (snoPerValidator * _nValidators);
302+ uint256 ethRemainder = ethPool - (ethPerValidator * _nValidators);
324303
325304 // Distribute to validators
326305 for (uint256 i = 0 ; i < _nValidators; i++ ) {
@@ -330,14 +309,8 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
330309 uint256 snoShare = snoPerValidator;
331310 uint256 ethShare = ethPerValidator;
332311
333- // Bias validator gets the bias amount
334- if (validator == _biasValidator) {
335- snoShare += snoBiasAmount;
336- ethShare += ethBiasAmount;
337- }
338-
339- // First validator gets remainder to avoid dust
340- if (i == 0 ) {
312+ // Give dust to first validator to avoid lost remainder
313+ if (_dustValidator == validator) {
341314 snoShare += snoRemainder;
342315 ethShare += ethRemainder;
343316 }
@@ -388,7 +361,7 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
388361 * @param _totalCapacity Total capacity of contributed workers
389362 * @param _payments Additional payments to be added to the current emission rate
390363 * @param _approvedValidators List of validators that voted
391- * @param _biasValidator Address of validator to receive bias rewards
364+ * @param _dustValidator Address of validator to receive dust rewards (usually the proposal executor)
392365 * @dev Workers receive 90% of the total reward, validators receive 10%
393366 * @dev Rewards are distributed with bias towards specified validator, then proportionally to workers based on their capacities
394367 * @dev This function is called by SmartnodesCore during state updates to distribute rewards.
@@ -398,11 +371,10 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
398371 uint256 _totalCapacity ,
399372 address [] memory _approvedValidators ,
400373 PaymentAmounts calldata _payments ,
401- address _biasValidator
374+ address _dustValidator
402375 ) external onlySmartnodesCore nonReentrant {
403376 uint8 _nValidators = uint8 (_approvedValidators.length );
404377 if (_nValidators == 0 ) revert Token__InvalidValidatorLength ();
405- if (_biasValidator == address (0 )) revert Token__InvalidBiasValidator ();
406378
407379 // Total rewards to be distributed
408380 PaymentAmounts memory totalReward = PaymentAmounts ({
@@ -423,7 +395,7 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
423395 _approvedValidators,
424396 totalReward,
425397 distributionId,
426- _biasValidator
398+ _dustValidator
427399 );
428400 return ; // exit early
429401 }
@@ -469,7 +441,7 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
469441 _approvedValidators,
470442 validatorReward,
471443 distributionId,
472- _biasValidator
444+ _dustValidator
473445 );
474446 }
475447
@@ -812,7 +784,7 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
812784 * @param _user The address of the user whose escrowed ETH payment is being released
813785 * @param _amount The amount of escrowed ETH payment to be released
814786 * @dev This releases the escrowed ETH to be available for distribution as rewards
815- * @dev The ETH stays in the contract but is no longer considered " escrowed"
787+ * @dev The ETH stays in the contract but is no longer considered escrowed
816788 */
817789 function releaseEscrowedEthPayment (
818790 address _user ,
@@ -896,7 +868,7 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
896868 return address (s_smartnodesCore);
897869 }
898870
899- // ============ ERC20Votes Overrides ============
871+ // ============ Required Overrides ============
900872
901873 /**
902874 * @dev Override to prevent voting with locked tokens
@@ -922,8 +894,6 @@ contract SmartnodesToken is ERC20, ERC20Permit, ERC20Votes, ReentrancyGuard {
922894 return balance;
923895 }
924896
925- // ============ Required Overrides ============
926-
927897 /**
928898 * @dev Override required by Solidity for multiple inheritance
929899 */
0 commit comments