-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
research(contracts): permit2 instead of vault relayer #9
Comments
Would this work in conjunction with or replace entirely the need for https://eips.ethereum.org/EIPS/eip-2612 ? |
This would essentially replace entirely EIP-2612. So the only approve we would have to ask from the user is if they haven't done approvals yet for Permit2 (similar to the GPv2VaultRelayer), but this also allows us to make use of approvals that have already been done for Uniswap. |
Is this the same as the permit we've already implemented? Would it work for all tokens? Would the user have to permit each token individually still? And would there be a way for the user to specify what amount they wanted to permit, and to rescind the permission? |
Then, we would - for approvals - depend solely on Permit2, and there would be no other way to do the approvals? |
It isn't quite the same as the permit that we've already implemented. This is a supplemental type that uses a similar pattern as our This is therefore more accurately seen like a "mechanism in which to allow Permit-like functionality for tokens that don't natively support it". UX wise, if the user didn't have approvals set for the |
|
Sounds good to me, then! |
Note that the current permit (ERC2612) can still be used if an account that hasn't yet set an allowance on Uniswap (or other users if Permit2) would come to CoW and wants to trade. |
Problem
CoW Protocol is heavily into signing messages and using these are authorisations on which to perform actions. A common pain point from the start though is that token allowances must be set - and it has been the function of the
GPv2VaultRelayer
to hold these allowances, and perform transfers from users.Acceptance criteria
ERC-1271
.GPv2VaultRelayer
).Details
Currently a new user (in the case of an EOA) placing an order with CoW Protocol requires:
ERC20Token.approve(vaultRelayer, type(uint256).max)
eth_sign
,eth_signTypedData_v4
(or,preSign
, i.e. a transaction doingGPv2Settlement.setPreSignature
)A new user (in the case of a smart contract) placing an order with CoW Protocol requires:
ERC20Token.approve(vaultRelayer, type(uint256).max)
)preSign
(i.e.GPv2Settlement.setPreSignature
, oreip1271
).Concretely, in the instance of a Safe, this can be done with a single transaction.
This has become somewhat of a "normal" UX across dapps, however we have the ability to smooth this further with
Permit2
, eliminating the need for the first approve in the case the user has already.approve()
forPermit2
.Possible Solutions
Permit2.permitTransferFrom
, which takes a signedPermitTransferFrom
EIP-712
signature. This has similar UX in that the user would have to sign both for the permit, and then separately for the swap order.Permit2.permitWitnessTransferFrom
, which allows for signing a permit to transfer, but also some other arbitraryEIP-712
type. In this case, the order struct type can be appended, allowing for a single signature to verify both the permit and the order. An additional feature here is that the permit can have a signed expiry date, which may also allow for a different type ofnullifier
to be used for the settlement contract.NOTE:
Permit2
also allows for batch transfers, which would allow for future development into basket trading.Research track
The text was updated successfully, but these errors were encountered: