Why swapping token to token uses both ERC-20 approve() and EIP-2612 permit()?

Cryptocurrency News and Public Mining Pools

Why swapping token to token uses both ERC-20 approve() and EIP-2612 permit()?

Why swapping token to token uses both ERC-20 approve() and EIP-2612 permit()?

https://preview.redd.it/sj78j9ut26ve1.png?width=601&format=png&auto=webp&s=ef8dfd77030c36f67507d96ea5b1d485f21eca80

I'm learning smart contracts. As my knowledge, there are two ways to delegate token to others:

1) use an ERC-20 approve(), sign and broadcast the transaction

2) use an EIP-712 offline signature, give the signature to others, when they want to spend my token, they may use permit() and broadcast my signature

But when I tried to use uniswap or pancake to swap some token to another token, I found I have to sign for three times:

1) sign an approve() and broadcast it (for example, as https://basescan.org/tx/0x92deddfa4655d4699f61bfb2140331988b9a283dff54e4ffda984f916460d1d1)

2) sign an permit offlinely

3) sign an swap transaction (for example, https://basescan.org/tx/0x8c66fe05c339ae53a6b3fd26705f76773ae1fc4a965a24949659bcd033fcdf91) and this transaction seems to be used my signature in step 2

My questions are:

1) Why I need to sign a permit after I had already used approve() to give access to my token?

2) Why the swap transaction is broadcasted by my address, rather than the swap contract address?

Thank you for reading my questions!

submitted by /u/Coconut_Usual
[link] [comments]