Cointime

Download App
iOS & Android

Uniswap Labs Has Released Two New Smart Contracts

Today, Uniswap Labs has released two new smart contracts:

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.

We originally conceived Permit2 and Universal Router to improve our own products, optimizing gas costs, simplifying user transaction flows, and strengthening security. As we ideated, we realized that other applications could greatly benefit from integrating these contracts. Uniswap is committed to building public infrastructure that pushes crypto forward, which is why we designed these contracts to be used by the entire developer ecosystem, including extensive documentation, SDKs, and a two-week bug bounty.

Permit2 - Efficient, consistent, and secure approvals

Permit2 is a token approval contract that can safely share and manage token approvals across different smart contracts. As more projects integrate with Permit2, we can standardize token approvals across all applications. In turn, Permit2 will improve the user experience by reducing transaction costs while improving smart contract security.

Originally defined in EIP-20, the canonical token approve method suffered from a couple of weaknesses:

Users had to send an approval transaction for each new application they wanted to use. This led to a confusing UX where users might be asked to send multiple transactions before using an application, wasting gas and time.

For convenience's sake, applications asked users to approve the maximum allowance, giving applications access to a wallet’s entire token balance for an indefinite amount of time. Though Uniswap has never suffered from an exploit, infinite approvals can be hacked to steal user tokens. (PSA to revoke active allowances.)

EIP-2612 iterated on token approvals. Users could interact with application contracts without requiring prior approval by appending a signed permit message to their transaction. While EIP-2612 made token approves safer with granular allowance approvals, tokens launched before EIP-2612 did not support the permit function and not all newer tokens have adopted it.

How Permit2 improves UX

Permit2 further iterates on the token approval mechanism by introducing signature-based approvals and transfers for any ERC20 token, regardless of EIP-2612 support. Permit2 also comes with a host of exciting features that unlock more secure token approval options and enable a more consistent user experience across any integrating application. The full list of features can be found in our docs, but notably:

Permits for any token. Applications can have a single transaction flow by sending a signature along with the transaction data for any token, including those not supporting a native permit method.

Expiring approvals. Approvals can be time-bound, removing security concerns around hanging approvals on a wallet’s entire token balance. Revoking approvals do not necessarily have to be a new transaction.

Signature-based transfers. Users can bypass setting allowances entirely by releasing tokens to a permissioned spender through a one-time signature.

Batch approvals and transfers. Users can set approvals on multiple tokens or execute multiple transfers with one transaction.

Batch revoking allowances. Remove allowances on any number of tokens and spenders in one transaction.

Integrate Permit2

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. To start integrating, see the developer docs and SDK.

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.

Universal Router - Unified token and NFT swaps

We’ve integrated Permit2 into another exciting contract we’re releasing. The Universal Router is Uniswap’s next-generation router that unifies token and NFT trades into a highly flexible, gas-optimized, secure, and extensible swap router. The Universal Router significantly improves product and user experience, which is why it will become the default swap router for all Uniswap swaps in the near future.

Swap routers take in defined parameters (e.g. swap route, maximum slippage, and swap recipient) and execute swaps against your desired venues (e.g. Uniswap pools, NFT marketplaces). Swap routers are optimized to find the lowest prices and execute them at the lowest gas cost.

However, current swap routers suffer from two inefficiencies:

Existing swap routers typically only support either NFTs or ERC20 tokens. Trades that involve both currently require multiple transactions. For example, buying an NFT with an ERC20 token would require two separate transactions. First, a swap from DAI to ETH, and then the final swap from ETH to NFT.

Because swap routers are responsible for transferring user tokens, users must approve every token on first use, making them costly to upgrade. This is especially problematic for aggregator swap routers as contracts must be redeployed each time a new protocol is supported.

How Universal Router unifies swaps

With the Universal Router, users can execute multiple token swaps on Uniswap V2 & V3, and buy NFTs from multiple marketplaces all in one transaction. For example, envision a swap that

Uses three different input tokens

Swaps on Uniswap V2 and V3 using a split route

Performs an ETH to WETH wrap

Buys an NFT on OpenSea

This entire flow can be executed as a single transaction.

The Universal Router is integrated with Permit2, meaning that users approve with Permit2 and pass their signature through to the Universal Router, abstracting the token approval flow from the router contracts. Developers can deploy new versions of the Universal Router without requiring users to send a separate approval transaction each time. This allows the Universal Router - or any integrated contract - to remain immutable, while also allowing new features to be added in the future.

Integrate Universal Router

The Universal Router is a non-upgradable, unowned, and open-source contract that has been deployed across Ethereum, Optimism, Arbitrum, Polygon, and Celo. To start integrating, see the SDK.

Similarly to Permit2, we are running a bug bounty program to keep Uniswap contracts to the highest security standards.

Comments

All Comments

