-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
When using the Zora SDK’s tradeCoin to swap from an ERC20 to another ERC20, only the first transaction works.
After that, all swaps revert.
The SDK is supposed to handle the approve / permit part for ERC20 swaps automatically, but something is wrong with how approvals and permits are consumed.
Observed behavior
-
On the first transaction:
- The SDK requires an approve infinite call
- The SDK requires to sign to swap and approve the specific spending limit I want for my swap (via permit)
- This transaction succeeds
-
On any following transactions:
- The wallet simulation does not detect any change in the provided permit signature
- The transaction reverts
(I've tested with multiple addresses and tokens)
Possible root cause
It seems that the infinite approval is being consumed by the contract, instead of using the amount specified in the permit signature.
As a result:
- The first permit signature is never consumed
- Any subsequent permit signatures cannot be validated, causing all following swaps to fail
Steps to reproduce
- Call
tradeCointo swap ERC20 → ERC20. - Approve the infinite allowance, sign the specific spending permit and swap (transaction succeeds)
- Try another swap (transaction fails/reverts)
Metadata
Metadata
Assignees
Labels
No labels