Signing ERC-2612 Permits

EIP-2612 on Ethereum and how signing transactions functions on Reservoir Finance.

In early 2020, EIP-2612 (Ethereum Improvement Proposal) was proposed and changed the options of how interactions happen with smart contracts. DApps (decentralized applications like Reservoir Finance) use smart contracts to execute transactions, and you must give permission for the smart contract to transfer up to a certain amount of your token (called an allowance). In times past, the user would have to first sign a transaction and pay the gas fee for the smart contract to have the “allowance” to interact on the user’s behalf. This led to excessive gas waste, and a sometimes confusing interface, through which two transactions would have to be submitted just to have one swap/withdraw/deposit transaction process. Through the innovation of EIP-2612, there is now a standardized way for users to grant permission to smart contracts to spend their tokens and swap in a single transaction.

Reservoir Finance uses this method of approval to make your transactions more seamless, safe, and gas efficient.

How does permit signing work on Reservoir Finance?

Reservoir Finance’s smart contracts verify that the Permit signature is valid every time you permit and sign a transaction.

You will see this “Permit and Swap” button when the dApp is asking for your permissions. Once you click or tap the button, you’ll be prompted by your connected wallet to approve your permit. In this example, we’ll be using the popular wallet Metamask.

You will see the wallet requesting a signature confirming the details of the requested permit, which will be validated with the smart contract. These data points are:

  • owner: The address of the token owner who signed the message

  • spender: The address of the spender contract who can transfer tokens on behalf of the owner

  • value: The maximum amount of tokens that can be transferred by the spender

  • nonce: A unique number that prevents replay attacks

  • deadline: A timestamp after which the signature is invalid

All of these are followed up by your wallet signature. You’ll then return to Reservoir Finance where you will find the button has changed to:

For the safety of our users, the permit is approved for only thirty minutes, and the swap must be completed before then, or the permit will time out.

From here proceed to confirm your swap details. When you’re ready to complete the swap, click or tap on the “Swap” button. You will be returned to your wallet where you will see the following:

Here you will confirm your swap details and gas to be paid for the transaction. Notice though, only one transaction will be submitted. There’s no longer a need for an additional approval transaction, as the data is held within your swap transaction. No more convoluted transaction history, and the extra gas fee is retained. Click or tap on the confirm button, and your swap will be completed and the refunds transferred into your wallet.

Last updated