Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(StakeManager): extract interfaces and rename variables to merge functionalty with StakingRewardStreamer #150

Merged
merged 13 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
99 changes: 50 additions & 49 deletions .gas-report
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
| contracts/StakeManager.sol:StakeManager contract | | | | | |
|--------------------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 2495816 | 13179 | | | | |
| 2893352 | 15010 | | | | |
| Function Name | min | avg | median | max | # calls |
| EPOCH_SIZE | 263 | 263 | 263 | 263 | 1498 |
| MAX_BOOST | 264 | 264 | 264 | 264 | 637 |
| MAX_LOCKUP_PERIOD | 383 | 383 | 383 | 383 | 4 |
| ACCURE_RATE | 306 | 306 | 306 | 306 | 1546 |
| MAX_LOCKUP_PERIOD | 405 | 405 | 405 | 405 | 4 |
| MAX_MULTIPLIER | 285 | 285 | 285 | 285 | 685 |
| MIN_LOCKUP_PERIOD | 264 | 264 | 264 | 264 | 12 |
| YEAR | 263 | 263 | 263 | 263 | 637 |
| accounts | 1616 | 1616 | 1616 | 1616 | 144285 |
| calculateMPToMint | 740 | 740 | 740 | 740 | 1276 |
| currentEpoch | 384 | 1050 | 384 | 2384 | 54 |
| epochEnd | 649 | 649 | 649 | 2649 | 23677 |
| REWARD_TOKEN | 317 | 317 | 317 | 317 | 744 |
| YEAR | 308 | 308 | 308 | 308 | 685 |
| acceptUpdate | 23633 | 23633 | 23633 | 23633 | 1 |
| accounts | 1616 | 1616 | 1616 | 1616 | 154911 |
| calculateMP | 790 | 790 | 790 | 790 | 1371 |
| currentEpoch | 384 | 385 | 384 | 2384 | 25502 |
| epochReward | 1381 | 2881 | 1381 | 5881 | 3 |
| executeAccount(address) | 149300 | 149300 | 149300 | 149300 | 2 |
| executeAccount(address,uint256) | 26562 | 72246 | 74122 | 200087 | 141872 |
| executeEpoch() | 23480 | 120708 | 121865 | 900380 | 23566 |
| executeAccount(address) | 33469 | 110369 | 148819 | 148819 | 3 |
| executeAccount(address,uint256) | 26562 | 71648 | 73544 | 195463 | 152497 |
| executeEpoch() | 23435 | 120637 | 121820 | 900335 | 25337 |
| executeEpoch(uint256) | 23861 | 24497 | 23861 | 26090 | 7 |
| expiredStakeStorage | 437 | 2346 | 2437 | 2437 | 22 |
| isTrustedCodehash | 541 | 949 | 541 | 2541 | 680 |
| lock | 23818 | 23818 | 23818 | 23818 | 1 |
| migrateTo | 23922 | 23928 | 23928 | 23934 | 2 |
| expiredStakeStorage | 394 | 2303 | 2394 | 2394 | 22 |
| getEpochStartTime | 525 | 525 | 525 | 525 | 25448 |
| isTrustedCodehash | 541 | 944 | 541 | 2541 | 728 |
| leave | 23675 | 23675 | 23675 | 23675 | 1 |
| lock | 23840 | 23840 | 23840 | 23840 | 1 |
| migration | 417 | 1417 | 1417 | 2417 | 4 |
| migrationInitialize | 24624 | 24624 | 24624 | 24624 | 1 |
| newEpoch | 441 | 441 | 441 | 441 | 5 |
| migrationInitialize | 24646 | 24646 | 24646 | 24646 | 1 |
| newEpoch | 463 | 463 | 463 | 463 | 5 |
| owner | 2432 | 2432 | 2432 | 2432 | 13 |
| pendingMPToBeMinted | 363 | 363 | 363 | 363 | 46436 |
| pendingReward | 408 | 1442 | 2408 | 2408 | 29 |
| previousManager | 275 | 275 | 275 | 275 | 13 |
| setTrustedCodehash | 47960 | 47960 | 47960 | 47960 | 139 |
| stake | 23983 | 23983 | 23983 | 23983 | 1 |
| stakedToken | 272 | 272 | 272 | 272 | 696 |
| potentialMP | 408 | 408 | 408 | 408 | 49978 |
| previousManager | 297 | 297 | 297 | 297 | 13 |
| setTrustedCodehash | 47982 | 47982 | 47982 | 47982 | 147 |
| stake | 24047 | 24047 | 24047 | 24047 | 1 |
| startMigration | 103602 | 103610 | 103614 | 103614 | 3 |
| startTime | 306 | 306 | 306 | 306 | 21 |
| totalMP | 363 | 363 | 363 | 2363 | 49999 |
| totalStaked | 386 | 1786 | 2386 | 2386 | 20 |
| totalSupply | 784 | 1965 | 2784 | 2784 | 22 |
| totalSupplyBalance | 407 | 1807 | 2407 | 2407 | 20 |
| totalSupplyMP | 384 | 384 | 384 | 2384 | 46457 |
| unstake | 23841 | 23841 | 23841 | 23841 | 1 |


