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

  • US Spot Ethereum ETF Sees Net Inflow of $14.98 Million Yesterday

    On October 22, according to monitoring by Trader T, the US spot Ethereum ETF recorded a net inflow of $14.98 million yesterday.

  • Sonic to Transfer 13 Million S Tokens via Strategic OTC Agreement in Next 24 to 48 Hours

    On October 22, Sonic announced on the X platform that approximately 13 million S tokens will be transferred in the next 24 to 48 hours under a strategic over-the-counter (OTC) agreement. The counterparty is a long-term partner of Sonic, and both parties will collaborate to expand Sonic's reach and enhance user engagement through the partner's network.

  • Bank of Korea Maintains Interest Rate as Expected

    On October 22, the Bank of Korea kept the policy interest rate unchanged at 3%, in line with market expectations. Previously, South Korea raised interest rates in consecutive meetings in July and August.

  • U.S. Treasury Secretary Becerra: GENIUS Act Establishes Federal Regulatory Framework for Stablecoin Payments

    U.S. Treasury Secretary Scott Becerra stated that the GENIUS Act is a milestone in the American financial sector, further solidifying the U.S. position as a global cryptocurrency hub. He compared the bill to the National Currency Act signed by President Lincoln in 1863, asserting that it establishes a federal regulatory framework for stablecoin payments in the digital age. Becerra also mentioned that the final rules issued by the Office of the Comptroller of the Currency (OCC) will facilitate the implementation of the bill, providing a clear and pragmatic institutional foundation for private sector innovation, market competition, and maintaining U.S. leadership in the digital asset space.

  • Kalshi to Support Crypto Asset-Backed Loans for Perpetual Futures Margin

    Prediction market platform Kalshi has reached a new arrangement with crypto asset custodian BitGo, allowing certain clients to use their custodial crypto assets as collateral for loans, which will be used for margin in leveraged perpetual futures trading on the Kalshi exchange. This arrangement is aimed at clients of Kalshi Prime, a futures commission merchant registered in the U.S. It employs a tri-party collateral management structure. Loans will be provided by its affiliated lending company, Kalshi Katalyst, with collateral assets held at BitGo Bank & Trust. Eligible collateral assets include Bitcoin, Ethereum, and stablecoins deemed compliant with the GENIUS Act, with plans to integrate additional custodians in the future.

  • Serious Security Vulnerability Discovered in PHP, Leading to Mass Shutdown of Government Websites in Europe

    On October 21, due to the discovery of serious security vulnerabilities in the widely used PHP programming language, multiple government websites across Europe and other regions were forced offline on Wednesday, prompting website operators to take urgent measures to protect system security. The PHP development team announced on Tuesday that two severe security flaws had been identified and urged users to update immediately after the release of the fix. On Wednesday, the PHP team confirmed that a new version addressing the vulnerabilities had been officially released. However, reports indicated that hackers were exploiting these vulnerabilities to breach websites, leading government agencies in countries such as the Netherlands and Finland to proactively shut down some sites before the patch was made available. PHP is one of the most widely used programming languages on the internet, supporting website platforms such as WordPress, Drupal, Joomla, and Magento. According to website technology statistics agency W3Techs, approximately 75% of websites that can identify their programming language use PHP. About 43% of websites globally are powered by WordPress, covering blogs, small business sites, government portals, e-commerce platforms, and news websites. This security incident has resulted in widespread disruptions to websites across multiple European countries, including the Port of Rotterdam, the government portal Overheid.nl, the Royal Netherlands Football Association, the websites of the country's five major political parties, and several hospital websites, all of which have been temporarily shut down.

  • US Stock Indices Open Slightly Higher; SpaceX Soars 8% After Earnings

    The three major US stock indices opened slightly higher, with the Dow Jones Industrial Average up 0.20%, the S&P 500 up 0.29%, and the Nasdaq Composite up 0.71%. SpaceX opened 8% higher, reporting third-quarter revenue of $14.6 billion, a year-on-year increase of 161%. Elon Musk stated that the annual recurring revenue (ARR) is expected to reach between $500 billion and $1 trillion by the end of 2027. Among other popular stocks, Nvidia rose 2.15%, Apple increased 0.09%, Google (Class A) fell 1.28%, Microsoft decreased 0.56%, Amazon was up 0.01%, TSMC rose 1.95%, SpaceX climbed 7.8%, Meta increased 0.24%, Broadcom rose 0.8%, Tesla was up 2.98%, SK Hynix increased 4.11%, Micron Technology rose 3.31%, AMD was up 2.25%, ASML increased 2.83%, Intel rose 2.01%, Cisco increased 0.67%, Oracle was up 1.55%, Dell Technologies (Class C) rose 7.81%, and ARM increased 2.78%.

  • ZEC Surpasses $1300

    Market data shows that ZEC has surpassed $1300, currently priced at $1315.68, with a 24-hour increase of 14.89%. Due to significant market fluctuations, please ensure proper risk management.

  • OpenAI to Launch on Google Cloud: Cutting-Edge Models like GPT-6 Astra and Codex Code Intelligence Available on Google Cloud

    On October 21, the two companies announced that in the coming weeks, OpenAI will offer its cutting-edge AI models and Codex code intelligence services through Google Cloud. This move deepens the collaboration between these two competitors and highlights how major cloud service providers are becoming important distribution channels for top AI models. According to a corporate blog announcement, this partnership will integrate OpenAI's latest models, including GPT-6 Astra, into Google Cloud's Model Garden. Customers will be able to purchase these models on the Google Cloud Marketplace and settle using their existing cloud service procurement credits. OpenAI aims to promote its models to a broader range of enterprise customers.

  • Zelensky: Willing to Reach Peace Agreement While Retaining Control of At Least 75% of Territory

    On October 21, Ukrainian President Zelensky stated in an interview that Ukraine could reach a peace agreement while retaining control of at least 75% of its territory. When asked by the host whether he would be willing to accept a peace agreement that would freeze the situation as it is, with Ukraine still holding 75% or more of its land, Zelensky responded affirmatively, stating, "Now we must freeze (the front lines), this is a practical way to end this war." (CCTV News)