Skip to content

Commit

Permalink
refactor: move vault registrations into dedicated registry contract
Browse files Browse the repository at this point in the history
  • Loading branch information
0x-r4bbit committed Dec 1, 2024
1 parent dc9cfcc commit db96cd7
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 132 deletions.
114 changes: 62 additions & 52 deletions .gas-report
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,71 @@
| src/RewardsStreamerMP.sol:RewardsStreamerMP contract | | | | | |
|------------------------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 2529128 | 11658 | | | | |
| 2510128 | 11575 | | | | |
| Function Name | min | avg | median | max | # calls |
| MAX_LOCKUP_PERIOD | 294 | 294 | 294 | 294 | 23 |
| MAX_MULTIPLIER | 295 | 295 | 295 | 295 | 30 |
| MAX_LOCKUP_PERIOD | 272 | 272 | 272 | 272 | 23 |
| MAX_MULTIPLIER | 251 | 251 | 251 | 251 | 30 |
| MIN_LOCKUP_PERIOD | 274 | 274 | 274 | 274 | 11 |
| MP_RATE_PER_YEAR | 253 | 253 | 253 | 253 | 3 |
| SCALE_FACTOR | 251 | 251 | 251 | 251 | 41 |
| SCALE_FACTOR | 272 | 272 | 272 | 272 | 41 |
| STAKING_TOKEN | 2428 | 2428 | 2428 | 2428 | 262 |
| accountedRewards | 350 | 939 | 350 | 2350 | 78 |
| emergencyModeEnabled | 2398 | 2398 | 2398 | 2398 | 7 |
| enableEmergencyMode | 2506 | 19413 | 24698 | 24698 | 8 |
| accountedRewards | 395 | 984 | 395 | 2395 | 78 |
| emergencyModeEnabled | 2399 | 2399 | 2399 | 2399 | 7 |
| enableEmergencyMode | 2462 | 19369 | 24654 | 24654 | 8 |
| getAccount | 1639 | 1639 | 1639 | 1639 | 72 |
| getStakedBalance | 2607 | 2607 | 2607 | 2607 | 1 |
| getUserTotalMP | 9208 | 9208 | 9208 | 9208 | 1 |
| getUserTotalMaxMP | 3166 | 3166 | 3166 | 3166 | 1 |
| getUserTotalStakedBalance | 15140 | 15140 | 15140 | 15140 | 1 |
| getUserVaults | 5245 | 5245 | 5245 | 5245 | 4 |
| initialize | 137854 | 137854 | 137854 | 137854 | 53 |
| getStakedBalance | 2629 | 2629 | 2629 | 2629 | 1 |
| getUserTotalMP | 11497 | 11497 | 11497 | 11497 | 1 |
| getUserTotalMaxMP | 5412 | 5412 | 5412 | 5412 | 1 |
| getUserTotalStakedBalance | 17407 | 17407 | 17407 | 17407 | 1 |
| getUserVaults | 6769 | 7894 | 6769 | 11269 | 4 |
| initialize | 160076 | 160076 | 160076 | 160076 | 53 |
| isTrustedCodehash | 563 | 563 | 563 | 563 | 207 |
| leave | 62621 | 62621 | 62621 | 62621 | 1 |
| lock | 12041 | 35954 | 16370 | 79452 | 3 |
| proxiableUUID | 354 | 354 | 354 | 354 | 3 |
| registerVault | 55844 | 72698 | 72944 | 72944 | 209 |
| rewardIndex | 350 | 375 | 350 | 2350 | 78 |
| setTrustedCodehash | 26227 | 26227 | 26227 | 26227 | 53 |
| stake | 137282 | 172935 | 178872 | 199351 | 64 |
| totalMP | 351 | 351 | 351 | 351 | 81 |
| totalMaxMP | 395 | 395 | 395 | 395 | 81 |
| leave | 62642 | 62642 | 62642 | 62642 | 1 |
| lock | 17522 | 41435 | 21851 | 84933 | 3 |
| proxiableUUID | 331 | 331 | 331 | 331 | 3 |
| registerVault | 63444 | 80298 | 80544 | 80544 | 209 |
| rewardIndex | 394 | 419 | 394 | 2394 | 78 |
| setTrustedCodehash | 26249 | 26249 | 26249 | 26249 | 53 |
| stake | 142720 | 178377 | 184316 | 204795 | 64 |
| totalMP | 373 | 373 | 373 | 373 | 81 |
| totalMaxMP | 350 | 350 | 350 | 350 | 81 |
| totalStaked | 374 | 374 | 374 | 374 | 82 |
| unstake | 66758 | 87497 | 66758 | 122819 | 13 |
| updateAccountMP | 15442 | 17680 | 17944 | 17944 | 19 |
| updateGlobalState | 11066 | 41321 | 30542 | 63493 | 28 |
| upgradeToAndCall | 3181 | 9357 | 10905 | 10905 | 5 |
| unstake | 72193 | 92932 | 72193 | 128254 | 13 |
| updateAccountMP | 15464 | 17702 | 17966 | 17966 | 19 |
| updateGlobalState | 11044 | 41299 | 30520 | 63471 | 28 |
| upgradeToAndCall | 3250 | 9415 | 10954 | 10964 | 5 |


