mirror of https://github.com/logos-co/staking.git
3dd28749bf
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 |
||
---|---|---|
.. | ||
StakeManager.sol | ||
StakeVault.sol | ||
VaultFactory.sol |