docs: adjust docs to latest changes

This commit is contained in:
r4bbit
2025-03-11 14:38:58 +01:00
parent 4d10993cc9
commit ccd4bec8c7
5 changed files with 196 additions and 191 deletions

View File

@@ -10,7 +10,7 @@
|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------|
| fallback | 5307 | 133628 | 190929 | 190965 | 507 |
| fallback | 746 | 132706 | 190929 | 190965 | 507 |
╰-------------------------------------------------------------------------------------------+-----------------+--------+--------+--------+---------╯
╭-----------------------------------------------------+-----------------+---------+---------+---------+---------╮
@@ -55,19 +55,19 @@
| run | 7309252 | 7309252 | 7309252 | 7309252 | 85 |
╰-----------------------------------------------------------------------------+-----------------+---------+---------+---------+---------╯
╭---------------------------------------------------------+-----------------+------+--------+------+---------╮
| script/DeploymentConfig.s.sol:DeploymentConfig Contract | | | | | |
+============================================================================================================+
| Deployment Cost | Deployment Size | | | | |
|---------------------------------------------------------+-----------------+------+--------+------+---------|
| 0 | 9183 | | | | |
|---------------------------------------------------------+-----------------+------+--------+------+---------|
| | | | | | |
|---------------------------------------------------------+-----------------+------+--------+------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|---------------------------------------------------------+-----------------+------+--------+------+---------|
| activeNetworkConfig | 597 | 2753 | 597 | 6597 | 320 |
╰---------------------------------------------------------+-----------------+------+--------+------+---------╯
╭---------------------------------------------------------+-----------------+-----+--------+-----+---------╮
| script/DeploymentConfig.s.sol:DeploymentConfig Contract | | | | | |
+==========================================================================================================+
| Deployment Cost | Deployment Size | | | | |
|---------------------------------------------------------+-----------------+-----+--------+-----+---------|
| 0 | 9183 | | | | |
|---------------------------------------------------------+-----------------+-----+--------+-----+---------|
| | | | | | |
|---------------------------------------------------------+-----------------+-----+--------+-----+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|---------------------------------------------------------+-----------------+-----+--------+-----+---------|
| activeNetworkConfig | 597 | 597 | 597 | 597 | 320 |
╰---------------------------------------------------------+-----------------+-----+--------+-----+---------╯
╭-------------------------------------------------------------------------------+-----------------+---------+---------+---------+---------╮
| script/UpgradeRewardsStreamerMP.s.sol:UpgradeRewardsStreamerMPScript Contract | | | | | |
@@ -102,23 +102,23 @@
|------------------------------+-----------------+--------+--------+--------+---------|
| approve | 419 | 419 | 419 | 419 | 3 |
|------------------------------+-----------------+--------+--------+--------+---------|
| balanceOf | 21019 | 21019 | 21019 | 21019 | 9 |
| balanceOf | 4019 | 11685 | 10019 | 21019 | 9 |
|------------------------------+-----------------+--------+--------+--------+---------|
| getRewardDistributors | 5140 | 7384 | 7384 | 9628 | 6 |
| getRewardDistributors | 1140 | 3384 | 3384 | 5628 | 6 |
|------------------------------+-----------------+--------+--------+--------+---------|
| initialize | 95872 | 95872 | 95872 | 95872 | 110 |
|------------------------------+-----------------+--------+--------+--------+---------|
| mint | 2654 | 58515 | 74916 | 74916 | 18 |
|------------------------------+-----------------+--------+--------+--------+---------|
| mintAllowance | 28286 | 28322 | 28322 | 28359 | 2 |
| mintAllowance | 7286 | 7322 | 7322 | 7359 | 2 |
|------------------------------+-----------------+--------+--------+--------+---------|
| owner | 2363 | 2363 | 2363 | 2363 | 3 |
| owner | 363 | 1029 | 363 | 2363 | 3 |
|------------------------------+-----------------+--------+--------+--------+---------|
| removeRewardDistributor | 2632 | 12148 | 4824 | 28990 | 9 |
|------------------------------+-----------------+--------+--------+--------+---------|
| setReward | 22043 | 152017 | 164241 | 164241 | 289 |
|------------------------------+-----------------+--------+--------+--------+---------|
| totalSupply | 24827 | 24827 | 24827 | 24827 | 11 |
| totalSupply | 3827 | 6008 | 3827 | 11827 | 11 |
|------------------------------+-----------------+--------+--------+--------+---------|
| transfer | 417 | 417 | 417 | 417 | 3 |
|------------------------------+-----------------+--------+--------+--------+---------|
@@ -144,7 +144,7 @@
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| isApprovedForAll | 510 | 510 | 510 | 510 | 1 |
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| metadataGenerator | 2325 | 2325 | 2325 | 2325 | 1 |
| metadataGenerator | 325 | 325 | 325 | 325 | 1 |
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| safeTransferFrom(address,address,uint256) | 485 | 485 | 485 | 485 | 1 |
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
@@ -154,7 +154,7 @@
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| setMetadataGenerator | 24036 | 27334 | 28983 | 28983 | 3 |
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| tokenURI | 75449 | 75449 | 75449 | 75449 | 1 |
| tokenURI | 68949 | 68949 | 68949 | 68949 | 1 |
|-------------------------------------------------+-----------------+-------+--------+-------+---------|
| transferFrom | 530 | 530 | 530 | 530 | 1 |
╰-------------------------------------------------+-----------------+-------+--------+-------+---------╯
@@ -182,19 +182,19 @@
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| enableEmergencyMode | 2543 | 25291 | 25457 | 25457 | 264 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| getAccountTotalMaxMP | 21191 | 21191 | 21191 | 21191 | 1 |
| getAccountTotalMaxMP | 3191 | 3191 | 3191 | 3191 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| getAccountTotalStakedBalance | 21170 | 21170 | 21170 | 21170 | 1 |
| getAccountTotalStakedBalance | 15170 | 15170 | 15170 | 15170 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| getAccountVaults | 5230 | 5230 | 5230 | 5230 | 4 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| getStakedBalance | 2643 | 2643 | 2643 | 2643 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| getVault | 17970 | 17970 | 17970 | 17970 | 2130 |
| getVault | 1970 | 1970 | 1970 | 1970 | 2130 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| initialize | 92753 | 92753 | 92753 | 92753 | 85 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| lastRewardTime | 2407 | 2407 | 2407 | 2407 | 2 |
| lastRewardTime | 407 | 1407 | 1407 | 2407 | 2 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| leave | 90373 | 90373 | 90373 | 90373 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
@@ -202,21 +202,21 @@
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| migrateToVault | 13570 | 72264 | 15777 | 187446 | 3 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| mpBalanceOf | 4917 | 8695 | 10316 | 10316 | 12 |
| mpBalanceOf | 917 | 2361 | 2316 | 7063 | 12 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| mpBalanceOfAccount | 32356 | 32356 | 32356 | 32356 | 1 |
| mpBalanceOfAccount | 10356 | 10356 | 10356 | 10356 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| mpStakedOf | 2606 | 2606 | 2606 | 2606 | 13 |
| mpStakedOf | 606 | 759 | 606 | 2606 | 13 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| proxiableUUID | 342 | 342 | 342 | 342 | 3 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| registerVault | 2539 | 74492 | 74970 | 74970 | 331 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| rewardEndTime | 2385 | 2385 | 2385 | 2385 | 2 |
| rewardEndTime | 385 | 1385 | 1385 | 2385 | 2 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| rewardStartTime | 2430 | 2430 | 2430 | 2430 | 2 |
| rewardStartTime | 430 | 1430 | 1430 | 2430 | 2 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| rewardsBalanceOf | 20340 | 24475 | 25953 | 26174 | 268 |
| rewardsBalanceOf | 2340 | 3550 | 3953 | 6340 | 268 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| setReward | 2508 | 105559 | 107076 | 107076 | 264 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
@@ -226,21 +226,21 @@
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| stake | 2703 | 234532 | 225331 | 246118 | 2377 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalMP | 6805 | 8257 | 8257 | 9710 | 6 |
| totalMP | 805 | 1257 | 1257 | 1710 | 6 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalMPAccrued | 2385 | 2385 | 2385 | 2385 | 2132 |
| totalMPAccrued | 385 | 385 | 385 | 385 | 2132 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalMPStaked | 2429 | 2429 | 2429 | 2429 | 2135 |
| totalMPStaked | 429 | 429 | 429 | 429 | 2135 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalMaxMP | 2407 | 2407 | 2407 | 2407 | 2132 |
| totalMaxMP | 407 | 407 | 407 | 407 | 2132 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalRewardsAccrued | 2407 | 2407 | 2407 | 2407 | 3 |
| totalRewardsAccrued | 407 | 407 | 407 | 407 | 3 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalRewardsSupply | 6737 | 11068 | 11792 | 11903 | 290 |
| totalRewardsSupply | 998 | 1627 | 1792 | 6737 | 290 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalShares | 4662 | 4662 | 4662 | 4662 | 6 |
| totalShares | 662 | 662 | 662 | 662 | 6 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| totalStaked | 2408 | 2408 | 2408 | 2408 | 2139 |
| totalStaked | 408 | 408 | 408 | 408 | 2139 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| unstake | 50925 | 75960 | 75829 | 83197 | 269 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
@@ -252,7 +252,7 @@
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| upgradeToAndCall | 3228 | 3228 | 3228 | 3228 | 1 |
|------------------------------------------------------+-----------------+--------+--------+--------+---------|
| vaultShares | 4893 | 4893 | 4893 | 4893 | 12 |
| vaultShares | 893 | 1059 | 893 | 2893 | 12 |
╰------------------------------------------------------+-----------------+--------+--------+--------+---------╯
╭----------------------------------------+-----------------+--------+--------+--------+---------╮
@@ -293,21 +293,21 @@
| withdraw | 20754 | 20754 | 20754 | 20754 | 1 |
╰----------------------------------------+-----------------+--------+--------+--------+---------╯
╭----------------------------------------------------+-----------------+-------+--------+--------+---------╮
| src/TransparentProxy.sol:TransparentProxy Contract | | | | | |
+==========================================================================================================+
| Deployment Cost | Deployment Size | | | | |
|----------------------------------------------------+-----------------+-------+--------+--------+---------|
| 0 | 1520 | | | | |
|----------------------------------------------------+-----------------+-------+--------+--------+---------|
| | | | | | |
|----------------------------------------------------+-----------------+-------+--------+--------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|----------------------------------------------------+-----------------+-------+--------+--------+---------|
| fallback | 5208 | 14160 | 7353 | 142390 | 12493 |
|----------------------------------------------------+-----------------+-------+--------+--------+---------|
| implementation | 2346 | 2346 | 2346 | 2346 | 4020 |
╰----------------------------------------------------+-----------------+-------+--------+--------+---------╯
╭----------------------------------------------------+-----------------+------+--------+--------+---------╮
| src/TransparentProxy.sol:TransparentProxy Contract | | | | | |
+=========================================================================================================+
| Deployment Cost | Deployment Size | | | | |
|----------------------------------------------------+-----------------+------+--------+--------+---------|
| 0 | 1520 | | | | |
|----------------------------------------------------+-----------------+------+--------+--------+---------|
| | | | | | |
|----------------------------------------------------+-----------------+------+--------+--------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|----------------------------------------------------+-----------------+------+--------+--------+---------|
| fallback | 708 | 5304 | 853 | 142390 | 12493 |
|----------------------------------------------------+-----------------+------+--------+--------+---------|
| implementation | 346 | 2345 | 2346 | 2346 | 4020 |
╰----------------------------------------------------+-----------------+------+--------+--------+---------╯
╭--------------------------------------------+-----------------+--------+--------+--------+---------╮
| src/VaultFactory.sol:VaultFactory Contract | | | | | |
@@ -336,9 +336,9 @@
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| generate | 54036 | 54036 | 54036 | 54036 | 1 |
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| imagePrefix | 3183 | 3183 | 3183 | 3183 | 2 |
| imagePrefix | 1183 | 2183 | 2183 | 3183 | 2 |
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| imageSuffix | 3227 | 3227 | 3227 | 3227 | 2 |
| imageSuffix | 1227 | 2227 | 2227 | 3227 | 2 |
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| setImageStrings | 25295 | 30634 | 30634 | 35974 | 2 |
╰------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------╯
@@ -358,9 +358,9 @@
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| setURLStrings | 25463 | 30802 | 30802 | 36142 | 2 |
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| urlPrefix | 3184 | 3184 | 3184 | 3184 | 1 |
| urlPrefix | 1184 | 1184 | 1184 | 1184 | 1 |
|------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| urlSuffix | 3228 | 3228 | 3228 | 3228 | 1 |
| urlSuffix | 1228 | 1228 | 1228 | 1228 | 1 |
╰------------------------------------------------------------------------------------------+-----------------+-------+--------+-------+---------╯
╭-------------------------------------------------------------------+-----------------+-------+--------+-------+---------╮
@@ -374,13 +374,13 @@
|-------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|-------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| rewardsBalanceOfAccount | 2549 | 2549 | 2549 | 2549 | 18 |
| rewardsBalanceOfAccount | 549 | 1882 | 2549 | 2549 | 18 |
|-------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| setTotalKarmaShares | 43589 | 43589 | 43589 | 43589 | 26 |
|-------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| setUserKarmaShare | 44194 | 44194 | 44194 | 44194 | 6 |
|-------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| totalRewardsSupply | 324 | 1568 | 2324 | 2324 | 90 |
| totalRewardsSupply | 324 | 990 | 324 | 2324 | 90 |
╰-------------------------------------------------------------------+-----------------+-------+--------+-------+---------╯
╭---------------------------------------------------------------------+-----------------+-------+--------+-------+---------╮
@@ -394,7 +394,7 @@
|---------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|---------------------------------------------------------------------+-----------------+-------+--------+-------+---------|
| generate | 60281 | 60281 | 60281 | 60281 | 1 |
| generate | 58281 | 58281 | 58281 | 58281 | 1 |
╰---------------------------------------------------------------------+-----------------+-------+--------+-------+---------╯
╭---------------------------------------------+-----------------+-------+--------+-------+---------╮
@@ -410,7 +410,7 @@
|---------------------------------------------+-----------------+-------+--------+-------+---------|
| approve | 29075 | 31593 | 29243 | 46259 | 2377 |
|---------------------------------------------+-----------------+-------+--------+-------+---------|
| balanceOf | 2561 | 2561 | 2561 | 2561 | 2930 |
| balanceOf | 561 | 924 | 561 | 2561 | 2930 |
|---------------------------------------------+-----------------+-------+--------+-------+---------|
| mint | 33964 | 37278 | 34144 | 68248 | 2389 |
╰---------------------------------------------+-----------------+-------+--------+-------+---------╯

