-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(StakeManager): replace epoch.startTime with a global startTime
As now all epochEnd() are multiples of EPOCH_SIZE, we can drop the startTime from the struct Epoch, and avoid storing an information that can be cheaply calculated on the fly. - Refactored the StakeManager contract to optimize the finalization of epochs and execution of accounts and epochs. - Replaced the Epoch.startTime with a new global variable startTime to keep track of the start time of the contract. - Modified the finalizeEpoch function to use a temporary variable for the current epoch and calculate the epoch reward only for the current epoch. - Updated the migrationInitialize function to set the start time using the new startTime variable. - Modified the epochEnd function to calculate the end time of the current epoch using the startTime variable. - Modified the newEpoch function to calculate the number of the next epoch based on the startTime variable. refactor(StakeManager): set startTime as immutable, load startTime from previousManager at constructor, verify startTime is correct on initializeMigration
- Loading branch information
Showing
3 changed files
with
128 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.