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.
- v4 is the most powerful upgrade of the 0x Protocol, making it the most gas-efficient DEX protocol (up to 70% gas savings with RFQ liquidity).
- Users can expect more competitive liquidity from professional market makers and in turn better prices through 0x Swap API.
- 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. The old allowance will be deprecated on March 31st.
- If you are a developer building with Swap API and consuming RFQ liquidity via /swap/v1, we encourage you to update the takerAddress to be a non-contract EOA address to ensure your continued access to RFQ liquidity.
- We will stop supporting /swap/v0 on March 31st.
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:
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.
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:
- Aggregation of Swap API exclusive liquidity sources, 0x RFQT and 0x private AMM, which translates into better pricing.
- Lower gas usage due to our super optimized contract that allows Swap API to source Uniswap and Sushiswap liquidity in a more gas efficient way than the default Uniswap and Sushiswap contracts.
- The 0x protocol fee is no longer incurred for RFQ and external liquidity sources, lowering transaction costs further.