suberra / funnel-contracts

Funnels are smart contracts that enforces renewable allowance as a proxy
MIT License
9 stars 0 forks source link

Audit fixes 2 #51

Closed zlace0x closed 1 year ago

zlace0x commented 1 year ago

Audit fixes 2

zlace0x commented 1 year ago

Gas snapshot diff between fix/audits and fix/audit-2

Test result: ok. 18 passed; 0 failed; finished in 52.81ms
testFailPermitBadDeadline() (gas: 0 (0.000%)) 
testFailPermitPastDeadline() (gas: 0 (0.000%)) 
testFailPermitRenewablePastDeadline() (gas: 0 (0.000%)) 
testBalanceOfOnMint(uint256) (gas: 0 (0.000%)) 
testBalanceOfOnMintLargeAmount() (gas: 0 (0.000%)) 
testBalanceOfOnTransfer(uint256,uint256) (gas: 0 (0.000%)) 
testBalanceOfOnTransferLargeAmount() (gas: 0 (0.000%)) 
testBalanceOfReflectsSlot(uint256) (gas: 0 (0.000%)) 
testFailTransferExceedsBalance(uint256) (gas: 0 (0.000%)) 
testTotalSupply(uint256) (gas: 0 (0.000%)) 
testTransferFullBalance() (gas: 0 (0.000%)) 
testTransferFuzzing(uint256) (gas: 0 (0.000%)) 
testTransferHalfBalance() (gas: 0 (0.000%)) 
testTransferOneToken() (gas: 0 (0.000%)) 
testTransferZeroTokens() (gas: 0 (0.000%)) 
testGetFunnelForTokenRevertsIfNotDeployed() (gas: 0 (0.000%)) 
testIsFunnelFalseForNonFunnel() (gas: 0 (0.000%)) 
testIsFunnelFalseForUndeployedFunnel() (gas: 0 (0.000%)) 
testNoCodeTokenReverts() (gas: 0 (0.000%)) 
testSupportInterfaceReceiver() (gas: 0 (0.000%)) 
testSupportInterfaceSpender() (gas: 0 (0.000%)) 
testDeployFunnelForToken() (gas: 15 (0.009%)) 
testDeployFunnelForTokenRevertsIfAlreadyDeployed() (gas: 15 (0.009%)) 
testIsFunnelTrueForDeployedFunnel() (gas: 15 (0.010%)) 
testFailPermitRenewableReplay() (gas: -12 (-0.010%)) 
testDeployFunnelForDifferentTokens() (gas: 30 (0.010%)) 
testFailPermitReplay() (gas: -34 (-0.028%)) 
testFailPermitRenewableBadNonce() (gas: -22 (-0.045%)) 
testFailPermitBadNonce() (gas: -22 (-0.047%)) 
testApproveRenewableAndCall() (gas: -46 (-0.050%)) 
testApproveRenewableAndCallRevertNonReceiver() (gas: -46 (-0.054%)) 
testApproveRenewableAndCallRevertNonContract() (gas: -46 (-0.054%)) 
testExecuteMetaTransactionTransfer() (gas: -58 (-0.060%)) 
testFailExecuteMetaTransactionBadNonce() (gas: -36 (-0.076%)) 
testFallbackToBaseToken() (gas: -22 (-0.086%)) 
testTransfer() (gas: -55 (-0.089%)) 
testFailPermitRenewableBadDeadline() (gas: -44 (-0.090%)) 
testRecoveryRateExceeded() (gas: -22 (-0.163%)) 
testRecoveryRateExceeded2() (gas: -22 (-0.164%)) 
testBaseToken() (gas: -22 (-0.221%)) 
testOverriddenName() (gas: -58 (-0.279%)) 
testSupportsInterfacePayable() (gas: -22 (-0.377%)) 
testSupportInterface() (gas: -22 (-0.382%)) 
testIsFunnelFalseForDeployedFunnelFromDifferentFactory() (gas: 4024 (0.696%)) 
testDeployFunnelFromDifferentFactory() (gas: 4024 (0.702%)) 
testTransferFromFunnel() (gas: -2975 (-1.003%)) 
testTransferFromAndCall() (gas: -1581 (-1.139%)) 
testTransferFromAndCallRevertNonContract() (gas: -1560 (-1.374%)) 
testTransferFromAndCallRevertNonReceiver() (gas: -1559 (-1.393%)) 
testSupportsInterfaceProxy() (gas: 89 (1.544%)) 
testFailApprovewithTransferInsufficientBalance() (gas: -2969 (-2.739%)) 
testApproveMaxWithTransfer() (gas: -4413 (-3.182%)) 
testApproveWithTransferFuzzing(uint256,uint256) (gas: -5905 (-3.926%)) 
testApprove() (gas: -5927 (-4.095%)) 
testFailExecuteMetaTransactionReplayProtection() (gas: -7985 (-5.576%)) 
testInfiniteApproveTransferFrom() (gas: -7830 (-5.840%)) 
testExecuteMetaTransactionApproveRenewable() (gas: -8038 (-5.901%)) 
testPermitRenewable() (gas: -7980 (-6.101%)) 
testPermit() (gas: -8002 (-6.214%)) 
testRenewableAllowanceTransferFrom() (gas: -11904 (-7.664%)) 
testApproveRenewable() (gas: -7892 (-8.153%)) 
testClearRenewableAllowanceOnNormalApprove() (gas: -12197 (-8.359%)) 
testFailApproveWithTransferInsufficientApproval() (gas: -9445 (-9.400%)) 
testRenewableMaxAllowance() (gas: -9381 (-9.544%)) 
testApproveFuzzing(uint256) (gas: -12916 (-10.773%)) 
testInsufficientAllowance() (gas: -7987 (-27.174%)) 
testInitialAllowance() (gas: -7968 (-31.839%)) 
Overall gas change: -138813 (-160.682%)