View File

@@ -1,131 +1,131 @@
CompoundTest:test_RevertWhenInsufficientMPBalance() (gas: 382672)
EmergencyExitTest:test_CannotEnableEmergencyModeTwice() (gas: 93554)
EmergencyExitTest:test_CannotLeaveBeforeEmergencyMode() (gas: 355576)
EmergencyExitTest:test_EmergencyExitBasic() (gas: 549287)
EmergencyExitTest:test_EmergencyExitMultipleUsers() (gas: 987010)
EmergencyExitTest:test_EmergencyExitToAlternateAddress() (gas: 503816)
EmergencyExitTest:test_EmergencyExitWithLock() (gas: 469737)
EmergencyExitTest:test_EmergencyExitWithRewards() (gas: 504273)
EmergencyExitTest:test_EmergencyExitBasic() (gas: 448287)
EmergencyExitTest:test_EmergencyExitMultipleUsers() (gas: 772010)
EmergencyExitTest:test_EmergencyExitToAlternateAddress() (gas: 453816)
EmergencyExitTest:test_EmergencyExitWithLock() (gas: 450737)
EmergencyExitTest:test_EmergencyExitWithRewards() (gas: 438773)
EmergencyExitTest:test_OnlyOwnerCanEnableEmergencyMode() (gas: 39133)
FuzzTests:testFuzz_AccrueMP(uint256,uint256,uint16) (runs: 1000, μ: 604556, ~: 599265)
FuzzTests:testFuzz_AccrueMP_Relock(uint256,uint256,uint16) (runs: 1000, μ: 630345, ~: 632260)
FuzzTests:testFuzz_EmergencyExit(uint256,uint256) (runs: 1000, μ: 609193, ~: 600343)
FuzzTests:testFuzz_Lock(uint256,uint256) (runs: 1000, μ: 606490, ~: 606492)
FuzzTests:testFuzz_Relock(uint256,uint256,uint256) (runs: 1000, μ: 718635, ~: 724885)
FuzzTests:testFuzz_Rewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 662953, ~: 665626)
FuzzTests:testFuzz_Stake(uint256,uint256) (runs: 1000, μ: 487504, ~: 478654)
FuzzTests:testFuzz_Unstake(uint256,uint256,uint16,uint256) (runs: 1000, μ: 613994, ~: 613640)
IntegrationTest:testStakeFoo() (gas: 2475242)
KarmaMintAllowanceTest:testAddKarmaDistributorOnlyOwner() (gas: 373280)
KarmaMintAllowanceTest:testBalanceOf() (gas: 468028)
KarmaMintAllowanceTest:testBalanceOfWithNoSystemTotalKarma() (gas: 69501)
KarmaMintAllowanceTest:testMintAllowance_Available() (gas: 383738)
KarmaMintAllowanceTest:testMintAllowance_NotAvailable() (gas: 383743)
KarmaMintAllowanceTest:testMintOnlyOwner() (gas: 449985)
KarmaMintAllowanceTest:testMint_Ok() (gas: 485651)
FuzzTests:testFuzz_AccrueMP(uint256,uint256,uint16) (runs: 1000, μ: 524556, ~: 519265)
FuzzTests:testFuzz_AccrueMP_Relock(uint256,uint256,uint16) (runs: 1000, μ: 547845, ~: 549760)
FuzzTests:testFuzz_EmergencyExit(uint256,uint256) (runs: 1000, μ: 514193, ~: 505343)
FuzzTests:testFuzz_Lock(uint256,uint256) (runs: 1000, μ: 526490, ~: 526492)
FuzzTests:testFuzz_Relock(uint256,uint256,uint256) (runs: 1000, μ: 547635, ~: 553885)
FuzzTests:testFuzz_Rewards(uint256,uint256,uint256,uint16,uint16) (runs: 1000, μ: 612369, ~: 613626)
FuzzTests:testFuzz_Stake(uint256,uint256) (runs: 1000, μ: 407504, ~: 398654)
FuzzTests:testFuzz_Unstake(uint256,uint256,uint16,uint256) (runs: 1000, μ: 533994, ~: 533640)
IntegrationTest:testStakeFoo() (gas: 1425242)
KarmaMintAllowanceTest:testAddKarmaDistributorOnlyOwner() (gas: 364780)
KarmaMintAllowanceTest:testBalanceOf() (gas: 444028)
KarmaMintAllowanceTest:testBalanceOfWithNoSystemTotalKarma() (gas: 49501)
KarmaMintAllowanceTest:testMintAllowance_Available() (gas: 355738)
KarmaMintAllowanceTest:testMintAllowance_NotAvailable() (gas: 355743)
KarmaMintAllowanceTest:testMintOnlyOwner() (gas: 397985)
KarmaMintAllowanceTest:testMint_Ok() (gas: 425651)
KarmaMintAllowanceTest:testMint_RevertWithAllowanceExceeded() (gas: 405708)
KarmaMintAllowanceTest:testRemoveKarmaDistributorOnlyOwner() (gas: 97355)
KarmaMintAllowanceTest:testRemoveKarmaDistributorOnlyOwner() (gas: 88855)
KarmaMintAllowanceTest:testRemoveUnknownKarmaDistributor() (gas: 41416)
KarmaMintAllowanceTest:testTotalSupply() (gas: 380205)
KarmaMintAllowanceTest:testTransfersNotAllowed() (gas: 61719)
KarmaMintAllowanceTest:testTotalSupply() (gas: 352205)
KarmaMintAllowanceTest:testTransfersNotAllowed() (gas: 40219)
KarmaNFTTest:testApproveNotAllowed() (gas: 10507)
KarmaNFTTest:testGetApproved() (gas: 10531)
KarmaNFTTest:testIsApprovedForAll() (gas: 10705)
KarmaNFTTest:testSafeTransferNotAllowed() (gas: 10688)
KarmaNFTTest:testSafeTransferWithDataNotAllowed() (gas: 10884)
KarmaNFTTest:testSetApprovalForAllNotAllowed() (gas: 8519)
KarmaNFTTest:testSetMetadataGenerator() (gas: 986525)
KarmaNFTTest:testSetMetadataGenerator() (gas: 984525)
KarmaNFTTest:testSetMetadataGeneratorRevert() (gas: 981085)
KarmaNFTTest:testTokenURI() (gas: 1086310)
KarmaNFTTest:testTokenURI() (gas: 1079810)
KarmaNFTTest:testTransferNotAllowed() (gas: 10701)
KarmaOwnershipTest:testAddKarmaDistributorOnlyOwner() (gas: 373268)
KarmaOwnershipTest:testBalanceOf() (gas: 467998)
KarmaOwnershipTest:testBalanceOfWithNoSystemTotalKarma() (gas: 69479)
KarmaOwnershipTest:testAddKarmaDistributorOnlyOwner() (gas: 364768)
KarmaOwnershipTest:testBalanceOf() (gas: 443998)
KarmaOwnershipTest:testBalanceOfWithNoSystemTotalKarma() (gas: 49479)
KarmaOwnershipTest:testInitialOwner() (gas: 17601)
KarmaOwnershipTest:testMintOnlyOwner() (gas: 449949)
KarmaOwnershipTest:testOwnershipTransfer() (gas: 124047)
KarmaOwnershipTest:testRemoveKarmaDistributorOnlyOwner() (gas: 97320)
KarmaOwnershipTest:testMintOnlyOwner() (gas: 397949)
KarmaOwnershipTest:testOwnershipTransfer() (gas: 98047)
KarmaOwnershipTest:testRemoveKarmaDistributorOnlyOwner() (gas: 88820)
KarmaOwnershipTest:testRemoveUnknownKarmaDistributor() (gas: 41398)
KarmaOwnershipTest:testTotalSupply() (gas: 380175)
KarmaOwnershipTest:testTransfersNotAllowed() (gas: 61696)
KarmaTest:testAddKarmaDistributorOnlyOwner() (gas: 373268)
KarmaTest:testBalanceOf() (gas: 467998)
KarmaTest:testBalanceOfWithNoSystemTotalKarma() (gas: 69545)
KarmaTest:testMintOnlyOwner() (gas: 449949)
KarmaTest:testRemoveKarmaDistributorOnlyOwner() (gas: 97298)
KarmaOwnershipTest:testTotalSupply() (gas: 352175)
KarmaOwnershipTest:testTransfersNotAllowed() (gas: 40196)
KarmaTest:testAddKarmaDistributorOnlyOwner() (gas: 364768)
KarmaTest:testBalanceOf() (gas: 443998)
KarmaTest:testBalanceOfWithNoSystemTotalKarma() (gas: 49545)
KarmaTest:testMintOnlyOwner() (gas: 397949)
KarmaTest:testRemoveKarmaDistributorOnlyOwner() (gas: 88798)
KarmaTest:testRemoveUnknownKarmaDistributor() (gas: 41398)
KarmaTest:testTotalSupply() (gas: 380175)
KarmaTest:testTransfersNotAllowed() (gas: 61741)
LeaveTest:test_LeaveShouldProperlyUpdateAccounting() (gas: 9746127)
KarmaTest:testTotalSupply() (gas: 352175)
KarmaTest:testTransfersNotAllowed() (gas: 40241)
LeaveTest:test_LeaveShouldProperlyUpdateAccounting() (gas: 9596127)
LeaveTest:test_RevertWhenStakeManagerIsTrusted() (gas: 352670)
LeaveTest:test_TrustNewStakeManager() (gas: 9661282)
LeaveTest:test_TrustNewStakeManager() (gas: 9650282)
LockTest:test_LockFailsWithInvalidPeriod(uint256) (runs: 1000, μ: 404125, ~: 404151)
LockTest:test_LockFailsWithNoStake() (gas: 109453)
LockTest:test_LockFailsWithZero() (gas: 362797)
LockTest:test_LockMultipleTimesExceedMaxLock() (gas: 818437)
LockTest:test_LockWithPriorLock() (gas: 717617)
LockTest:test_LockWithoutPriorLock() (gas: 552532)
LockTest:test_LockMultipleTimesExceedMaxLock() (gas: 687937)
LockTest:test_LockWithPriorLock() (gas: 591117)
LockTest:test_LockWithoutPriorLock() (gas: 469032)
LockTest:test_RevertWhenVaultToLockIsEmpty() (gas: 109411)
MaliciousUpgradeTest:test_UpgradeStackOverflowStakeManager() (gas: 2080432)
MaliciousUpgradeTest:test_UpgradeStackOverflowStakeManager() (gas: 2018932)
MathTest:test_CalcAbsoluteMaxTotalMP() (gas: 5196)
MathTest:test_CalcAccrueMP() (gas: 8511)
MathTest:test_CalcBonusMP() (gas: 30612)
MathTest:test_CalcBonusMP() (gas: 19112)
MathTest:test_CalcInitialMP() (gas: 5728)
MathTest:test_CalcMaxAccruedMP() (gas: 4842)
MathTest:test_CalcMaxTotalMP() (gas: 31352)
MultipleVaultsStakeTest:test_StakeMultipleVaults() (gas: 977480)
MathTest:test_CalcMaxTotalMP() (gas: 19852)
MultipleVaultsStakeTest:test_StakeMultipleVaults() (gas: 860480)
NFTMetadataGeneratorSVGTest:testGenerateMetadata() (gas: 91375)
NFTMetadataGeneratorSVGTest:testSetImageStrings() (gas: 77581)
NFTMetadataGeneratorSVGTest:testSetImageStrings() (gas: 60081)
NFTMetadataGeneratorSVGTest:testSetImageStringsRevert() (gas: 35891)
NFTMetadataGeneratorURLTest:testGenerateMetadata() (gas: 108068)
NFTMetadataGeneratorURLTest:testSetBaseURL() (gas: 59131)
NFTMetadataGeneratorURLTest:testSetBaseURL() (gas: 50631)
NFTMetadataGeneratorURLTest:testSetBaseURLRevert() (gas: 36066)
RewardsStreamerMP_RewardsTest:testRewardsBalanceOf() (gas: 2769560)
RewardsStreamerMP_RewardsTest:testSetRewards() (gas: 275680)
RewardsStreamerMP_RewardsTest:testRewardsBalanceOf() (gas: 1326060)
RewardsStreamerMP_RewardsTest:testSetRewards() (gas: 224680)
RewardsStreamerMP_RewardsTest:testSetRewards_RevertsBadAmount() (gas: 61282)
RewardsStreamerMP_RewardsTest:testSetRewards_RevertsBadDuration() (gas: 101059)
RewardsStreamerMP_RewardsTest:testSetRewards_RevertsNotAuthorized() (gas: 39344)
RewardsStreamerMP_RewardsTest:testTotalRewardsSupply() (gas: 1295345)
StakeTest:test_StakeMultipleAccounts() (gas: 715910)
StakeTest:test_StakeMultipleAccountsAndRewards() (gas: 770858)
StakeTest:test_StakeMultipleAccountsMPIncreasesMaxMPDoesNotChange() (gas: 1439802)
StakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 651956)
StakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 680466)
StakeTest:test_StakeOneAccount() (gas: 414901)
StakeTest:test_StakeOneAccountAndRewards() (gas: 469845)
StakeTest:test_StakeOneAccountMPIncreasesMaxMPDoesNotChange() (gas: 828756)
StakeTest:test_StakeOneAccountReachingMPLimit() (gas: 819323)
StakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 398928)
StakeTest:test_StakeOneAccountWithMinLockUp() (gas: 399502)
StakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 399591)
StakeVaultMigrationTest:testMigrateToVault() (gas: 1239404)
RewardsStreamerMP_RewardsTest:testTotalRewardsSupply() (gas: 760845)
StakeTest:test_StakeMultipleAccounts() (gas: 597410)
StakeTest:test_StakeMultipleAccountsAndRewards() (gas: 605858)
StakeTest:test_StakeMultipleAccountsMPIncreasesMaxMPDoesNotChange() (gas: 1033802)
StakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 607956)
StakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 629966)
StakeTest:test_StakeOneAccount() (gas: 336901)
StakeTest:test_StakeOneAccountAndRewards() (gas: 345345)
StakeTest:test_StakeOneAccountMPIncreasesMaxMPDoesNotChange() (gas: 612256)
StakeTest:test_StakeOneAccountReachingMPLimit() (gas: 600323)
StakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 354928)
StakeTest:test_StakeOneAccountWithMinLockUp() (gas: 355502)
StakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 355591)
StakeVaultMigrationTest:testMigrateToVault() (gas: 951404)
StakeVaultMigrationTest:test_RevertWhenMigrationVaultNotEmpty() (gas: 648781)
StakeVaultMigrationTest:test_RevertWhenNotOwnerOfMigrationVault() (gas: 68131)
StakeVaultTest:testOwner() (gas: 15262)
StakingTokenTest:testOwner() (gas: 15262)
StakingTokenTest:testStakeToken() (gas: 13144)
TrustedCodehashAccessTest:test_RevertWhenProxyCloneCodehashNotTrusted() (gas: 2023465)
UnstakeTest:test_StakeMultipleAccounts() (gas: 715954)
UnstakeTest:test_StakeMultipleAccountsAndRewards() (gas: 770902)
UnstakeTest:test_StakeMultipleAccountsMPIncreasesMaxMPDoesNotChange() (gas: 1439779)
UnstakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 651933)
UnstakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 680443)
UnstakeTest:test_StakeOneAccount() (gas: 414901)
UnstakeTest:test_StakeOneAccountAndRewards() (gas: 469889)
UnstakeTest:test_StakeOneAccountMPIncreasesMaxMPDoesNotChange() (gas: 828733)
UnstakeTest:test_StakeOneAccountReachingMPLimit() (gas: 819367)
UnstakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 398950)
UnstakeTest:test_StakeOneAccountWithMinLockUp() (gas: 399524)
UnstakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 399569)
UnstakeTest:test_UnstakeBonusMPAndAccuredMP() (gas: 824343)
UnstakeTest:test_UnstakeMultipleAccounts() (gas: 1094410)
UnstakeTest:test_UnstakeMultipleAccountsAndRewards() (gas: 1387019)
UnstakeTest:test_UnstakeOneAccount() (gas: 794606)
UnstakeTest:test_UnstakeOneAccountAndAccruedMP() (gas: 776765)
UnstakeTest:test_UnstakeOneAccountAndRewards() (gas: 706843)
UnstakeTest:test_UnstakeOneAccountWithLockUpAndAccruedMP() (gas: 778965)
UnstakeTest:test_StakeMultipleAccounts() (gas: 597454)
UnstakeTest:test_StakeMultipleAccountsAndRewards() (gas: 605902)
UnstakeTest:test_StakeMultipleAccountsMPIncreasesMaxMPDoesNotChange() (gas: 1033779)
UnstakeTest:test_StakeMultipleAccountsWithMinLockUp() (gas: 607933)
UnstakeTest:test_StakeMultipleAccountsWithRandomLockUp() (gas: 629943)
UnstakeTest:test_StakeOneAccount() (gas: 336901)
UnstakeTest:test_StakeOneAccountAndRewards() (gas: 345389)
UnstakeTest:test_StakeOneAccountMPIncreasesMaxMPDoesNotChange() (gas: 612233)
UnstakeTest:test_StakeOneAccountReachingMPLimit() (gas: 600367)
UnstakeTest:test_StakeOneAccountWithMaxLockUp() (gas: 354950)
UnstakeTest:test_StakeOneAccountWithMinLockUp() (gas: 355524)
UnstakeTest:test_StakeOneAccountWithRandomLockUp() (gas: 355569)
UnstakeTest:test_UnstakeBonusMPAndAccuredMP() (gas: 639843)
UnstakeTest:test_UnstakeMultipleAccounts() (gas: 837910)
UnstakeTest:test_UnstakeMultipleAccountsAndRewards() (gas: 951519)
UnstakeTest:test_UnstakeOneAccount() (gas: 572606)
UnstakeTest:test_UnstakeOneAccountAndAccruedMP() (gas: 597765)
UnstakeTest:test_UnstakeOneAccountAndRewards() (gas: 493843)
UnstakeTest:test_UnstakeOneAccountWithLockUpAndAccruedMP() (gas: 627465)
UpgradeTest:test_RevertWhenNotOwner() (gas: 3552019)
UpgradeTest:test_UpgradeStakeManager() (gas: 9572252)
VaultRegistrationTest:test_VaultRegistration() (gas: 89962)
UpgradeTest:test_UpgradeStakeManager() (gas: 9486252)
VaultRegistrationTest:test_VaultRegistration() (gas: 62962)
WithdrawTest:testOwner() (gas: 15296)
WithdrawTest:test_CannotWithdrawStakedFunds() (gas: 392882)
WithdrawTest:test_CannotWithdrawStakedFunds() (gas: 368382)

View File

@@ -1,18 +1,18 @@
# XPToken
# Karma
## Overview
The XPToken is an ERC-20 token implementation with a modified supply mechanism that incorporates external reward
providers. XP tokens are not transferrable, but they can be used as voting power in the Status Network.
The Karma contract is an ERC-20 token implementation with a modified supply mechanism that incorporates external reward
distributors. Karma tokens are not transferrable, but they can be used as voting power in the Status Network.
## Features
- **Minting with Restrictions:**
- The contract owner (admin) can mint tokens, and their accounting is kept internally.
- Prevents exceeding a dynamically calculated mint allowance.
- **Reward Providers Integration:**
- Tracks balances and supplies from external reward providers.
- Allows addition and removal of reward providers by the owner.
- **Reward Distributors Integration:**
- Tracks balances and supplies from external reward distributors.
- Allows addition and removal of reward distributor by the owner.
- **Non-Transferrable Tokens:**
- Transfers, approvals, and allowances are disabled.
- Users can only receive balances from minting or reward distributions.
@@ -21,22 +21,22 @@ providers. XP tokens are not transferrable, but they can be used as voting power
## Contract Details
- `NAME`: "XP Token"
- `SYMBOL`: "XP"
- `NAME`: "Karma"
- `SYMBOL`: "KARMA"
### State Variables
- `rewardProviders`: A list of addresses implementing the `IRewardProvider` interface.
- `rewardDistributors`: A list of addresses implementing the `IRewardDistributor` interface.
### Errors
- `XPToken__MintAllowanceExceeded`: Raised when minting exceeds the allowed threshold.
- `XPToken__TransfersNotAllowed`: Raised when a transfer, approval, or transferFrom is attempted.
- `Karma__MintAllowanceExceeded`: Raised when minting exceeds the allowed threshold.
- `Karma__TransfersNotAllowed`: Raised when a transfer, approval, or transferFrom is attempted.
## Supply and Balance Calculation
- **totalSupply()**: Sum of the internal supply and the sum of external supplies from reward providers.
- **balanceOf(address)**: Internal balance plus the sum of external balances from reward providers.
- **totalSupply()**: Sum of the internal supply and the sum of external supplies from reward distributors.
- **balanceOf(address)**: Internal balance plus the sum of external balances from reward distributors.
## Sources of XP Tokens

