Skip to content

Commit

Permalink
[OZ][N-07] Inconsistent Use of Decimal.unit() (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ authored Jan 31, 2025
1 parent 3025df3 commit 1d0a4e1
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 @@ -54,10 +54,10 @@ contract ConstantsManager is Ownable {
constructor(address owner) Ownable(owner) {}

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 @@ -115,10 +115,10 @@ contract ConstantsManager is Ownable {
}

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 @@ -66,7 +66,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 1d0a4e1

Please sign in to comment.