0x Swap API now supports 0x Protocol v4

0x Swap API now supports 0x Protocol v4, providing a more gas-efficient DEX protocol with better liquidity and pricing.

March 1, 2021

News

TL;DR

The 0x Swap API is designed to make it easy for DeFi developers like you to tap into both off-chain and on-chain DEX liquidity in a fast, reliable, and easy to use way so you can focus on what matters: your product. As of February 12th, 2020, the /swap/v1 endpoint supports 0x Protocol v4.

This version of the 0x Protocol is the most powerful update made to the protocol to date, turning it into the most gas-efficient DEX. As a result, users of applications built with Swap API can expect more gas efficient orders (up to 70% gas saved for RFQ orders and 10% for limit orders) and even better prices from 0x professional market makers.

If you are building with Swap API /swap/v1 , here’s what you need to know:

New allowanceTarget

The default allowanceTarget returned by /swap/v1 has changed to 0xdef1c0ded9bec7f1a1670819833240f027b25eff. This allows us to lower costs for your end users by a measurable amount:

However, we understand if you don’t want to migrate your users just yet. This is a soft change and the old allowance (0xf740b67da229f2f10bcbd38a7979992fcc71b8eb) will continue working until March 31st — when we deprecate it.

Upgrade takerAddress

With the update to 0x Protocol v4, RFQ orders no longer have a protocol fee and require a tx.origin to be specified. This allows 0x market makers to price for the user, rather than the entire integration.

If you are using /swap/v1, note that it now requires takerAddress to be the end user submitting the transaction (i.e. an EOA). Depending on your integration, you might be setting takerAddress to a contract address you were filling from. The expected experience is that when takerAddress is a contract no RFQ orders are served, so we highly encourage you to update takerAddress to be a non-contract EOA address to ensure your continued access to RFQ liquidity.

Deprecation of /swap v0

We will stop supporting /swap/v0 on March 31st. If you are currently using the older version of /swap we highly encourage you to move over as soon as possible. v1 has a lot of benefits over v0, including:

Contents

Subscribe to newsletter

By submitting you're confirming that you agree with our Terms and Conditions.
Yay! You’re signed up.
Oops! Something went wrong, but it's not your fault.