Use SignatureChecker inside Permit to allow smart contract wallets to use it
I see current implementation of EIP-2612 (aka Permit) is not supporting smart contract wallets and they are required to invent own signature-based operations to execute token approve by smart contract wallet owner signature (pseudocode example: https://ethereum.stackexchange.com/a/142814/3032). Trying to fix it without violating EIP-2612 specification.
First (EIP-2612) defines signature as following:
r,sandvis a validsecp256k1signature fromowner
But if owner is smart contract wallet, can we consider signature to be valid secp256k1 signature but of wallet owner() of ERC20 owner?
I think it's possible and doesn't violate EIP that much. Let's discuss.
Hello @k06a
This was already discussed (can't find the issue though :/) and we decided against doing it for the following reasons:
- smart wallets are likely to support meta transaction (and batch transactions), therefore the approve-transferFrom is not as bad for them as it is for EOA
- some smart wallets want to limit daily/monthly transfers (that was raised by argent). If the transfers are done by the smart wallet, directly calling the
ERC20.transferfunction, then its possible to enforce that onchain. However, if the transfers are the consequence of an permit, then the quota can no longer be enforced.
The issue is https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2845.
The main reason is that EIP-2612 specifically says v,r,s a sepck256k1 signature by the owner.
But if
owneris smart contract wallet, can we consider signature to be validsecp256k1signature but of walletowner()of ERC20owner?I think it's possible and doesn't violate EIP that much. Let's discuss.
I see this comment now. It's true that it doesn't violate the EIP that much... EIP-1271 goes beyond these signatures though. For example, Gnosis Safe's implementation wouldn't work with this. What wallets would be enabled by this change? There is Argent as mentioned in https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2845. Are there others?
@frangio I think smart contract wallets will be able to let receiver claim their tokens without performing transaction. In case of permit to other wallet (EOA or SC).
BTW Uniswap’s permit2 supports EIP1271: https://github.com/Uniswap/permit2/blob/ca6b6ff2b47afc2942f3c67b0d929ca4f0b32631/src/libraries/SignatureVerification.sol#L43
Interresting: they also support both 65 and 64 bytes signatures
Interresting: they also support both 65 and 64 bytes signatures
I think they support any length and effectively support Gnosis Safes