Uniswap is familiar to almost everyone who has been a little interested in the crypto industry. But, for those who have not heard about it, we shall explain. Uniswap was founded by Hayden Adams in 2018. The company's main product, the Uniswap protocol, is a decentralized protocol for swapping various tokens. The Uniswap protocol is integrated into more than 300 different dApps, including such industry giants as Coinmarketcap, Metamask, Coinbase Wallet, MakerDAO, OpenSea and others.
Recently, Uniswap Labs has introduced two new smart contracts: Permit2 and Universal Router. What are these new smart contracts for? This was briefly written in the Uniswap blog:
“Permit2 allows token approvals to be shared and managed across different applications creating a more unified, cost-efficient, and safer UX. <…> Universal Router unifies ERC20 and NFT swapping into a single swap router. Integrated with Permit2, users can swap multiple tokens and NFTs in one swap while saving on gas fees.”
Let's take a closer look at two new smart contracts. Permit2 is a token approval smart contract. It allows you to manage different token approvals between different smart contracts.
One of the main (or, as Uniswap writes, “canonical") token approve methods is the method described in *"EIP-20: Token Standard"* in the distant 2015 by Vitalik Buterin and Fabian Vogelsteller. According to Uniswap, this method suffers from the fact that users are forced to send an approval transaction for each new application. Of course, both time and gas are spent on this. The second disadvantage is the inadequate security of the method, since the user is asked for permission to access the entire balance of tokens in their wallet for an indefinite amount of time.
Permit2 is something like an add-on over the classic EIP-20. Its advantages are as follows:
- One permit is used for any token.
- Approvals may be allowed to expire.
- Support of one-time signatures for transfers.
- Combining transactions or approvals into batches.
- Revocation of permissions can also be done in batches.
“Permit2 is a non-upgradable, unowned, and open-source contract that has been deployed to the same address across Ethereum, Optimism, Arbitrum, Polygon, and Celo. <…> As part of our robust smart contract development standards, we’ve also launched a bug bounty program for the Permit2 contracts. Currently, Permit2 only supports ERC20 tokens. Uniswap Labs will be releasing a version for NFTs in the near future.”
Let's move on to Universal Router. This contract from Uniswap includes Permit2. The contract is a swap router that allows you to safely trade tokens and NFTs. The main feature of Universal Router is the gas optimization system.
Uniswap begins the presentation of Uniswap Router with the disadvantages of previous systems of this type used. Existing swap routers usually support only NFT or ERC20 tokens, and for transactions involving both, several transactions are needed. In addition, users must approve each token when using the protocol for the first time, which increases the cost of updating the protocol.
But, Universal Router changes the rules of the game. “With the Universal Router, users can execute multiple token swaps on Uniswap V2 & V3, and buy NFTs from multiple marketplaces all in one transaction.”
Universal Router also “is a non-upgradable, unowned, and open-source contract that has been deployed across Ethereum, Optimism, Arbitrum, Polygon, and Celo.” Bug bounty program for Universal Router is also running.
The appearance of technologies such as Permit2 and Universal Router is great news for the crypto industry. If everything works as Uniswap describes in their blog, it will be easier, faster, safer and more profitable for users to swap different tokens. We congratulate the developers of Uniswap Labs with the release of new contracts and continue to observe.