* v4 FillQuoteTransformer (#104) * Update FQT to support v4 orders * `@0x/contracts-zero-ex`: Tweak FQT `@0x/contracts-zero-ex`: Drop `ERC20BridgeTransfer` event and add `PartialQuoteFill` event. * `@0x/contracts-utils`: Add `LibSafeMathV06.downcastToUint128()` * `@0x/protocol-utils`: Update transformer utils for V4 FQT * `@0x/contracts-zero-ex`: Fixing FQT tests... * `@0x/contracts-zero-ex`: rename FQT bridge event * `@0x/contracts-zero-ex`: Un-`only` tests * `@0x/migrations`: Update `BridgeAdapter` deployment * `@0x/contracts-integrations`: Delete `mtx_tests` * `@0x/protocol-utils`: Address review comments * `@0x/contracts-zero-ex`: Address review comments * `@0x/migrations`: Update migrations Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com> Co-authored-by: Lawrence Forman <me@merklejerk.com> * v4: Asset-swapper (main branch) (#113) * refactor quote_requestor * WIP v4/asset-swapper: Clean up SwapQuoter and remove @0x/orderbook * Start replacing SignedOrder everywhere * wip: new order type * wip * remove order-utils from most places * hack: Play around with VerboseX types (#119) * hack: Play around with VerboseX types * More hacks * Fix up the bridgeData encodings * Rework Orderbook return type * feat: Don't charge a protocol fee for RFQ orders WIP (#121) * fix simple build errors * simplify types a little * remove SwapQuoteCalculator: unnecessary abstraction * Fix all ./src build errors; make types consistent * export more types for use in 0x API; modify Orderbook interface * stop overriding APIOrder * feat: RFQ v4 + consolidated bridge encoders (#125) * feat: check if taker address is contract * Rework bridge data * Worst case adjustments * RFQT v4 * Future/v4 validate orders (#126) * RFQT v4 * v4 validate native orders * use default invalid signature * refactor rfqt validations in swap quoter * fix types * fix RFQT unlisted api key * remove priceAwareRFQFlag * adjust maker/taker amounts * update JSON schemas * filter zero fillable orders Co-authored-by: xianny <xianny@gmail.com> * fix type export Co-authored-by: xianny <xianny@gmail.com> * remove order-utils as much as possible * work on tests compile * Comment out quote reporter test * updated tests * restore order-utils accidental changes * some lints * Remove old fill_test * ts lint disable for now * update quote report * Re-enable quote report tests * make fill data required field * fix lint * type guards * force fillData as required * fix lint * fix naming * exports * adjust MultiBridge by slippage * cleanups (checkpoint 1) * cleanup types (checkpoint #2) * remove unused deps * `@0x/contract-addresses`: Deploy new FQT (#129) Co-authored-by: Lawrence Forman <me@merklejerk.com> * commit bump to republish * DRY up the rfqt mocker * fix: Balancer load top pools (#131) * fix: Balancer load top 250 pools * refetch top pools on an interval Co-authored-by: Jacob Evans <jacob@dekz.net> Co-authored-by: Kim Persson <kimpers@users.noreply.github.com> Co-authored-by: Lawrence Forman <lawrence@0xproject.com> Co-authored-by: Lawrence Forman <me@merklejerk.com> * Update post rebase * prettier * Remove test helpers exported in asset-swapper * Clean up from review comments * prettier * lint * recreate rfqt mocker * change merge and INVALID_SIGNATURE Co-authored-by: Lawrence Forman <lawrence@0xproject.com> Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com> Co-authored-by: Lawrence Forman <me@merklejerk.com> Co-authored-by: Xianny <8582774+xianny@users.noreply.github.com> Co-authored-by: Kim Persson <kimpers@users.noreply.github.com>

0x is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. For more information on how it works, check out the 0x protocol specification.
This repository is a monorepo including the 0x protocol smart contracts and numerous developer tools. Each public sub-package is independently published to NPM.
Packages
Visit our developer portal for a comprehensive list of core & community maintained packages. All packages maintained with this monorepo are listed below.
Solidity Packages
These packages are all under development. See /contracts/README.md for a list of deployed packages.
Package | Version | Description |
---|---|---|
@0x/contracts-asset-proxy |
AssetProxy contracts used within the protocol |
|
@0x/contracts-erc20 |
Implementations of various ERC20 tokens | |
@0x/contracts-erc721 |
Implementations of various ERC721 tokens | |
@0x/contracts-erc1155 |
Implementations of various ERC1155 tokens | |
@0x/contracts-exchange |
The Exchange contract used for settling trades within the protocol |
|
@0x/contracts-exchange-forwarder |
A Forwarder contract used to simplify UX for interacting with the protocol |
|
@0x/contracts-exchange-libs |
Protocol specific libraries used within the Exchange contract |
|
@0x/contracts-extensions |
Contracts that interact with and extend the functionality of the core protocol | |
@0x/contracts-multisig |
Various implementations of multisignature wallets, including the AssetProxyOwner contract that has permissions to upgrade the protocol |
|
@0x/contracts-test-utils |
TypeScript/Javascript shared utilities used for testing contracts | |
@0x/contracts-utils |
Generic libraries and utilities used throughout all of the contracts | |
@0x/contracts-coordinator |
A contract that allows users to execute 0x transactions with permission from a Coordinator | |
@0x/contracts-dev-utils |
A contract contains utility functions for developers (such as validating many orders using a single eth_call) | |
@0x/contracts-staking |
Implements the stake-based liquidity incentives defined by ZEIP-31 |
TypeScript/Javascript Packages
0x-specific packages
Package | Version | Description |
---|---|---|
@0x/contract-addresses |
A tiny utility library for getting known deployed contract addresses for a particular network. | |
@0x/contract-wrappers |
JS/TS wrappers for interacting with the 0x smart contracts | |
@0x/order-utils |
A set of utilities for generating, parsing, signing and validating 0x orders | |
@0x/migrations |
Migration tool for deploying 0x smart contracts on private testnets | |
@0x/contract-artifacts |
0x smart contract compilation artifacts |
Usage
Node version 6.x or 8.x is required.
Most of the packages require additional typings for external dependencies.
You can include those by prepending the @0x/typescript-typings
package to your typeRoots
config.
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
Read our contribution guidelines.
Install dependencies
Make sure you are using Yarn v1.9.4. To install using brew:
brew install yarn@1.9.4
Then install dependencies
yarn install
Build
To build all packages:
yarn build
To build a specific package:
PKG=@0x/contract-wrappers yarn build
To build all contracts packages:
yarn build:contracts
Watch
To re-build all packages on change:
yarn watch
To watch a specific package and all it's dependent packages:
PKG=[NPM_PACKAGE_NAME] yarn watch
e.g
PKG=@0x/contract-wrappers yarn watch
Clean
Clean all packages:
yarn clean
Clean a specific package
PKG=0x.js yarn clean
Rebuild
To re-build (clean & build) all packages:
yarn rebuild
To re-build (clean & build) a specific package & it's deps:
PKG=@0x/contract-wrappers yarn rebuild
Lint
Lint all packages:
yarn lint
Lint a specific package:
PKG=@0x/contract-wrappers yarn lint
Run Tests
Run all tests:
yarn test
Run a specific package's test:
PKG=@0x/contract-wrappers yarn test
Run all contracts packages tests:
yarn test:contracts