Skip to content

Commit

Permalink
Remove rewardRatio constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Oct 31, 2024
1 parent 35012d7 commit 7301893
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 21 deletions.
12 changes: 0 additions & 12 deletions contracts/sfc/ConstantsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion contracts/sfc/NetworkInitializer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions contracts/sfc/SFCBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/sfc/SFCLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion contracts/sfc/Updater.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion contracts/test/UnitTestSFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7301893

Please sign in to comment.