From 585c07572f8c0628912dc8ec7de474ad2f11656d Mon Sep 17 00:00:00 2001 From: Vectorized Date: Wed, 15 Jan 2025 13:36:55 +0000 Subject: [PATCH 1/2] Make Permit2 enabled by default, cuz devs are left-curved --- src/DN404.sol | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/DN404.sol b/src/DN404.sol index b1ed1ee..a7d8e06 100644 --- a/src/DN404.sol +++ b/src/DN404.sol @@ -124,7 +124,8 @@ abstract contract DN404 { /// @dev The canonical Permit2 address. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. - /// To enable, override `_givePermit2DefaultInfiniteAllowance()`. + /// Enabled by default. + /// To disable, override `_givePermit2DefaultInfiniteAllowance()`. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; @@ -450,13 +451,13 @@ abstract contract DN404 { /// @dev Whether Permit2 has infinite allowances by default for all owners. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. - /// To enable, override this function to return true. + /// To disable, override this function to return false. /// /// Note: The returned value SHOULD be kept constant. - /// If the returned value changes from false to true, + /// If the returned value changes from true to false, /// it can override the user customized allowances for Permit2 to infinity. function _givePermit2DefaultInfiniteAllowance() internal view virtual returns (bool) { - return false; + return true; } /// @dev Returns checks if `sender` is the canonical Permit2 address. From 043a69da167c0c596df047d739a5733c6fafbc94 Mon Sep 17 00:00:00 2001 From: Vectorized Date: Wed, 15 Jan 2025 13:40:17 +0000 Subject: [PATCH 2/2] T --- src/DN404.sol | 6 +++--- src/DN420.sol | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/DN404.sol b/src/DN404.sol index a7d8e06..cb3b355 100644 --- a/src/DN404.sol +++ b/src/DN404.sol @@ -124,7 +124,7 @@ abstract contract DN404 { /// @dev The canonical Permit2 address. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. - /// Enabled by default. + /// Enabled by default. In Permit2 we trust. /// To disable, override `_givePermit2DefaultInfiniteAllowance()`. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) @@ -453,8 +453,8 @@ abstract contract DN404 { /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. /// To disable, override this function to return false. /// - /// Note: The returned value SHOULD be kept constant. - /// If the returned value changes from true to false, + /// Note: The returned value SHOULD be kept constant after tokens have been minted. + /// If the returned value changes from false to true and vice-versa, /// it can override the user customized allowances for Permit2 to infinity. function _givePermit2DefaultInfiniteAllowance() internal view virtual returns (bool) { return true; diff --git a/src/DN420.sol b/src/DN420.sol index a8bd6d5..e88c5b7 100644 --- a/src/DN420.sol +++ b/src/DN420.sol @@ -172,7 +172,8 @@ abstract contract DN420 { /// @dev The canonical Permit2 address. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. - /// To enable, override `_givePermit2DefaultInfiniteAllowance()`. + /// Enabled by default. In Permit2 we trust. + /// To disable, override `_givePermit2DefaultInfiniteAllowance()`. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; @@ -435,9 +436,13 @@ abstract contract DN420 { /// @dev Whether Permit2 has infinite ERC20 allowances by default for all owners. /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. - /// To enable, override this function to return true. + /// To disable, override this function to return false. + /// + /// Note: The returned value SHOULD be kept constant after tokens have been minted. + /// If the returned value changes from false to true and vice-versa, + /// it can override the user customized allowances for Permit2 to infinity. function _givePermit2DefaultInfiniteAllowance() internal view virtual returns (bool) { - return false; + return true; } /// @dev Returns checks if `sender` is the canonical Permit2 address.