remove approveAndCall impossible condition

This commit is contained in:
Ricardo Guilherme Schmidt 2023-09-26 12:46:06 -03:00
parent ff900fec1d
commit 178e7f0b7b
3 changed files with 5 additions and 6 deletions

View File

@ -1,12 +1,12 @@
| contracts/MiniMeToken.sol:MiniMeToken contract | | | | | | | contracts/MiniMeToken.sol:MiniMeToken contract | | | | | |
|------------------------------------------------|-----------------|-------|--------|-------|---------| |------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | | | Deployment Cost | Deployment Size | | | | |
| 2142502 | 12126 | | | | | | 2131887 | 12073 | | | | |
| 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 |
| approve | 0 | 15064 | 14767 | 31771 | 10 | | approve | 0 | 15064 | 14767 | 31771 | 10 |
| approveAndCall | 0 | 30979 | 0 | 92937 | 3 | | approveAndCall | 0 | 30975 | 0 | 92925 | 3 |
| balanceOf | 0 | 622 | 0 | 2753 | 67 | | balanceOf | 0 | 622 | 0 | 2753 | 67 |
| balanceOfAt | 0 | 830 | 0 | 3766 | 78 | | balanceOfAt | 0 | 830 | 0 | 3766 | 78 |
| changeController | 0 | 596 | 0 | 3580 | 6 | | changeController | 0 | 596 | 0 | 3580 | 6 |

View File

@ -1,7 +1,7 @@
AllowanceTest:testAllowance() (gas: 42775) AllowanceTest:testAllowance() (gas: 42775)
AllowanceTest:testAllowanceAlreadySet() (gas: 36905) AllowanceTest:testAllowanceAlreadySet() (gas: 36905)
AllowanceTest:testAllowanceReset() (gas: 46071) AllowanceTest:testAllowanceReset() (gas: 46071)
AllowanceTest:testApproveAndCall() (gas: 97856) AllowanceTest:testApproveAndCall() (gas: 97844)
AllowanceTest:testApproveTransferDisabled() (gas: 7994) AllowanceTest:testApproveTransferDisabled() (gas: 7994)
AllowanceTest:testDeployment() (gas: 26711) AllowanceTest:testDeployment() (gas: 26711)
AllowanceTest:testNoAllowance() (gas: 9462) AllowanceTest:testNoAllowance() (gas: 9462)
@ -11,7 +11,7 @@ ClaimTokensTest:testClaimETH() (gas: 13659)
ClaimTokensTest:testClaimSelf() (gas: 60361) ClaimTokensTest:testClaimSelf() (gas: 60361)
ClaimTokensTest:testDeployment() (gas: 26595) ClaimTokensTest:testDeployment() (gas: 26595)
CreateCloneTokenTest:testCloneFutureSnapshot() (gas: 101004) CreateCloneTokenTest:testCloneFutureSnapshot() (gas: 101004)
CreateCloneTokenTest:testCreateCloneToken() (gas: 2181617) CreateCloneTokenTest:testCreateCloneToken() (gas: 2170994)
CreateCloneTokenTest:testDeployment() (gas: 26550) CreateCloneTokenTest:testDeployment() (gas: 26550)
CreateCloneTokenTest:testGenerateTokens() (gas: 101358) CreateCloneTokenTest:testGenerateTokens() (gas: 101358)
DestroyTokensTest:testDeployment() (gas: 26595) DestroyTokensTest:testDeployment() (gas: 26595)

View File

@ -10,7 +10,6 @@ error InvalidDestination();
error ControllerRejected(); error ControllerRejected();
error Overflow(); error Overflow();
error AllowanceAlreadySet(); error AllowanceAlreadySet();
error OperationFailed();
error ControllerNotSet(); error ControllerNotSet();
error ERC2612ExpiredSignature(uint256 deadline); error ERC2612ExpiredSignature(uint256 deadline);
error ERC2612InvalidSigner(address signer, address owner); error ERC2612InvalidSigner(address signer, address owner);
@ -282,7 +281,7 @@ abstract contract MiniMeBase is Controlled, IERC20, IERC20Permit, EIP712, Nonces
/// @param _amount The amount of tokens to be approved for transfer /// @param _amount The amount of tokens to be approved for transfer
/// @return success True if the function call was successful /// @return success True if the function call was successful
function approveAndCall(address _spender, uint256 _amount, bytes memory _extraData) public returns (bool success) { function approveAndCall(address _spender, uint256 _amount, bytes memory _extraData) public returns (bool success) {
if (!approve(_spender, _amount)) revert OperationFailed(); approve(_spender, _amount);
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _amount, address(this), _extraData); ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _amount, address(this), _extraData);