View File

@@ -117,18 +117,19 @@ Alice receives 8.2 MP for the 30 days she has staked.
### On real-time MP accrual
As mentioned a couple of times above, the more time has elapsed, the more MP are accrued. In fact, MP are increase every
second and can be monitored in real-time via the smart contracts. Whenever a state changing action is performed by an
account (eg. staking, unstaking), the accrued MP are updated in storage.
second and can be monitored in real-time via the smart contracts. Users have to "claim" their accrued MP by calling a
function on the stake manager contract.
This means that, unless the maximum amount of MP has been reached (more on that below), the AMP amount in storage will
This means that, unless the maximum amount of MP has been reached (more on that below), the MP amount in storage will
likely be different from the real-time value.
### Total MP
Total MP combines both Initial MP and Accrued MP:
Total MP combines both accrued MP and pending MP. The accrued MP contain the initial MP and the MP accrued over time.
Pending MP are the ones that have yet to be "claimed" by the user:
$$
\text{MP}_ \text{Total} = \text{MP}_ \text{Initial} + \text{MP}_ \text{Accrued}
\text{MP}_ \text{Total} = \text{MP}_ \text{Accrued} + \text{MP}_ \text{Pending}
$$
This total is used to calculate the users share of rewards, which we'll cover in another chapter.

View File

@@ -14,34 +14,38 @@ system components, their interactions, and the data flow between them.
system. It maintains its own onchain storage. Stake vaults interact with the staking system through the proxy.
4. **Stake manager implementation**: A smart contract in which the logic of the staking system resides. The stake
manager proxy uses this contract to execute the staking system's logic. This contract is ugpradeable.
5. **XP balance providers**: Systems that provide XP token balances to the XP token contract. The staking system is one
such XP balance provider.
6. **XP token**: An ERC20 token contract that issues XP tokens to accounts based on their stake. In addition to its own
balance accounting, it relies on XP balance providers to aggregate total balances of individual accounts. XP tokens
5. **Karma distributor**: Systems that distribute Karma tokens on behalf of the Karma token contract. The staking system
is one such a Karma distributor.
6. **Karma**: An ERC20 token contract that issues Karma tokens to accounts based on their stake. In addition to its own
balance accounting, it relies on Karma distributors to aggregate total balances of individual accounts. Karma tokens
are not transferable.
7. **XP NFT**: An ERC721 token contract that maintains non-transferable NFTs of accounts that participate in the XP
program, either via the staking system or other activities. The XP NFTs rely on the XP token contract to render an
accounts XP balance.
8. **Accounts, DApps, Wallets**: External entities that consume the XP tokens and NFTs.
7. **Karma NFT**: An ERC721 token contract that maintains non-transferable NFTs of accounts that participate in the
Karma program, either via the staking system or other activities. The Karma NFTs rely on the Karma token contract to
render an account's Karma balance.
8. **Accounts, DApps, Wallets**: External entities that consume the Karma tokens and NFTs.
9. **DAO/Admin**: Entity that controls the contract and sets XP rewards in the system which will be distributed
according to every participant's stake.
## How the system works
- Accounts (EOAs or smart accounts) create one or multiple stake vaults to stake their SNT and participate in the XP
- Accounts (EOAs or smart accounts) create one or multiple stake vaults to stake their SNT and participate in the Karma
Programme. In most cases, accounts will have only one stake vault, but nothing prevents them from creating more vaults
with different configurations.
- The stake vaults interact with the stake manager through the proxy by forwarding calls to the implementation contract.
When an account stakes funds, their funds are moved into the stake vault and they will stay there until the account
decides to unstake them.
- While the account is staking, it will accrue experience points (XP) based on the amount of SNT staked and the duration
of the stake. The longer accounts stake, the more XP they will earn.
- By locking up their stake, accounts receive multiplier points that increase their initial XP earnings upon staking.
- At any point in time, accounts can view their XP token balance in their wallets and how it updates in realtime.
- In addition, every account receives an NFT that represents their participation in the XP Programme. It will evolve as
the account gains XP.
- Eventually, an account will either reach the maximum amount of XP they can accrue based on their stake amount, at
which point they will no longer earn XP, or they will decide to unstake their funds, at which point they will not only
stop earning XP, but even lose the XP they've received through staking.
- The XP in the account's wallet can be used to access exclusive features or services within the Status app or other
DApps that support the XP token, like voting in governance proposals or participating in exclusive events.
- While the account is staking, it will accrue Karma points based on the amount of SNT staked and the duration of the
stake. The longer accounts stake, the more Karma they will earn.
- By locking up their stake, accounts receive multiplier points that increase their initial Karma earnings upon staking.
- At any point in time, accounts can view their Karma token balance in their wallets and how it updates in realtime.
- In addition, every account receives an NFT that represents their participation in the Karma Programme. It will evolve
as the account gains Karma.
- Under the hood, multiplier points accrue over time. Accounts can compound their multiplier points to increase their
Karma rewards in the system.
- Eventually, an account will reach the maximum amount of multiplier points they can accrue based on their stake amount,
at which point their total weight in Karma shares will no longer increase. They still earn Karma rewards set by the
admin, according to their share.
- Accounts can unstake their SNT at any time (unless locked up). When they do, they will receive their initial stake
back, along with any Karma rewards they have earned, however, they will loose their multiplier points.
- The Karma in the account's wallet can be used to access exclusive features or services within the Status app or other
DApps that support the Karma token, like voting in governance proposals or participating in exclusive events.