Expand All @@ -44,21 +45,21 @@
| Deployment Cost | Deployment Size | | | | |
| 0 | 0 | | | | |
| Function Name | min | avg | median | max | # calls |
| acceptMigration | 35311 | 35311 | 35311 | 35311 | 2 |
| leave | 35297 | 35297 | 35297 | 35297 | 1 |
| lock | 43285 | 90487 | 61938 | 180284 | 7 |
| owner | 362 | 362 | 362 | 362 | 679 |
| stake | 27265 | 282115 | 265681 | 351644 | 684 |
| stakedToken | 212 | 212 | 212 | 212 | 2 |
| unstake | 40180 | 96354 | 78700 | 229598 | 11 |
| STAKING_TOKEN | 193 | 193 | 193 | 193 | 2 |
| acceptMigration | 35141 | 35141 | 35141 | 35141 | 2 |
| leave | 35196 | 35196 | 35196 | 35196 | 1 |
| lock | 43196 | 71010 | 62038 | 162394 | 7 |
| owner | 318 | 318 | 318 | 318 | 727 |
| stake | 27291 | 264286 | 247573 | 342739 | 732 |
| unstake | 40179 | 92967 | 80797 | 190882 | 11 |


| contracts/VaultFactory.sol:VaultFactory contract | | | | | |
|--------------------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 0 | 0 | | | | |
| Function Name | min | avg | median | max | # calls |
| createVault | 696530 | 696530 | 696530 | 696530 | 683 |
| createVault | 682927 | 682927 | 682927 | 682927 | 731 |
| setStakeManager | 23710 | 26669 | 26076 | 30222 | 3 |
| stakeManager | 368 | 1868 | 2368 | 2368 | 4 |

Expand All @@ -68,33 +69,24 @@
| Deployment Cost | Deployment Size | | | | |
| 0 | 0 | | | | |
| Function Name | min | avg | median | max | # calls |
| getExpiredMP | 2427 | 2427 | 2427 | 2427 | 23727 |
| getExpiredMP | 2427 | 2427 | 2427 | 2427 | 25493 |
| transferOwnership | 28533 | 28533 | 28533 | 28533 | 1 |


| 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 | 46239 | 46199 | 46367 | 679 |
| balanceOf | 561 | 2107 | 2561 | 2561 | 30746 |


| script/Deploy.s.sol:Deploy contract | | | | | |
|-------------------------------------|-----------------|---------|---------|---------|---------|
| Deployment Cost | Deployment Size | | | | |
| 6149062 | 29676 | | | | |
| 6513756 | 31297 | | | | |
| Function Name | min | avg | median | max | # calls |
| run | 5343965 | 5343965 | 5343965 | 5343965 | 66 |
| run | 5694023 | 5694023 | 5694023 | 5694023 | 66 |


| script/DeployMigrationStakeManager.s.sol:DeployMigrationStakeManager contract | | | | | |
|-------------------------------------------------------------------------------|-----------------|---------|---------|---------|---------|
| Deployment Cost | Deployment Size | | | | |
| 3312594 | 16444 | | | | |
| 3705689 | 18193 | | | | |
| Function Name | min | avg | median | max | # calls |
| run | 2330294 | 2330294 | 2330294 | 2330294 | 19 |
| run | 2701563 | 2701563 | 2701563 | 2701563 | 19 |


| script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | |
Expand All @@ -114,12 +106,21 @@
| balanceOf | 561 | 1227 | 561 | 2561 | 3 |


| test/mocks/MockERC20.sol:MockERC20 contract | | | | | |
|---------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 0 | 0 | | | | |
| Function Name | min | avg | median | max | # calls |
| approve | 46175 | 46235 | 46199 | 46367 | 727 |
| balanceOf | 561 | 2127 | 2561 | 2561 | 32619 |


| test/script/DeployBroken.s.sol:DeployBroken contract | | | | | |
|------------------------------------------------------|-----------------|---------|---------|---------|---------|
| Deployment Cost | Deployment Size | | | | |
| 4833800 | 23474 | | | | |
| 5211884 | 25233 | | | | |
| Function Name | min | avg | median | max | # calls |
| run | 4183787 | 4183787 | 4183787 | 4183787 | 1 |
| run | 4540259 | 4540259 | 4540259 | 4540259 | 1 |



Expand Down
Loading
Loading