Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: re-use a variable
  • Loading branch information
Denis Ermolin
Denis Ermolin committed Aug 27, 2021
commit 4f9a2d5568c40602d2035ce09d16bee729dfa79e
7 changes: 4 additions & 3 deletions contracts/staking/stakeManager/StakeManagerExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ contract StakeManagerExtension is StakeManagerStorage, Initializable, StakeManag
);

uint256 _currentEpoch = currentEpoch;
uint256 _replacementCoolDown = replacementCoolDown;
uint256 cooldown = replacementCoolDown;
// when dynasty period is updated validators are in cooldown period
require(_replacementCoolDown == 0 || _replacementCoolDown <= _currentEpoch, "Cooldown period");
require(cooldown == 0 || cooldown <= _currentEpoch, "Cooldown period");
// (auctionPeriod--dynasty)--(auctionPeriod--dynasty)--(auctionPeriod--dynasty)
// if it's auctionPeriod then will get residue smaller then auctionPeriod
// from (CurrentPeriod of validator )%(auctionPeriod--dynasty)
Expand All @@ -59,7 +59,8 @@ contract StakeManagerExtension is StakeManagerStorage, Initializable, StakeManag
Auction storage auction = validatorAuction[validatorId];

// do not allow bidding too often
require(lastBidTimestamp[msg.sender] == 0 || lastBidTimestamp[msg.sender] < block.timestamp, "bid too often");
cooldown = lastBidTimestamp[msg.sender];
require(cooldown == 0 || cooldown < block.timestamp, "bid too often");

uint256 currentAuctionAmount = auction.amount;

Expand Down