@@ -46,6 +46,11 @@ library SafeERC20 {
4646 /**
4747 * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
4848 * non-reverting calls are assumed to be successful.
49+ *
50+ * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
51+ * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
52+ * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
53+ * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
4954 */
5055 function safeIncreaseAllowance (IERC20 token , address spender , uint256 value ) internal {
5156 uint256 oldAllowance = token.allowance (address (this ), spender);
@@ -55,6 +60,11 @@ library SafeERC20 {
5560 /**
5661 * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
5762 * value, non-reverting calls are assumed to be successful.
63+ *
64+ * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
65+ * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
66+ * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
67+ * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
5868 */
5969 function safeDecreaseAllowance (IERC20 token , address spender , uint256 requestedDecrease ) internal {
6070 unchecked {
@@ -70,6 +80,10 @@ library SafeERC20 {
7080 * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
7181 * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
7282 * to be set to zero before setting it to a non-zero value, such as USDT.
83+ *
84+ * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
85+ * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
86+ * set here.
7387 */
7488 function forceApprove (IERC20 token , address spender , uint256 value ) internal {
7589 bytes memory approvalCall = abi.encodeCall (token.approve, (spender, value));
0 commit comments