remove _mint impossible overflow

This commit is contained in:
Ricardo Guilherme Schmidt 2023-09-26 12:46:06 -03:00
parent 2831aeae66
commit eab5b42b17
3 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,7 @@
| contracts/MiniMeToken.sol:MiniMeToken contract | | | | | | | contracts/MiniMeToken.sol:MiniMeToken contract | | | | | |
|------------------------------------------------|-----------------|-------|--------|-------|---------| |------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | | | Deployment Cost | Deployment Size | | | | |
| 2115066 | 11989 | | | | | | 2098051 | 11904 | | | | |
| Function Name | min | avg | median | max | # calls | | Function Name | min | avg | median | max | # calls |
| DOMAIN_SEPARATOR | 387 | 387 | 387 | 387 | 10 | | DOMAIN_SEPARATOR | 387 | 387 | 387 | 387 | 10 |
| allowance | 0 | 190 | 0 | 763 | 16 | | allowance | 0 | 190 | 0 | 763 | 16 |
@ -15,7 +15,7 @@
| decimals | 0 | 0 | 0 | 0 | 10 | | decimals | 0 | 0 | 0 | 0 | 10 |
| destroyTokens | 2098 | 4543 | 3890 | 7643 | 3 | | destroyTokens | 2098 | 4543 | 3890 | 7643 | 3 |
| enableTransfers | 0 | 0 | 0 | 0 | 3 | | enableTransfers | 0 | 0 | 0 | 0 | 3 |
| generateTokens | 0 | 16391 | 0 | 95282 | 64 | | generateTokens | 0 | 16361 | 0 | 95178 | 64 |
| name | 0 | 0 | 0 | 0 | 10 | | name | 0 | 0 | 0 | 0 | 10 |
| nonces | 654 | 1854 | 2654 | 2654 | 5 | | nonces | 654 | 1854 | 2654 | 2654 | 5 |
| parentSnapShotBlock | 0 | 0 | 0 | 0 | 11 | | parentSnapShotBlock | 0 | 0 | 0 | 0 | 11 |

View File

@ -11,22 +11,22 @@ ClaimTokensTest:testClaimETH() (gas: 13659)
ClaimTokensTest:testClaimSelf() (gas: 60260) ClaimTokensTest:testClaimSelf() (gas: 60260)
ClaimTokensTest:testDeployment() (gas: 26595) ClaimTokensTest:testDeployment() (gas: 26595)
CreateCloneTokenTest:testCloneFutureSnapshot() (gas: 100903) CreateCloneTokenTest:testCloneFutureSnapshot() (gas: 100903)
CreateCloneTokenTest:testCreateCloneToken() (gas: 2154151) CreateCloneTokenTest:testCreateCloneToken() (gas: 2137113)
CreateCloneTokenTest:testDeployment() (gas: 26550) CreateCloneTokenTest:testDeployment() (gas: 26550)
CreateCloneTokenTest:testGenerateTokens() (gas: 101358) CreateCloneTokenTest:testGenerateTokens() (gas: 101254)
DestroyTokensTest:testDeployment() (gas: 26595) DestroyTokensTest:testDeployment() (gas: 26595)
DestroyTokensTest:testDestroyTokens() (gas: 12143) DestroyTokensTest:testDestroyTokens() (gas: 12143)
DestroyTokensTest:testDestroyTokensNotEnoughBalance() (gas: 9246) DestroyTokensTest:testDestroyTokensNotEnoughBalance() (gas: 9246)
DestroyTokensTest:testDestroyTokensNotEnoughSupply() (gas: 7787) DestroyTokensTest:testDestroyTokensNotEnoughSupply() (gas: 7787)
GenerateTokensTest:testDeployment() (gas: 26550) GenerateTokensTest:testDeployment() (gas: 26550)
GenerateTokensTest:testGenerateTokens() (gas: 109494) GenerateTokensTest:testGenerateTokens() (gas: 109390)
GenerateTokensTest:testGenerateTokensSupplyOverflow() (gas: 3126) GenerateTokensTest:testGenerateTokensSupplyOverflow() (gas: 3126)
GenerateTokensTest:test_RevertWhen_SenderIsNotController() (gas: 14951) GenerateTokensTest:test_RevertWhen_SenderIsNotController() (gas: 14951)
MiniMeTokenTest:testDeployment() (gas: 26535) MiniMeTokenTest:testDeployment() (gas: 26535)
ReceiveTest:testAcceptingEther() (gas: 18628) ReceiveTest:testAcceptingEther() (gas: 18628)
ReceiveTest:testDeployment() (gas: 26595) ReceiveTest:testDeployment() (gas: 26595)
ReceiveTest:testRejectingEther() (gas: 18691) ReceiveTest:testRejectingEther() (gas: 18691)
ReentrancyTest:testAttack() (gas: 227991) ReentrancyTest:testAttack() (gas: 227887)
TestPermit:testDeployment() (gas: 26573) TestPermit:testDeployment() (gas: 26573)
TestPermit:testInvalidAllowance() (gas: 84299) TestPermit:testInvalidAllowance() (gas: 84299)
TestPermit:testInvalidBalance() (gas: 67380) TestPermit:testInvalidBalance() (gas: 67380)
@ -35,10 +35,10 @@ TestPermit:testRevertExpiredPermit() (gas: 27867)
TestPermit:testRevertInvalidNonce() (gas: 57221) TestPermit:testRevertInvalidNonce() (gas: 57221)
TestPermit:testRevertInvalidSigner() (gas: 56059) TestPermit:testRevertInvalidSigner() (gas: 56059)
TestPermit:testRevertSignatureReplay() (gas: 96568) TestPermit:testRevertSignatureReplay() (gas: 96568)
TestPermit:testTransferFromLimitedPermit() (gas: 214891) TestPermit:testTransferFromLimitedPermit() (gas: 214787)
TestPermit:testTransferFromMaxPermit() (gas: 234830) TestPermit:testTransferFromMaxPermit() (gas: 234726)
TestSnapshotReads:testDeployment() (gas: 26550) TestSnapshotReads:testDeployment() (gas: 26550)
TestSnapshotReads:testSnapshotReads() (gas: 741048) TestSnapshotReads:testSnapshotReads() (gas: 739696)
TransferTest:testDeployment() (gas: 26617) TransferTest:testDeployment() (gas: 26617)
TransferTest:testDoubleTransfer() (gas: 90809) TransferTest:testDoubleTransfer() (gas: 90809)
TransferTest:testDoubleTransfer2() (gas: 68894) TransferTest:testDoubleTransfer2() (gas: 68894)

View File

@ -370,7 +370,6 @@ abstract contract MiniMeBase is Controlled, IERC20, IERC20Permit, EIP712, Nonces
uint256 curTotalSupply = totalSupply(); uint256 curTotalSupply = totalSupply();
if (uint128(curTotalSupply + _amount) < curTotalSupply) revert Overflow(); // Check for overflow if (uint128(curTotalSupply + _amount) < curTotalSupply) revert Overflow(); // Check for overflow
uint256 previousBalanceTo = balanceOf(_owner); uint256 previousBalanceTo = balanceOf(_owner);
if (uint128(previousBalanceTo + _amount) < previousBalanceTo) revert Overflow(); // Check for overflow
updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount); updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
updateValueAtNow(balances[_owner], previousBalanceTo + _amount); updateValueAtNow(balances[_owner], previousBalanceTo + _amount);
emit Transfer(address(0), _owner, _amount); emit Transfer(address(0), _owner, _amount);