Uniswap / interface

🦄 Open source interfaces for the Uniswap protocol
https://app.uniswap.org
GNU General Public License v3.0
4.9k stars 4.97k forks source link

Allow use token contract approve method instead of permit2 for aa wallet #7341

Open lbhsot opened 1 year ago

lbhsot commented 1 year ago

Bug Description https://github.com/Uniswap/interface/blob/91c20135227b13dc8d75b6be974fb261e9ab6cfd/src/pages/RemoveLiquidity/index.tsx#L121 in onAttemptToApprove method uniswap allow using token approve instead of permit2 when error occur. https://github.com/Uniswap/interface/blob/91c20135227b13dc8d75b6be974fb261e9ab6cfd/src/hooks/usePermit2Allowance.ts#L113 in isePermit2Allowance the only way to approve token is using permit2

Steps to Reproduce

Remove Liquidity Flow
  1. open wallet connect modal in uniswap, then connect in cobo argus
  2. remove lbr/eth in uniswap, uniswap will send eth_signTypedData_v4 to cobo argus
  3. cobo argus will response the request with '0x' as data
  4. uniswap will send a transaction with token approve
  5. now cobo argus can execute the transaction
Swap Flow
  1. open wallet connect modal in uniswap, then connect in cobo argus
  2. swap a erc20 token to another, uniswap will send eth_signTypedData_v4 to cobo argus
  3. cobo argus will response the request with '0x' as data
  4. uniswap shows error in console

Expected Behavior same behaviour between Swap Flow and Remove Liquidity Flow. and all usage of permit2 behave same

lbhsot commented 1 year ago

Another question:

https://github.com/Uniswap/interface/blob/91c20135227b13dc8d75b6be974fb261e9ab6cfd/src/hooks/usePermit2Allowance.ts#L152

If the token is approved, why still need use permit2 to approve token?

@LunrEclipse @cbachmeier @zzmp @JackShort anyone can help?