What it offers
- transformERC20: Execute a token swap via the Exchange Proxy transformer pipeline
Notes
- The Exchange Proxy address is the same on 6 of its 7 chains; Optimism’s differs
- Uses transformer pipeline architecture - each swap is a sequence of transformations
- Route computation happens via 0x API - transformations array comes from API response
- Approve inputToken to exchangeProxy before swapping
- 0x API provides the route, slippage protection, and transformer calldata
Its names in a program
On Ethereum,Zerox is a namespace: its contracts need no import.
Deployments
ABI
ExchangeProxyABI
import ExchangeProxyABI from "./protocols/zerox/ExchangeProxyABI.json"; Speaks for: exchangeProxy.
transformERC20(address inputToken, address outputToken, uint256 inputTokenAmount, uint256 minOutputTokenAmount, (uint32 deploymentNonce, bytes data)[] transformations) payable returns (uint256 outputTokenAmount)
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
