From 7301893f85b63415a6ebe1a1558656afe9fc4639 Mon Sep 17 00:00:00 2001 From: Mike-CZ Date: Thu, 31 Oct 2024 09:48:43 +0100 Subject: [PATCH] Remove `rewardRatio` constant --- contracts/sfc/ConstantsManager.sol | 12 ------------ contracts/sfc/NetworkInitializer.sol | 1 - contracts/sfc/SFC.sol | 2 +- contracts/sfc/SFCBase.sol | 4 ---- contracts/sfc/SFCLib.sol | 2 +- contracts/sfc/Updater.sol | 1 - contracts/test/UnitTestSFC.sol | 1 - 7 files changed, 2 insertions(+), 21 deletions(-) diff --git a/contracts/sfc/ConstantsManager.sol b/contracts/sfc/ConstantsManager.sol index c1f76f5..42c50c0 100644 --- a/contracts/sfc/ConstantsManager.sol +++ b/contracts/sfc/ConstantsManager.sol @@ -15,8 +15,6 @@ contract ConstantsManager is Ownable { uint256 public burntFeeShare; // The percentage of fees to transfer to treasury address, e.g., 10% uint256 public treasuryFeeShare; - // The ratio of the reward rate, e.g., 30% - uint256 public rewardRatio; // the number of epochs that undelegated stake is locked for uint256 public withdrawalPeriodEpochs; // the number of seconds that undelegated stake is locked for @@ -83,16 +81,6 @@ contract ConstantsManager is Ownable { treasuryFeeShare = v; } - function updateRewardRatio(uint256 v) external virtual onlyOwner { - if (v < (5 * Decimal.unit()) / 100) { - revert ValueTooSmall(); - } - if (v > Decimal.unit() / 2) { - revert ValueTooLarge(); - } - rewardRatio = v; - } - function updateWithdrawalPeriodEpochs(uint256 v) external virtual onlyOwner { if (v < 2) { revert ValueTooSmall(); diff --git a/contracts/sfc/NetworkInitializer.sol b/contracts/sfc/NetworkInitializer.sol index e5ccd7b..d205dd4 100644 --- a/contracts/sfc/NetworkInitializer.sol +++ b/contracts/sfc/NetworkInitializer.sol @@ -28,7 +28,6 @@ contract NetworkInitializer { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateRewardRatio((30 * Decimal.unit()) / 100); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(2668658453701531600); diff --git a/contracts/sfc/SFC.sol b/contracts/sfc/SFC.sol index 7157f87..6255c0f 100644 --- a/contracts/sfc/SFC.sol +++ b/contracts/sfc/SFC.sol @@ -294,7 +294,7 @@ contract SFC is SFCBase, Version { uint256 commissionRewardFull = _calcValidatorCommission(rawReward, c.validatorCommission()); uint256 selfStake = getStake[validatorAddr][validatorID]; if (selfStake != 0) { - _rewardsStash[validatorAddr][validatorID] += _scaleReward(commissionRewardFull); + _rewardsStash[validatorAddr][validatorID] += commissionRewardFull; } // accounting reward per token for delegators diff --git a/contracts/sfc/SFCBase.sol b/contracts/sfc/SFCBase.sol index 0dd33a5..c58ce64 100644 --- a/contracts/sfc/SFCBase.sol +++ b/contracts/sfc/SFCBase.sol @@ -122,10 +122,6 @@ contract SFCBase is SFCState { totalSupply = totalSupply + amount; } - function _scaleReward(uint256 fullReward) internal view returns (uint256) { - return (fullReward * c.rewardRatio()) / Decimal.unit(); - } - function _recountVotes(address delegator, address validatorAuth, bool strict) internal { if (voteBookAddress != address(0)) { // Don't allow recountVotes to use up all the gas diff --git a/contracts/sfc/SFCLib.sol b/contracts/sfc/SFCLib.sol index b63f13e..c11ca45 100644 --- a/contracts/sfc/SFCLib.sol +++ b/contracts/sfc/SFCLib.sol @@ -318,7 +318,7 @@ contract SFCLib is SFCBase { uint256 payableUntil = _highestPayableEpoch(toValidatorID); uint256 wholeStake = getStake[delegator][toValidatorID]; uint256 fullReward = _newRewardsOf(wholeStake, toValidatorID, stashedUntil, payableUntil); - return _scaleReward(fullReward); + return fullReward; } function _newRewardsOf( diff --git a/contracts/sfc/Updater.sol b/contracts/sfc/Updater.sol index 3a1715f..5085a8d 100644 --- a/contracts/sfc/Updater.sol +++ b/contracts/sfc/Updater.sol @@ -88,7 +88,6 @@ contract Updater { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateRewardRatio((30 * Decimal.unit()) / 100); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(2668658453701531600); diff --git a/contracts/test/UnitTestSFC.sol b/contracts/test/UnitTestSFC.sol index e584809..1531981 100644 --- a/contracts/test/UnitTestSFC.sol +++ b/contracts/test/UnitTestSFC.sol @@ -85,7 +85,6 @@ contract UnitTestNetworkInitializer { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateRewardRatio((30 * Decimal.unit()) / 100); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(6183414351851851852);