Introducing 0x's next-gen pricing engine

0x v2 is the next generation trading engine for serious onchain apps, offering the most seamless swap experience at the best all-in prices with optimal trade execution, powerful new monetization controls, and enhanced security baked in at the ground level.

Published on
July 15, 2024
News
Introducing 0x's next-gen pricing engine

Four years ago, we launched 0x Protocol v4 and 0x Swap API v1 to make it easy for DeFi developers to tap into aggregated DEX liquidity in a fast, simple, and reliable way. Since launch, 0x has enabled 500+ teams to easily tap into 130+ exchanges across 9 chains, facilitating over $154 billion in volume across 60+ million trades.

As Web3 continues to evolve, the tools we rely on for critical services must evolve as well. Onchain liquidity has become increasingly fragmented with even more tokens, DEXs, and chains, adding complexity to the problem of routing value across Web3. 

At the same time, projects are evolving into more serious businesses, requiring swaps that fit into their business holistically, from security and reliability to monetization and compliance. With the needs of growing Web3 businesses in mind, it became clear that an evolution in DEX aggregation technology was required to provide the best possible swap product.

Today, we’re excited to announce our completely new, state-of-the-art pricing engine redesigned from the ground up.

0x v2 is the next-generation trading engine for serious onchain apps, offering the most seamless swap experience at the best all-in prices with optimal trade execution, powerful new monetization controls, and enhanced security baked in at the ground level.

Serious liquidity. Serious routing. Serious security. Welcome to 0x v2.

  • Advanced routing at the best all-in prices: v2 outperforms the competition at every trade size.
  • Secure by design: Eliminate allowance exposure with Permit2.
  • Built for serious businesses: Control your balance sheet with powerful new monetization features.
  • Deep coverage: Access 6M+ tokens with unrivaled liquidity from 120+ AMMs, alongside an all-new RFQ system (in beta).
  • Plus: Lightning fast liquidity integration, full fee-on-transfer token support, improved error handling, and much more.

Advanced routing for every trade size, at the best all-in prices

Are you offering the best price to your users, all-in?

We all know the frustration of getting to the checkout page of a vacation rental or ticketing platform only to find that you’re paying much more than the advertised price after factoring in every fee under the sun. When expectations don’t meet reality, users are left feeling shortchanged. The hidden costs of DEX trading can lead to drastic differences in the quoted price you’re showing users and the actual value they receive - not the experience you want to create in your app.

Providing the best price in DeFi across every token pair, trade size, and chain is a multi-dimensional problem that requires a holistic understanding of tokens and their liquidity.

0x v2 was built to optimize for execution quality - identifying the route expected to yield the best all-in price (the actual onchain settled price with gas costs factored in), across all pairs and trade sizes at lightning fast speed and with the lowest revert rate in the industry.

How does it work? 0x Argon Router’s state-of-the-art algorithm delivers the optimal execution path and best price by optimizing on two dimensions:

1. Multiplex: Splitting a trade across multiple liquidity sources.

2. Multihop: Identifying intermediate token steps which open up deeper liquidity.

The direct route isn’t always the best route. For token pairs with limited liquidity, like long tail pairs, price impact can be particularly high. But even pairs with significant volume can suffer from thin liquidity between the buy and sell token. In these cases, the ability to hop across multiple intermediate tokens, going from Token A to B to C to D, enables optimal use of on-chain liquidity. 

Alongside state-of-the-art routing, 0x v2 also features a revamped RFQ (request for quote) system, unlocking exclusive CEX-like liquidity from sophisticated market makers and opening up additional, slippage-free avenues for trade route optimization.

Thanks to Argon, v2 outperforms the competition at every trade size.

Advanced gas awareness also ensures real-world gas costs are factored into the quoted price. Inaccurate gas estimation can impact the final all-in price or lead to the trade failing - both of which can lead to user churn.

v2’s gas estimation is 1.5x more accurate than v1, thanks to advanced simulation techniques that bypass limitations with standard tooling, resulting in better all-in prices and the lowest revert rate in the industry.

Secure by design: Eliminate allowance exposure

In order to use Web3 apps, users have to grant them permission to interact with tokens in their wallet. Usually these approvals are unlimited to complicated and upgradeable smart contracts, leaving user funds at risk. Outstanding allowances on upgradable smart contracts expose $6.5B for the top 20 tokens, according to smart contract security firm Dedaub.

It’s time-consuming and expensive to manage token allowances today, requiring users to constantly audit and revoke approvals or risk losing their tokens. Over $405 million has been stolen in approval exploits since 2020, according to revoke.cash.

Enter 0x Settler, v2’s all-new set of smart contracts that takes security to the next level. Settler fully eliminates allowance risk and bakes in protection at the ground level by leveraging Permit2.

We believe Permit2 is critical for secure swap applications, but not just any usage of Permit2. Time-bound infinite approvals, while better than the infinite approvals that never expire, still expose users to risk. That’s just not good enough.

If you are building in crypto, you know how scary hacks can be. A security vulnerability can strike at any time and affect even the best of teams. Bugs will slip by the watchful review of even the best auditors. Thus, the best way to keep user funds safe is to fundamentally reduce the amount at risk and avoid the infinite approval pattern altogether.

0x Settler does exactly that - single-use amount-based signatures, called coupons, eliminate allowance risk and protect your users from exploits. Why take the risk?

And when we say we’re serious about security, we really mean it. 0x v2’s new smart contracts are fully audited, with four audits from three separate firms, including Ourovoros, Trail of Bits, OpenZeppelin, and Trail of Bits a second time. 0x also leverages Dedaub’s industry-leading security suite to continuously analyze our contracts as we develop them.

Built for serious businesses

If you’re building a serious business in Web3, focusing solely on offering users the “best price” isn’t enough. You have to think about how swaps fit into your business holistically, from security and compliance to business ops and revenue.

Powerful new monetization controls

Swap fees are one of the most effective monetization methods for driving meaningful revenue in DeFi. Customers have already generated millions of dollars in revenue from the trading activity of their users thanks to 0x’s out-of-the-box swap fee feature.

Now, you can control exactly which tokens to collect fees in, including both buy AND sell tokens, with 0x v2 . The ability to only collect fees in stable tokens eliminates some serious headaches for Finance & Ops. 

  • Predictable balance sheet: Reduce exposure to volatile long-tail tokens that can go down 99% before you sell them.
  • Gas savings: No more manually selling tokens for more stable assets, saving your team valuable time and potentially thousands of dollars in gas.
  • Reduced accounting complexity: Long tail tokens, like memecoins, are difficult to accurately price due to lack of liquidity, which can make it difficult to track revenue.

v2 enables you to unlock new revenue streams and gives you more control over your balance sheet, saving you time and money on your journey towards building a sustainable Web3 business.

What else is coming in v2

  • Lightning fast liquidity integration: Fresh new liquidity sources can be integrated in days, not weeks. You can request new sources through our Liquidity Integration Form.
  • FoT token support: Full support for buying AND selling fee-on-transfer tokens so that your users don’t miss out on the latest memecoin.
  • Improved error handling: Error messages designed for humans, solving the most tedious part of the developer experience with descriptive vs cryptic error codes.
  • Enhanced error validation: Quotes that just work. No more onchain reverts due to quotes that can’t be validated and less dev time devoted to figuring out how to estimate gas when users don’t have a balance or allowance set.

Ready to get serious?

0x v2 is in open beta. Book a v2 onboarding meeting for help getting started.

Want to take it for a spin? You can test drive v2 on Matcha today.

Stay tuned over the coming weeks for more details about our redesigned router, aggregation capabilities, and smart contracts.