4 months ago 4 min read

Two New Smart Contracts Have Been Released by Uniswap Labs: Permit2 and Universal Router

Table of Contents

Permit2 and Universal Router were initially developed by Uniswap Labs to enhance their own products by reducing gas costs, streamlining user transaction processes, and boosting security. As the business developed its ideas, it became clear that integrating these contracts into other applications would be extremely advantageous. The aforementioned contracts were created by Uniswap with the goal of creating open infrastructure that advances the crypto industry. This includes thorough documentation, SDKs, and a two-week bug bounty.

Quick, Reliable, and Secure Approvals Allowable Through Permit2

The token approval contract Permit2 enables secure token approval management and sharing between many smart contracts. As more projects join with Permit2, it would be possible to standardize token approvals across all apps. Permit2 will enhance the user experience by lowering transaction costs while enhancing the security of smart contracts.

When it was first introduced in EIP-20, the canonical token approve method had a few drawbacks:

🔴 In order to use a new application, users required to send an approval transaction. As a result, users may be required to send many transactions before utilizing an application, wasting time and gas. This has led to a confused user experience (UX).

🔴 Applications requested the maximum permission from users out of convenience, granting them access to a wallet's full token balance for an infinite period of time. Uniswap has never experienced a vulnerability, however limitless approvals can be broken into to obtain user tokens. (PSA to terminate active permissions.)

In EIP-2612, token approvals were iterated. By attaching a signed permit message to their transaction, users might interact with application contracts without needing prior clearance. While EIP-2612 made token approvals safer with granular allowance approvals, not all more recent tokens have embraced it, and tokens released before EIP-2612 did not support the permit function.

What Permit2 Does to Enhance UX

By enabling signature-based approvals and transfers for any ERC20 token, regardless of EIP-2612 support, Permit2 improves upon the token approval system. Along with providing more secure token clearance alternatives, Permit2 also offers a variety of new features that improve user experience across all integrating applications. The complete list of features is in the documents, but a few stand out:

🟢 Allowances for any token. By delivering a signature together with the transaction data for any token, including ones that do not offer a native permission mechanism, applications can have a single transaction flow.

🟢 Outdated approvals. By setting a time limit on approvals, security issues related to hanging approvals over the full token amount in a wallet are eliminated. It's not necessary for revoking approvals to be a new transaction.

🟢 Transfers based on signatures. By releasing tokens to a permitted spender through a one-time signature, users can completely avoid setting allowances.

🟢 Transfers and approvals in batches. Users have the option to approve numerous tokens simultaneously or to make several transfers in a single transaction.

🟢 Withdrawing allowances in batches. In a single transaction, remove allowances for any quantity of spenders and tokens.

Embedding Permit2

In Ethereum, Optimism, Arbitrum, Polygon, and Celo, the same address has been used to launch Permit2, an unowned, non-upgradable contract. Refer to the SDK to get started integrating.

A bug bounty program for the Permit2 contracts was also started as part of the company's strong smart contract development requirements.

At the moment, Permit2 only accepts ERC20 tokens. In the near future, Uniswap Labs will release a version for NFTs.

Integrated Token and NFT Exchanges Through Universal Router

Additionally, Permit2 is being incorporated into a new, innovative contract that will be published. Next-generation router from Uniswap that combines token and NFT exchanges into a highly adaptable, gas-optimized, secure, and extensible swap router is called the Universal Router. The Universal Router will soon replace all other swap routers as the standard swap router for all Uniswap swaps since it dramatically enhances both the product and user experience.

Swap routers conduct swaps against your selected venues based on given parameters (such as swap route, maximum slippage, and swap recipient) (e.g. Uniswap pools, NFT marketplaces). Swap routers are designed to locate the best deals and carry them out for the least amount of gas.

However, there are two inefficiencies with present swap routers:

🔴 Currently available swap routers typically only handle ERC20 or NFT coins. Both trades now call for several transactions. For instance, two distinct transactions would be necessary to purchase an NFT using an ERC20 token. The final exchange will be from ETH to NFT after the initial swap from DAI to ETH.

🔴 Users must approve each token before usage since switch routers handle the transfer of user tokens, making upgrades expensive. Since contracts need to be redeployed each time a new protocol is implemented, this is particularly difficult for aggregator swap routers.

How to Unify Swaps with Universal Router

Users can purchase NFTs from various marketplaces and execute numerous token swaps on Uniswap V2 and V3 simultaneously using the Universal Router. Imagine, for instance, a swap that:

🟢 Usage of three unique input tokens

🟢 Uniswap V2 and V3 switches using a split route

🟢 Carries out a WETH to ETH wrap

🟢 Purchases an NFT via OpenSea

One transaction can be used to carry out the complete flow.

As a result of the integration of the Universal Router with Permit2, users can approve using Permit2 and send their signature to the router contracts while still using the Universal Router. New iterations of the Universal Router can be released by developers without necessitating that users provide a different approval transaction each time. By doing so, it is possible to maintain the immutability of the Universal Router or any other integrated contract while also enabling the addition of additional features in the future.

Universal Router Integration

A non-upgradable, unowned, open-source contract called The Universal Router has been implemented on Ethereum, Optimism, Arbitrum, Polygon, and Celo. See the SDK to get started integrating.

Uniswap Labs is operating a bug bounty program, similar to Permit2, to maintain the highest security standards for Uniswap contracts.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Coin Aquarium.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.