Overview
Learn how Uniswap Permit2 combines signature-based transfers and time-bound allowances for token spending.
Permit2 is a unification of 2 contracts, SignatureTransfer and AllowanceTransfer. The SignatureTransfer contract handles all signature-based transfers, meaning that an allowance on the token is bypassed and permissions to the spender only last for the duration of the transaction that the one-time signature is spent. The AllowanceTransfer contract handles setting allowances on tokens, giving permissions to spenders on a specified amount for a specified duration of time. Any transfers that then happen through the AllowanceTransfer contract will only succeed if the proper permissions have been set.
Resources
An external explanation of Permit2 contract patterns and example usage.
Approving Permit2
Before integrating contracts can request users’ tokens through Permit2, users must approve the Permit2 contract through the specific token contract by calling something like:
USDC.approve(permit2Address, totalAmount);To maximize Permit2 utility, users can choose a max approval on the contract where:
totalAmount = type(uint256).max;Where to Go Next
- Learn allowance flows in Allowance Transfer
- Learn signature flows in Signature Transfer