0

Trying to understand EIP712 and signatures. Modeling my knowledge on uniswap v2/v3 which is using Permit function in their routers for swapping.

So my question is the following, as some wallet is asking you to sign some message, for uniswap example to approve some token spending, where is this signature stored exactly, having a hard time understanding this as there is no regular transaction?

1 Answer 1

1

EIP-712 is a standard for users to sign structured data that smart contracts can verify. As long as you don't submit the signature to a contract via a transaction, it has no effect. See it as an authorization that costs nothing to produce but is ineffective until sent to a contract that knows how to use it.

Let's take permit as an example. Permit works like approve. The difference is that permit accepts and EIP-712 signature and changes the allowance only if the signature is considered valid. This means that you can sign a permit and anyone else that has your signature could send it to the contract and change your allowance. This is useful because it allows you to pack multiple actions into a single tx.

Without permit, to transfer tokens to a contract:

  • send an approve tx to authorize the contract transferring funds from your balance to its balance
  • call the contract that will inside its code call a transfer moving tokens from you to the contract

With permit:

  • sign a permit with the same parameters you would have used for an approve
  • call the contract with the signature in the parameters, the contract uses the signature to increase your allowance then transfer funds from you to the contract

So only 1 tx for permit while 2 needed for approve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.