Closed code423n4 closed 2 years ago
The auditor suggest to use safeApprove
to avoid calling allowance
, but if you don't call allowance
we won't be able to check if the allowance is already at UINT256 maximum or not.
safeApprove
we still have to call allowance
to check if the factory already has the allowance before calling safeIncreaseAllowance
.safeApprove
is deprecated
1. While setting the allowance to
0
, using_token.safeApprove()
makes less external call to save gassafeDecreaseAllowance()
is used to set zero allowance. Using_token.safeApprove(_spender, 0)
will require less external calls which will save gas._token.safeApprove(_spender, 0)
,token.allowance(address(this), spender)
will not be called.Snippets from
ExchangeHelpers
librarySnippets from Openzeppelin's
SafeERC20
library: