Permit2 is Uniswap's universal token approval system that enables gasless approvals after a one-time setup. Instead of approving each protocol separately, you approve Permit2 once and then use off-chain signatures for all subsequent token transfers.
Why Use Permit2?
- Cost Savings - After the initial approval, no gas is required for future approvals
- Better Security - Permits are time-limited and can specify exact amounts
- Improved UX - Users sign a message instead of submitting a transaction
How It Works
- One-Time Setup - Approve your tokens to the Permit2 contract (can be max amount)
- Get Quote - Request a quote with
isPermit2: trueflag - Create Order - The SDK generates a Permit2 signature bundled with your order
- Submit - The relayer verifies the signature and executes the swap
Interactive Code Example
Explore the complete implementation — this example demonstrates swapping USDC to WETH using Permit2: