Skip to content

Commit

Permalink
Fix inconsistent use of Decimal.unit()
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Dec 13, 2024
1 parent e86e5db commit c224061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions contracts/sfc/ConstantsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ contract ConstantsManager is OwnableUpgradeable {
}

function updateMinSelfStake(uint256 v) external virtual onlyOwner {
if (v < 100000 * 1e18) {
if (v < 100000 * Decimal.unit()) {
revert ValueTooSmall();
}
if (v > 10000000 * 1e18) {
if (v > 10000000 * Decimal.unit()) {
revert ValueTooLarge();
}
minSelfStake = v;
Expand Down Expand Up @@ -113,10 +113,10 @@ contract ConstantsManager is OwnableUpgradeable {
}

function updateBaseRewardPerSecond(uint256 v) external virtual onlyOwner {
if (v < 0.5 * 1e18) {
if (v < Decimal.unit() / 2) {
revert ValueTooSmall();
}
if (v > 32 * 1e18) {
if (v > 32 * Decimal.unit()) {
revert ValueTooLarge();
}
baseRewardPerSecond = v;
Expand Down
2 changes: 1 addition & 1 deletion contracts/sfc/NetworkInitializer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract NetworkInitializer {
NodeDriverAuth(_auth).initialize(_sfc, _driver, _owner);

ConstantsManager consts = new ConstantsManager(address(this));
consts.updateMinSelfStake(500000 * 1e18);
consts.updateMinSelfStake(500000 * Decimal.unit());
consts.updateMaxDelegatedRatio(16 * Decimal.unit());
consts.updateValidatorCommission((15 * Decimal.unit()) / 100);
consts.updateBurntFeeShare((20 * Decimal.unit()) / 100);
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/UnitTestSFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ contract UnitTestNetworkInitializer {
NodeDriverAuth(_auth).initialize(_sfc, _driver, _owner);

UnitTestConstantsManager consts = new UnitTestConstantsManager(address(this));
consts.updateMinSelfStake(0.3175000 * 1e18);
consts.updateMinSelfStake((3175 * Decimal.unit()) / 10000);
consts.updateMaxDelegatedRatio(16 * Decimal.unit());
consts.updateValidatorCommission((15 * Decimal.unit()) / 100);
consts.updateBurntFeeShare((20 * Decimal.unit()) / 100);
Expand Down

0 comments on commit c224061

Please sign in to comment.