Recommended for you

  • Insider: Trump team supports Kevin Warsh as US Treasury Secretary

     informed sources said that the Trump team supports Kevin Warsh as the US Treasury Secretary, and discussions are still ongoing.

  • Lido is preparing a blockchain identity verification platform codenamed "Y" to compete with World Network

    According to insiders, Cyber Fund, led by Lido co-founders Konstantin Lomashuk and Vasiliy Shapovalov, is preparing a blockchain identity verification platform codenamed "Y" to directly compete with Sam Altman's World Network. Unlike World Network, which uses iris scanning for identity verification, the Y project will use users' social media and blockchain activity data, combined with Ethereum Attestation Service, to verify their identity. The solution aims to address the risk of biometric data leakage and minimize the potential for fraud.

  • Tether announces upcoming investment in stablecoin company Quantoz Payments

    On November 18th, Tether announced that it will invest in Quantoz Payments to launch EURQ and USDQ electronic currency tokens (EMT) that comply with the MiCAR standard for the euro and the US dollar respectively. Tether has not disclosed the amount of its investment, and Quantoz will use Tether's Hadron asset tokenization platform.

  • U.S. 30-year Treasury yield rises to 4.68%

    30-year US Treasury bond yield rose to 4.68%, the highest level since May 31.

  • NANO LABS announces Bitcoin as its strategic reserve asset

    Nano Labs announced that it will use Bitcoin as its strategic reserve asset.

  • Revolut Launches Staking Feature for Six Cryptocurrencies, Allowing Users to Earn Rewards

    Revolut, a prominent digital bank, has introduced a staking feature that enables users to temporarily lock funds to secure a cryptocurrency's network and earn rewards. The staking process is simple and easy to use, and currently supports six cryptocurrencies: Ethereum, Solana, Polkadot, Cardano, Tezos, and Polygon. The rewards for staking vary depending on the amount of crypto staked and the chosen cryptocurrency, with APYs ranging from 2.09% to 12.30%. However, some cryptocurrencies have lock-up periods before users can access their balances. Revolut users can stake Ethereum and receive their rewards daily after a waiting period of approximately 2 days, but must wait 10 days to access their balance once unstaked. Staking Solana on Revolut offers an APY of 5.25%, with rewards paid every 3 days after an initial waiting period of 3 days. Staking Polygon on Revolut offers an APY of up to 3.74%, with rewards paid daily after a 1-day warm-up period. Revolut staking is available in select countries within the EEA, with fees ranging from 15% to 35% depending on the token and the amount staked.

  • Ethereum Struggles with Institutional Adoption, Losing Ground to Bitcoin

    Ethereum's eight-year support trend against Bitcoin has been broken, causing concern for its future. Tuur Demeester, founder of Adamant Capital, has described Ethereum as "dying a slow death" due to this development. The slow adoption by institutions is being blamed for Ethereum's setback, while Bitcoin continues to dominate. This could have implications for Ethereum's position as an asset class. Despite this, Bitcoin's price remains stable, while altcoins show mixed performance. The disparity between Bitcoin and Ethereum's adoption among institutional investors is due to Bitcoin's simpler use case and fixed supply, as well as its higher trading volumes in ETFs compared to Ethereum. Ethereum's scalability challenges and regulatory scrutiny, particularly regarding its transition to a proof-of-stake model, are also contributing factors. Institutional endorsement of Bitcoin ETFs has outpaced that of Ethereum, with major asset managers like Fidelity and Morgan Stanley adding Bitcoin ETFs to their offerings. Experts suggest that Ethereum needs to address scalability issues and redefine its role as a technology-driven platform to regain its competitive edge. Until then, institutional investment appears to favor Bitcoin.

  • Morgan Stanley expects US interest rate cuts of 75 basis points in the first half of 2025

    Morgan Stanley predicts that by mid-2025, the yield on 10-year US Treasury bonds will fall to 3.75%, and by the end of next year it will fall to slightly above 3.50%. It is expected that the US will cut interest rates by 75 basis points in the first half of 2025.

  • Vitalik: Hope to see more EVM Rollups to improve data efficiency

    Vitalik Buterin, co-founder of Ethereum, wrote on the X platform that part of the L2 expansion is for Ethereum to increase its blob capacity, and the other part is for Rollups to become more data-efficient. It is great to see Starknet rise to the challenge and hope to see more EVM Rollups improve data efficiency. Earlier, Starknet announced the release of the solution Starknet v0.13.3, which aims to meet the stable growth of Ethereum blob processing needs.

  • Musk: I still hold a lot of Dogecoin, and SpaceX holds a lot of Bitcoin

    On November 18th, Dogecoin UI designer DogeDesigner shared an audio clip of Musk saying "I still hold a lot of Dogecoin, and SpaceX holds a lot of Bitcoin."