| src/StakeManagerProxy.sol:StakeManagerProxy contract | | | | | |
|------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 278710 | 1263 | | | | |
| 301321 | 1295 | | | | |
| Function Name | min | avg | median | max | # calls |
| MAX_LOCKUP_PERIOD | 721 | 1503 | 721 | 5221 | 23 |
| MAX_MULTIPLIER | 722 | 1622 | 722 | 5222 | 30 |
| MAX_LOCKUP_PERIOD | 699 | 1481 | 699 | 5199 | 23 |
| MAX_MULTIPLIER | 678 | 1578 | 678 | 5178 | 30 |
| MIN_LOCKUP_PERIOD | 701 | 3973 | 5201 | 5201 | 11 |
| MP_RATE_PER_YEAR | 680 | 680 | 680 | 680 | 3 |
| SCALE_FACTOR | 678 | 678 | 678 | 678 | 41 |
| SCALE_FACTOR | 699 | 699 | 699 | 699 | 41 |
| STAKING_TOKEN | 7355 | 7355 | 7355 | 7355 | 262 |
| accountedRewards | 777 | 1366 | 777 | 2777 | 78 |
| emergencyModeEnabled | 7325 | 7325 | 7325 | 7325 | 7 |
| enableEmergencyMode | 28501 | 45402 | 50686 | 50686 | 8 |
| accountedRewards | 822 | 1411 | 822 | 2822 | 78 |
| emergencyModeEnabled | 7326 | 7326 | 7326 | 7326 | 7 |
| enableEmergencyMode | 28457 | 45358 | 50642 | 50642 | 8 |
| getAccount | 2093 | 2093 | 2093 | 2093 | 72 |
| getStakedBalance | 7537 | 7537 | 7537 | 7537 | 1 |
| getUserTotalMP | 9638 | 9638 | 9638 | 9638 | 1 |
| getUserTotalMaxMP | 3596 | 3596 | 3596 | 3596 | 1 |
| getUserTotalStakedBalance | 15570 | 15570 | 15570 | 15570 | 1 |
| getUserVaults | 5681 | 6806 | 5681 | 10181 | 4 |
| getStakedBalance | 7559 | 7559 | 7559 | 7559 | 1 |
| getUserTotalMP | 11927 | 11927 | 11927 | 11927 | 1 |
| getUserTotalMaxMP | 5842 | 5842 | 5842 | 5842 | 1 |
| getUserTotalStakedBalance | 17837 | 17837 | 17837 | 17837 | 1 |
| getUserVaults | 7205 | 9455 | 7205 | 16205 | 4 |
| implementation | 343 | 840 | 343 | 2343 | 350 |
| isTrustedCodehash | 993 | 993 | 993 | 993 | 207 |
| rewardIndex | 777 | 802 | 777 | 2777 | 78 |
| setTrustedCodehash | 52873 | 52873 | 52873 | 52873 | 53 |
| totalMP | 778 | 778 | 778 | 778 | 81 |
| totalMaxMP | 822 | 822 | 822 | 822 | 81 |
| rewardIndex | 821 | 846 | 821 | 2821 | 78 |
| setTrustedCodehash | 52895 | 52895 | 52895 | 52895 | 53 |
| totalMP | 800 | 800 | 800 | 800 | 81 |
| totalMaxMP | 777 | 777 | 777 | 777 | 81 |
| totalStaked | 801 | 801 | 801 | 801 | 82 |
| updateAccountMP | 41801 | 44039 | 44303 | 44303 | 19 |
| updateGlobalState | 37054 | 67309 | 56530 | 89481 | 28 |
| upgradeToAndCall | 29824 | 35995 | 37541 | 37541 | 5 |
| updateAccountMP | 41823 | 44061 | 44325 | 44325 | 19 |
| updateGlobalState | 37032 | 67287 | 56508 | 89459 | 28 |
| upgradeToAndCall | 29893 | 36052 | 37590 | 37600 | 5 |


| src/StakeVault.sol:StakeVault contract | | | | | |
Expand All @@ -88,16 +88,26 @@
| 1420425 | 6695 | | | | |
| Function Name | min | avg | median | max | # calls |
| STAKING_TOKEN | 216 | 216 | 216 | 216 | 1 |
| emergencyExit | 36353 | 48857 | 48091 | 65191 | 7 |
| leave | 33507 | 132714 | 63186 | 370978 | 4 |
| lock | 33245 | 62013 | 50779 | 113249 | 4 |
| emergencyExit | 36354 | 48858 | 48092 | 65192 | 7 |
| leave | 33507 | 132718 | 63195 | 370978 | 4 |
| lock | 33245 | 66124 | 56260 | 118730 | 4 |
| owner | 2339 | 2339 | 2339 | 2339 | 209 |
| register | 86993 | 103847 | 104093 | 104093 | 209 |
| stake | 33411 | 244157 | 253376 | 273903 | 65 |
| register | 94593 | 111447 | 111693 | 111693 | 209 |
| stake | 33411 | 249516 | 258820 | 279347 | 65 |
| stakeManager | 368 | 368 | 368 | 368 | 209 |
| trustStakeManager | 28953 | 28953 | 28953 | 28953 | 1 |
| unstake | 33282 | 119756 | 116285 | 159183 | 14 |
| withdraw | 42267 | 42267 | 42267 | 42267 | 1 |
| unstake | 33282 | 124648 | 121720 | 164618 | 14 |
| withdraw | 42289 | 42289 | 42289 | 42289 | 1 |


| src/StakeVaultRegistry.sol:StakeVaultRegistry contract | | | | | |
|--------------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 478735 | 2129 | | | | |
| Function Name | min | avg | median | max | # calls |
| setStakeManager | 46008 | 46008 | 46008 | 46008 | 53 |
| vaultOwners | 2558 | 2558 | 2558 | 2558 | 80 |
| vaultsOf | 1868 | 5148 | 5109 | 11868 | 7 |


| src/XPNFTToken.sol:XPNFTToken contract | | | | | |
Expand Down
Loading

0 comments on commit db96cd7

Please sign in to comment.