mirror of
https://github.com/logos-co/staking.git
synced 2025-01-09 18:25:56 +00:00
4a261e8b48
This commit refactors the StakeManager contract to optimize the finalization and execution of epochs. It updates the function finalizeEpoch() to new function finalizeEpoch(uint256 _limitEpoch) that releases rewards for the current epoch and increases the epoch up to the specified limit. This allows for more efficient processing of epochs. The changes also include updates to the executeEpoch() and executeAccount() functions to utilize the new finalizeEpoch() function. Additionally, a new function newEpoch() is introduced to calculate the last epoch that can be processed based on the current time. Now the executeAccount(account,limit) will also process epochs up to the specified limit. Added a overload of the executeAccount to process the account up to the newEpoch() Added a overload of the executeEpoch to allow the process of epochs up to a certain limit. All methods now that finalizeEpoch will process the epochs up to the newEpoch(). These changes improve the overall performance, user expirience and reliability of the StakeManager contract. chore(StakeManagerStartMigration.spec): add new function executeEpoch(uint256) to blockedWhenMigrating fix(StakeManager.sol): Replace the check for pending migration in migrationInitialize with noPendingMigration modifier to avoid code duplication
126 lines
11 KiB
Plaintext
126 lines
11 KiB
Plaintext
| contracts/StakeManager.sol:StakeManager contract | | | | | |
|
|
|--------------------------------------------------|-----------------|--------|--------|---------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 2447267 | 12701 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| EPOCH_SIZE | 263 | 263 | 263 | 263 | 1498 |
|
|
| MAX_BOOST | 307 | 307 | 307 | 307 | 637 |
|
|
| MAX_LOCKUP_PERIOD | 361 | 361 | 361 | 361 | 4 |
|
|
| MIN_LOCKUP_PERIOD | 264 | 264 | 264 | 264 | 12 |
|
|
| YEAR | 263 | 263 | 263 | 263 | 637 |
|
|
| accounts | 1619 | 1619 | 1619 | 1619 | 144243 |
|
|
| calculateMPToMint | 740 | 740 | 740 | 740 | 1276 |
|
|
| currentEpoch | 406 | 1072 | 406 | 2406 | 54 |
|
|
| epochEnd | 649 | 649 | 649 | 4649 | 23670 |
|
|
| epochReward | 1425 | 2925 | 1425 | 5925 | 3 |
|
|
| executeAccount(address) | 171751 | 171751 | 171751 | 171751 | 2 |
|
|
| executeAccount(address,uint256) | 30909 | 76511 | 78308 | 240839 | 141830 |
|
|
| executeEpoch() | 23458 | 146010 | 147059 | 3562421 | 23559 |
|
|
| executeEpoch(uint256) | 28208 | 28242 | 28208 | 28330 | 7 |
|
|
| isVault | 562 | 970 | 562 | 2562 | 680 |
|
|
| lock | 23862 | 23862 | 23862 | 23862 | 1 |
|
|
| migrateTo | 23891 | 23897 | 23897 | 23903 | 2 |
|
|
| migration | 395 | 1395 | 1395 | 2395 | 4 |
|
|
| migrationInitialize | 24602 | 24602 | 24602 | 24602 | 1 |
|
|
| newEpoch | 788 | 788 | 788 | 788 | 5 |
|
|
| owner | 2432 | 2432 | 2432 | 2432 | 13 |
|
|
| pendingMPToBeMinted | 386 | 386 | 386 | 386 | 46422 |
|
|
| pendingReward | 386 | 1420 | 2386 | 2386 | 29 |
|
|
| previousManager | 275 | 275 | 275 | 275 | 13 |
|
|
| setVault | 46216 | 46216 | 46216 | 46216 | 139 |
|
|
| stake | 23983 | 23983 | 23983 | 23983 | 1 |
|
|
| stakeRewardEstimate | 436 | 2345 | 2436 | 2436 | 22 |
|
|
| stakedToken | 295 | 295 | 295 | 295 | 696 |
|
|
| startMigration | 108281 | 108289 | 108293 | 108293 | 3 |
|
|
| totalSupply | 762 | 1943 | 2762 | 2762 | 22 |
|
|
| totalSupplyBalance | 407 | 1807 | 2407 | 2407 | 20 |
|
|
| totalSupplyMP | 362 | 362 | 362 | 2362 | 46443 |
|
|
| unstake | 23841 | 23841 | 23841 | 23841 | 1 |
|
|
|
|
|
|
| contracts/StakeManager.sol:StakeRewardEstimate contract | | | | | |
|
|
|---------------------------------------------------------|-----------------|-------|--------|-------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| getExpiredMP | 2427 | 2427 | 2427 | 2427 | 23720 |
|
|
| transferOwnership | 28533 | 28533 | 28533 | 28533 | 1 |
|
|
|
|
|
|
| contracts/StakeVault.sol:StakeVault contract | | | | | |
|
|
|----------------------------------------------|-----------------|--------|--------|--------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| acceptMigration | 35280 | 35280 | 35280 | 35280 | 2 |
|
|
| leave | 35266 | 35266 | 35266 | 35266 | 1 |
|
|
| lock | 45569 | 108497 | 66661 | 254253 | 7 |
|
|
| owner | 362 | 362 | 362 | 362 | 679 |
|
|
| stake | 27265 | 284241 | 267959 | 354106 | 684 |
|
|
| stakedToken | 212 | 212 | 212 | 212 | 2 |
|
|
| unstake | 42429 | 104547 | 80498 | 272053 | 11 |
|
|
|
|
|
|
| contracts/VaultFactory.sol:VaultFactory contract | | | | | |
|
|
|--------------------------------------------------|-----------------|--------|--------|--------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| createVault | 696553 | 696553 | 696553 | 696553 | 683 |
|
|
| setStakeManager | 23710 | 26669 | 26076 | 30222 | 3 |
|
|
| stakeManager | 368 | 1868 | 2368 | 2368 | 4 |
|
|
|
|
|
|
| lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20 contract | | | | | |
|
|
|---------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| approve | 46175 | 46240 | 46199 | 46367 | 679 |
|
|
| balanceOf | 561 | 2102 | 2561 | 2561 | 30842 |
|
|
|
|
|
|
| script/Deploy.s.sol:Deploy contract | | | | | |
|
|
|-------------------------------------|-----------------|---------|---------|---------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 6048121 | 29198 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| run | 5301161 | 5301161 | 5301161 | 5301161 | 66 |
|
|
|
|
|
|
| script/DeployMigrationStakeManager.s.sol:DeployMigrationStakeManager contract | | | | | |
|
|
|-------------------------------------------------------------------------------|-----------------|---------|---------|---------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 3211677 | 15966 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| run | 2286831 | 2286831 | 2286831 | 2286831 | 19 |
|
|
|
|
|
|
| script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | |
|
|
|---------------------------------------------------------|-----------------|-----|--------|-----|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| activeNetworkConfig | 455 | 455 | 455 | 455 | 132 |
|
|
|
|
|
|
| test/mocks/BrokenERC20.s.sol:BrokenERC20 contract | | | | | |
|
|
|---------------------------------------------------|-----------------|-------|--------|-------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 0 | 0 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| approve | 46175 | 46175 | 46175 | 46175 | 1 |
|
|
| balanceOf | 561 | 1227 | 561 | 2561 | 3 |
|
|
|
|
|
|
| test/script/DeployBroken.s.sol:DeployBroken contract | | | | | |
|
|
|------------------------------------------------------|-----------------|---------|---------|---------|---------|
|
|
| Deployment Cost | Deployment Size | | | | |
|
|
| 4732891 | 22996 | | | | |
|
|
| Function Name | min | avg | median | max | # calls |
|
|
| run | 4140983 | 4140983 | 4140983 | 4140983 | 1 |
|
|
|
|
|
|
|
|
|