Merge pull request #1539 from 0xProject/feat/contracts/split-packages
Split/rename/combine packages
This commit is contained in:
@@ -43,10 +43,13 @@ jobs:
|
|||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-multisig
|
- run: yarn wsrun test:circleci @0x/contracts-multisig
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-utils
|
- run: yarn wsrun test:circleci @0x/contracts-utils
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-libs
|
- run: yarn wsrun test:circleci @0x/contracts-exchange-libs
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-tokens
|
- run: yarn wsrun test:circleci @0x/contracts-erc20
|
||||||
|
- run: yarn wsrun test:circleci @0x/contracts-erc721
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-extensions
|
- run: yarn wsrun test:circleci @0x/contracts-extensions
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-protocol
|
- run: yarn wsrun test:circleci @0x/contracts-asset-proxy
|
||||||
|
- run: yarn wsrun test:circleci @0x/contracts-exchange
|
||||||
|
- run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder
|
||||||
test-contracts-geth:
|
test-contracts-geth:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:9-browsers
|
- image: circleci/node:9-browsers
|
||||||
@@ -59,11 +62,14 @@ jobs:
|
|||||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||||
# initialized
|
# initialized
|
||||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
|
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
|
||||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-utils
|
||||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-exchange-libs
|
||||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-erc20
|
||||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-erc721
|
||||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-extensions
|
||||||
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-asset-proxy
|
||||||
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-exchange
|
||||||
|
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-exchange-forwarder
|
||||||
test-publish:
|
test-publish:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
|
22
.gitignore
vendored
22
.gitignore
vendored
@@ -83,27 +83,29 @@ packages/react-docs/example/public/bundle*
|
|||||||
packages/testnet-faucets/server/
|
packages/testnet-faucets/server/
|
||||||
|
|
||||||
# generated contract artifacts/
|
# generated contract artifacts/
|
||||||
contracts/protocol/generated-artifacts/
|
contracts/exchange/generated-artifacts/
|
||||||
|
contracts/asset-proxy/generated-artifacts/
|
||||||
contracts/multisig/generated-artifacts/
|
contracts/multisig/generated-artifacts/
|
||||||
contracts/utils/generated-artifacts/
|
contracts/utils/generated-artifacts/
|
||||||
contracts/libs/generated-artifacts/
|
contracts/exchange-libs/generated-artifacts/
|
||||||
contracts/interfaces/generated-artifacts/
|
contracts/erc20/generated-artifacts/
|
||||||
contracts/tokens/generated-artifacts/
|
contracts/erc721/generated-artifacts/
|
||||||
contracts/examples/generated-artifacts/
|
|
||||||
contracts/extensions/generated-artifacts/
|
contracts/extensions/generated-artifacts/
|
||||||
|
contracts/exchange-forwarder/generated-artifacts/
|
||||||
packages/sol-tracing-utils/test/fixtures/artifacts/
|
packages/sol-tracing-utils/test/fixtures/artifacts/
|
||||||
packages/metacoin/artifacts/
|
packages/metacoin/artifacts/
|
||||||
|
|
||||||
# generated contract wrappers
|
# generated contract wrappers
|
||||||
packages/abi-gen-wrappers/wrappers
|
packages/abi-gen-wrappers/wrappers
|
||||||
contracts/protocol/generated-wrappers/
|
contracts/exchange/generated-wrappers/
|
||||||
|
contracts/asset-proxy/generated-wrappers/
|
||||||
contracts/multisig/generated-wrappers/
|
contracts/multisig/generated-wrappers/
|
||||||
contracts/utils/generated-wrappers/
|
contracts/utils/generated-wrappers/
|
||||||
contracts/libs/generated-wrappers/
|
contracts/exchange-libs/generated-wrappers/
|
||||||
contracts/interfaces/generated-wrappers/
|
contracts/erc20/generated-wrappers/
|
||||||
contracts/tokens/generated-wrappers/
|
contracts/erc721/generated-wrappers/
|
||||||
contracts/examples/generated-wrappers/
|
|
||||||
contracts/extensions/generated-wrappers/
|
contracts/extensions/generated-wrappers/
|
||||||
|
contracts/exchange-forwarder/generated-wrappers/
|
||||||
packages/metacoin/src/contract_wrappers
|
packages/metacoin/src/contract_wrappers
|
||||||
|
|
||||||
# solc-bin in sol-compiler
|
# solc-bin in sol-compiler
|
||||||
|
@@ -1,21 +1,23 @@
|
|||||||
lib
|
lib
|
||||||
.nyc_output
|
.nyc_output
|
||||||
/contracts/protocol/generated-wrappers
|
/contracts/exchange/generated-wrappers
|
||||||
/contracts/protocol/generated-artifacts
|
/contracts/exchange/generated-artifacts
|
||||||
|
/contracts/asset-proxy/generated-wrappers
|
||||||
|
/contracts/asset-proxy/generated-artifacts
|
||||||
/contracts/multisig/generated-wrappers
|
/contracts/multisig/generated-wrappers
|
||||||
/contracts/multisig/generated-artifacts
|
/contracts/multisig/generated-artifacts
|
||||||
/contracts/utils/generated-wrappers
|
/contracts/utils/generated-wrappers
|
||||||
/contracts/utils/generated-artifacts
|
/contracts/utils/generated-artifacts
|
||||||
/contracts/libs/generated-wrappers
|
/contracts/exchange-libs/generated-wrappers
|
||||||
/contracts/libs/generated-artifacts
|
/contracts/exchange-libs/generated-artifacts
|
||||||
/contracts/interfaces/generated-wrappers
|
/contracts/erc20/generated-wrappers
|
||||||
/contracts/interfaces/generated-artifacts
|
/contracts/erc20/generated-artifacts
|
||||||
/contracts/tokens/generated-wrappers
|
/contracts/erc721/generated-wrappers
|
||||||
/contracts/tokens/generated-artifacts
|
/contracts/erc721/generated-artifacts
|
||||||
/contracts/examples/generated-wrappers
|
|
||||||
/contracts/examples/generated-artifacts
|
|
||||||
/contracts/extensions/generated-wrappers
|
/contracts/extensions/generated-wrappers
|
||||||
/contracts/extensions/generated-artifacts
|
/contracts/extensions/generated-artifacts
|
||||||
|
/contracts/exchange-forwarder/generated-wrappers
|
||||||
|
/contracts/exchange-forwarder/generated-artifacts
|
||||||
/packages/abi-gen-wrappers/src/generated-wrappers
|
/packages/abi-gen-wrappers/src/generated-wrappers
|
||||||
/packages/contract-artifacts/artifacts
|
/packages/contract-artifacts/artifacts
|
||||||
/python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts
|
/python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts
|
||||||
|
28
README.md
28
README.md
@@ -32,6 +32,21 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
|
|||||||
| [`0x-order-utils`](/python-packages/order_utils) | [](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
| [`0x-order-utils`](/python-packages/order_utils) | [](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||||
| [`0x-sra-client`](/python-packages/sra_client) | [](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
|
| [`0x-sra-client`](/python-packages/sra_client) | [](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
|
||||||
|
|
||||||
|
### Solidity Packages
|
||||||
|
|
||||||
|
| Package | Version | Description |
|
||||||
|
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| [`@0x/contracts-asset-proxy`](/contracts/asset-proxy) | [](https://www.npmjs.com/package/@0x/contracts-asset-proxy) | [`AssetProxy`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy) contracts used within the protocol |
|
||||||
|
| [`@0x/contracts-erc20`](/contracts/erc20) | [](https://www.npmjs.com/package/@0x/contracts-erc20) | Implementations of various ERC20 tokens |
|
||||||
|
| [`@0x/contracts-erc721`](/contracts/erc721) | [](https://www.npmjs.com/package/@0x/contracts-erc721) | Implementations of various ERC721 tokens |
|
||||||
|
| [`@0x/contracts-exchange`](/contracts/exchange) | [](https://www.npmjs.com/package/@0x/contracts-exchange) | The [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract used for settling trades within the protocol |
|
||||||
|
| [`@0x/contracts-exchange-forwarder`](/contracts/exchange-forwarder) | [](https://www.npmjs.com/package/@0x/contracts-exchange-forwarder) | A [`Forwarder`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract used to simplify UX for interacting with the protocol |
|
||||||
|
| [`@0x/contracts-exchange-libs`](/contracts/exchange-libs) | [](https://www.npmjs.com/package/@0x/contracts-exchange-libs) | Protocol specific Llbraries used within the [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract |
|
||||||
|
| [`@0x/contracts-extensions`](/contracts/extensions) | [](https://www.npmjs.com/package/@0x/contracts-extensions) | Contracts that interact with and extend the functionality of the core protocol |
|
||||||
|
| [`@0x/contracts-multisig`](/contracts/multisig) | [](https://www.npmjs.com/package/@0x/contracts-multisig) | Various implementations of multisignature wallets, including the [`AssetProxyOwner`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxyowner) contract that has permissions to upgrade the protocol |
|
||||||
|
| [`@0x/contracts-test-utils`](/contracts/test-utils) | [](https://www.npmjs.com/package/@0x/contracts-test-utils) | Typescript/Javascript shared utilities used for testing contracts |
|
||||||
|
| [`@0x/contracts-utils`](/contracts/utils) | [](https://www.npmjs.com/package/@0x/contracts-utils) | Generic libraries and utilities used throughout all of the contracts |
|
||||||
|
|
||||||
### Typescript/Javascript Packages
|
### Typescript/Javascript Packages
|
||||||
|
|
||||||
#### 0x-specific packages
|
#### 0x-specific packages
|
||||||
@@ -84,7 +99,6 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
|
|||||||
|
|
||||||
| Package | Description |
|
| Package | Description |
|
||||||
| -------------------------------------------------- | -------------------------------------------------------------------------------- |
|
| -------------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||||
| [`@0x/contracts`](/contracts/core) | 0x protocol solidity smart contracts & tests |
|
|
||||||
| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
|
| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
|
||||||
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
||||||
| [`@0x/website`](/packages/website) | 0x website |
|
| [`@0x/website`](/packages/website) | 0x website |
|
||||||
@@ -134,6 +148,12 @@ To build a specific package:
|
|||||||
PKG=@0x/web3-wrapper yarn build
|
PKG=@0x/web3-wrapper yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To build all contracts packages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn build:contracts
|
||||||
|
```
|
||||||
|
|
||||||
### Watch
|
### Watch
|
||||||
|
|
||||||
To re-build all packages on change:
|
To re-build all packages on change:
|
||||||
@@ -206,3 +226,9 @@ Run a specific package's test:
|
|||||||
```bash
|
```bash
|
||||||
PKG=@0x/web3-wrapper yarn test
|
PKG=@0x/web3-wrapper yarn test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Run all contracts packages tests:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn test:contracts
|
||||||
|
```
|
||||||
|
11
contracts/asset-proxy/CHANGELOG.json
Normal file
11
contracts/asset-proxy/CHANGELOG.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Move all AssetProxy contracts out of contracts-protocol to new package",
|
||||||
|
"pr": 1539
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
47
contracts/asset-proxy/DEPLOYS.json
Normal file
47
contracts/asset-proxy/DEPLOYS.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "MultiAssetProxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add MultiAssetProxy implementation",
|
||||||
|
"pr": 1224,
|
||||||
|
"networks": {
|
||||||
|
"3": "0xab8fbd189c569ccdee3a4d929bb7f557be4028f6",
|
||||||
|
"4": "0xb34cde0ad3a83d04abebc0b66e75196f22216621",
|
||||||
|
"42": "0xf6313a772c222f51c28f2304c0703b8cf5428fd8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ERC20Proxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "protocol v2 deploy",
|
||||||
|
"networks": {
|
||||||
|
"1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
|
||||||
|
"3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
|
||||||
|
"4": "0x3e809c563c15a295e832e37053798ddc8d6c8dab",
|
||||||
|
"42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ERC721Proxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "protocol v2 deploy",
|
||||||
|
"networks": {
|
||||||
|
"1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
|
||||||
|
"3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
|
||||||
|
"4": "0x8e1ff02637cb5e39f2fa36c14706aa348b065b09",
|
||||||
|
"42": "0x2a9127c745688a165106c11cd4d647d2220af821"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@@ -1,15 +1,14 @@
|
|||||||
## Contracts
|
## AssetProxy
|
||||||
|
|
||||||
Smart contracts that implement the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
|
This package contains the implementations of all of the [`AssetProxy`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy) contracts available within the 0x protocol. These contracts are responsible for decoding the `assetData` sent to them and performing the actual transfer of assets. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
|
||||||
|
|
||||||
## Usage
|
## Installation
|
||||||
|
|
||||||
Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
**Install**
|
||||||
|
|
||||||
- [protocol](./contracts/protocol)
|
```bash
|
||||||
- This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
npm install @0x/contracts-asset-proxy --save
|
||||||
- [test](./contracts/test)
|
```
|
||||||
- This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
|
|
||||||
|
|
||||||
## Bug bounty
|
## Bug bounty
|
||||||
|
|
||||||
@@ -42,13 +41,13 @@ yarn install
|
|||||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-protocol yarn build
|
PKG=@0x/contracts-asset-proxy yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Or continuously rebuild on change:
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-protocol yarn watch
|
PKG=@0x/contracts-asset-proxy yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
@@ -19,16 +19,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contracts": [
|
"contracts": [
|
||||||
"AssetProxyOwner",
|
"IAssetData",
|
||||||
|
"IAssetProxy",
|
||||||
|
"IAuthorizable",
|
||||||
"ERC20Proxy",
|
"ERC20Proxy",
|
||||||
"ERC721Proxy",
|
"ERC721Proxy",
|
||||||
"Exchange",
|
|
||||||
"MixinAuthorizable",
|
"MixinAuthorizable",
|
||||||
"MultiAssetProxy",
|
"MultiAssetProxy"
|
||||||
"TestAssetProxyOwner",
|
|
||||||
"TestAssetProxyDispatcher",
|
|
||||||
"TestExchangeInternals",
|
|
||||||
"TestSignatureValidator",
|
|
||||||
"TestStaticCallReceiver"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
import "./mixins/MAssetProxyDispatcher.sol";
|
import "./mixins/MAssetProxyDispatcher.sol";
|
||||||
import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol";
|
import "./interfaces/IAssetProxy.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinAssetProxyDispatcher is
|
contract MixinAssetProxyDispatcher is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
import "./mixins/MAuthorizable.sol";
|
import "./mixins/MAuthorizable.sol";
|
||||||
|
|
||||||
|
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../Exchange/MixinAssetProxyDispatcher.sol";
|
import "./MixinAssetProxyDispatcher.sol";
|
||||||
import "./MixinAuthorizable.sol";
|
import "./MixinAuthorizable.sol";
|
||||||
|
|
||||||
|
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
|
import "@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IAuthorizable is
|
contract IAuthorizable is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol";
|
import "../interfaces/IAssetProxyDispatcher.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MAssetProxyDispatcher is
|
contract MAssetProxyDispatcher is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol";
|
import "../interfaces/IAuthorizable.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MAuthorizable is
|
contract MAuthorizable is
|
82
contracts/asset-proxy/package.json
Normal file
82
contracts/asset-proxy/package.json
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"name": "@0x/contracts-asset-proxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.12"
|
||||||
|
},
|
||||||
|
"description": "Smart contract components of 0x protocol",
|
||||||
|
"main": "lib/src/index.js",
|
||||||
|
"directories": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "yarn pre_build && tsc -b",
|
||||||
|
"build:ci": "yarn build",
|
||||||
|
"pre_build": "run-s compile generate_contract_wrappers",
|
||||||
|
"test": "yarn run_mocha",
|
||||||
|
"rebuild_and_test": "run-s build test",
|
||||||
|
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||||
|
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||||
|
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||||
|
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||||
|
"compile": "sol-compiler",
|
||||||
|
"watch": "sol-compiler -w",
|
||||||
|
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||||
|
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||||
|
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||||
|
"coverage:report:text": "istanbul report text",
|
||||||
|
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||||
|
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||||
|
"coverage:report:lcov": "istanbul report lcov",
|
||||||
|
"test:circleci": "yarn test",
|
||||||
|
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"abis": "generated-artifacts/@(ERC20Proxy|ERC721Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy).json"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
|
||||||
|
"devDependencies": {
|
||||||
|
"@0x/abi-gen": "^1.0.22",
|
||||||
|
"@0x/dev-utils": "^1.0.24",
|
||||||
|
"@0x/sol-compiler": "^2.0.2",
|
||||||
|
"@0x/tslint-config": "^2.0.2",
|
||||||
|
"@types/lodash": "4.14.104",
|
||||||
|
"@types/node": "*",
|
||||||
|
"chai": "^4.0.1",
|
||||||
|
"chai-as-promised": "^7.1.0",
|
||||||
|
"chai-bignumber": "^3.0.0",
|
||||||
|
"dirty-chai": "^2.0.1",
|
||||||
|
"make-promises-safe": "^1.1.0",
|
||||||
|
"mocha": "^4.1.0",
|
||||||
|
"npm-run-all": "^4.1.2",
|
||||||
|
"shx": "^0.2.2",
|
||||||
|
"solhint": "^1.4.1",
|
||||||
|
"tslint": "5.11.0",
|
||||||
|
"typescript": "3.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@0x/base-contract": "^3.0.13",
|
||||||
|
"@0x/contracts-test-utils": "^2.0.1",
|
||||||
|
"@0x/contracts-erc20": "^1.0.0",
|
||||||
|
"@0x/contracts-erc721": "^1.0.0",
|
||||||
|
"@0x/contracts-utils": "^3.0.0",
|
||||||
|
"@0x/order-utils": "^3.1.2",
|
||||||
|
"@0x/types": "^1.5.2",
|
||||||
|
"@0x/typescript-typings": "^3.0.8",
|
||||||
|
"@0x/utils": "^3.0.1",
|
||||||
|
"@0x/web3-wrapper": "^3.2.4",
|
||||||
|
"ethereum-types": "^1.1.6",
|
||||||
|
"lodash": "^4.17.5"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
}
|
||||||
|
}
|
19
contracts/asset-proxy/src/artifacts/index.ts
Normal file
19
contracts/asset-proxy/src/artifacts/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
|
import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
|
||||||
|
import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
|
||||||
|
import * as IAssetData from '../../generated-artifacts/IAssetData.json';
|
||||||
|
import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
|
||||||
|
import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
|
||||||
|
import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
|
||||||
|
import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
|
||||||
|
|
||||||
|
export const artifacts = {
|
||||||
|
IAuthorizable: IAuthorizable as ContractArtifact,
|
||||||
|
IAssetData: IAssetData as ContractArtifact,
|
||||||
|
IAssetProxy: IAssetProxy as ContractArtifact,
|
||||||
|
ERC20Proxy: ERC20Proxy as ContractArtifact,
|
||||||
|
ERC721Proxy: ERC721Proxy as ContractArtifact,
|
||||||
|
MixinAuthorizable: MixinAuthorizable as ContractArtifact,
|
||||||
|
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
|
||||||
|
};
|
7
contracts/asset-proxy/src/wrappers/index.ts
Normal file
7
contracts/asset-proxy/src/wrappers/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export * from '../../generated-wrappers/i_asset_data';
|
||||||
|
export * from '../../generated-wrappers/i_asset_proxy';
|
||||||
|
export * from '../../generated-wrappers/erc20_proxy';
|
||||||
|
export * from '../../generated-wrappers/erc721_proxy';
|
||||||
|
export * from '../../generated-wrappers/mixin_authorizable';
|
||||||
|
export * from '../../generated-wrappers/multi_asset_proxy';
|
||||||
|
export * from '../../generated-wrappers/i_authorizable';
|
@@ -12,8 +12,7 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
|
import { artifacts, MixinAuthorizableContract } from '../src';
|
||||||
import { artifacts } from '../../src/artifacts';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
@@ -1,4 +1,15 @@
|
|||||||
import { artifacts as interfacesArtifacts, IAssetDataContract, IAssetProxyContract } from '@0x/contracts-interfaces';
|
import {
|
||||||
|
artifacts as erc20Artifacts,
|
||||||
|
DummyERC20TokenContract,
|
||||||
|
DummyERC20TokenTransferEventArgs,
|
||||||
|
DummyMultipleReturnERC20TokenContract,
|
||||||
|
DummyNoReturnERC20TokenContract,
|
||||||
|
} from '@0x/contracts-erc20';
|
||||||
|
import {
|
||||||
|
artifacts as erc721Artifacts,
|
||||||
|
DummyERC721ReceiverContract,
|
||||||
|
DummyERC721TokenContract,
|
||||||
|
} from '@0x/contracts-erc721';
|
||||||
import {
|
import {
|
||||||
chaiSetup,
|
chaiSetup,
|
||||||
constants,
|
constants,
|
||||||
@@ -9,15 +20,6 @@ import {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
web3Wrapper,
|
web3Wrapper,
|
||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import {
|
|
||||||
artifacts as tokensArtifacts,
|
|
||||||
DummyERC20TokenContract,
|
|
||||||
DummyERC20TokenTransferEventArgs,
|
|
||||||
DummyERC721ReceiverContract,
|
|
||||||
DummyERC721TokenContract,
|
|
||||||
DummyMultipleReturnERC20TokenContract,
|
|
||||||
DummyNoReturnERC20TokenContract,
|
|
||||||
} from '@0x/contracts-tokens';
|
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
@@ -26,23 +28,27 @@ import * as chai from 'chai';
|
|||||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
|
import {
|
||||||
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
artifacts,
|
||||||
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
|
ERC20ProxyContract,
|
||||||
import { artifacts } from '../../src/artifacts';
|
ERC20Wrapper,
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
ERC721ProxyContract,
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
ERC721Wrapper,
|
||||||
|
IAssetDataContract,
|
||||||
|
IAssetProxyContract,
|
||||||
|
MultiAssetProxyContract,
|
||||||
|
} from '../src';
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
const assetProxyInterface = new IAssetProxyContract(
|
const assetProxyInterface = new IAssetProxyContract(
|
||||||
interfacesArtifacts.IAssetProxy.compilerOutput.abi,
|
artifacts.IAssetProxy.compilerOutput.abi,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
provider,
|
provider,
|
||||||
);
|
);
|
||||||
const assetDataInterface = new IAssetDataContract(
|
const assetDataInterface = new IAssetDataContract(
|
||||||
interfacesArtifacts.IAssetData.compilerOutput.abi,
|
artifacts.IAssetData.compilerOutput.abi,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
provider,
|
provider,
|
||||||
);
|
);
|
||||||
@@ -148,7 +154,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
);
|
);
|
||||||
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
|
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
|
||||||
tokensArtifacts.DummyNoReturnERC20Token,
|
erc20Artifacts.DummyNoReturnERC20Token,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
constants.DUMMY_TOKEN_NAME,
|
constants.DUMMY_TOKEN_NAME,
|
||||||
@@ -157,7 +163,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
);
|
);
|
||||||
multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
|
multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
|
||||||
tokensArtifacts.DummyMultipleReturnERC20Token,
|
erc20Artifacts.DummyMultipleReturnERC20Token,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
constants.DUMMY_TOKEN_NAME,
|
constants.DUMMY_TOKEN_NAME,
|
||||||
@@ -198,7 +204,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
// Deploy and configure ERC721 tokens and receiver
|
// Deploy and configure ERC721 tokens and receiver
|
||||||
[erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
|
[erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
|
||||||
erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
|
erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
|
||||||
tokensArtifacts.DummyERC721Receiver,
|
erc721Artifacts.DummyERC721Receiver,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
);
|
);
|
||||||
@@ -562,7 +568,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
erc721Receiver.address,
|
erc721Receiver.address,
|
||||||
amount,
|
amount,
|
||||||
);
|
);
|
||||||
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
|
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc721Artifacts });
|
||||||
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
||||||
await web3Wrapper.sendTransactionAsync({
|
await web3Wrapper.sendTransactionAsync({
|
||||||
to: erc721Proxy.address,
|
to: erc721Proxy.address,
|
||||||
@@ -754,7 +760,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
inputAmount,
|
inputAmount,
|
||||||
);
|
);
|
||||||
const erc20Balances = await erc20Wrapper.getBalancesAsync();
|
const erc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||||
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
|
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts });
|
||||||
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
||||||
await web3Wrapper.sendTransactionAsync({
|
await web3Wrapper.sendTransactionAsync({
|
||||||
to: multiAssetProxy.address,
|
to: multiAssetProxy.address,
|
@@ -1,5 +1,5 @@
|
|||||||
|
import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
|
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
|
||||||
import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-tokens';
|
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
@@ -1,5 +1,5 @@
|
|||||||
|
import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
|
||||||
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
|
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
|
||||||
import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-tokens';
|
|
||||||
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
@@ -1,3 +1,2 @@
|
|||||||
export * from './exchange_wrapper';
|
|
||||||
export * from './erc20_wrapper';
|
export * from './erc20_wrapper';
|
||||||
export * from './erc721_wrapper';
|
export * from './erc721_wrapper';
|
19
contracts/asset-proxy/tsconfig.json
Normal file
19
contracts/asset-proxy/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": ".",
|
||||||
|
"resolveJsonModule": true
|
||||||
|
},
|
||||||
|
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||||
|
"files": [
|
||||||
|
"./generated-artifacts/IAssetData.json",
|
||||||
|
"./generated-artifacts/IAssetProxy.json",
|
||||||
|
"./generated-artifacts/IAuthorizable.json",
|
||||||
|
"./generated-artifacts/ERC20Proxy.json",
|
||||||
|
"./generated-artifacts/ERC721Proxy.json",
|
||||||
|
"./generated-artifacts/MixinAuthorizable.json",
|
||||||
|
"./generated-artifacts/MultiAssetProxy.json"
|
||||||
|
],
|
||||||
|
"exclude": ["./deploy/solc/solc_bin"]
|
||||||
|
}
|
1
contracts/erc20/.solhintignore
Normal file
1
contracts/erc20/.solhintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
contracts/src/ZRXToken.sol
|
11
contracts/erc20/CHANGELOG.json
Normal file
11
contracts/erc20/CHANGELOG.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Move all ERC20 contracts out of contracts-tokens to new package",
|
||||||
|
"pr": 1539
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@@ -8,6 +8,7 @@
|
|||||||
"networks": {
|
"networks": {
|
||||||
"1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
|
"1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
|
||||||
"3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
|
"3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
|
||||||
|
"4": "0x2727e688b8fd40b198cd5fe6e408e00494a06f07",
|
||||||
"42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
|
"42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,13 +1,14 @@
|
|||||||
## Contract interfaces
|
## ERC20 Tokens
|
||||||
|
|
||||||
Smart contract interfaces of the 0x protocol.
|
This package contains implementations of various [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md) tokens, including WETH (Wrapped Ether) and ZRX. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
|
||||||
|
|
||||||
## Usage
|
## Installation
|
||||||
|
|
||||||
Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
**Install**
|
||||||
|
|
||||||
- [protocol](./contracts/protocol)
|
```bash
|
||||||
- This directory contains the contract interfaces that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
npm install @0x/contracts-erc20 --save
|
||||||
|
```
|
||||||
|
|
||||||
## Bug bounty
|
## Bug bounty
|
||||||
|
|
||||||
@@ -40,13 +41,13 @@ yarn install
|
|||||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-interfaces yarn build
|
PKG=@0x/contracts-erc20 yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Or continuously rebuild on change:
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-interfaces yarn watch
|
PKG=@0x/contracts-erc20 yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
@@ -22,23 +22,13 @@
|
|||||||
"DummyERC20Token",
|
"DummyERC20Token",
|
||||||
"DummyMultipleReturnERC20Token",
|
"DummyMultipleReturnERC20Token",
|
||||||
"DummyNoReturnERC20Token",
|
"DummyNoReturnERC20Token",
|
||||||
"DummyERC721Receiver",
|
|
||||||
"InvalidERC721Receiver",
|
|
||||||
"DummyERC721Token",
|
|
||||||
"ReentrantERC20Token",
|
"ReentrantERC20Token",
|
||||||
"ERC20Token",
|
"ERC20Token",
|
||||||
"IERC20Token",
|
"IERC20Token",
|
||||||
"MintableERC20Token",
|
"MintableERC20Token",
|
||||||
"UnlimitedAllowanceERC20Token",
|
"UnlimitedAllowanceERC20Token",
|
||||||
"ERC721Token",
|
|
||||||
"IERC721Receiver",
|
|
||||||
"IERC721Token",
|
|
||||||
"MintableERC721Token",
|
|
||||||
"IEtherToken",
|
"IEtherToken",
|
||||||
"WETH9",
|
"WETH9",
|
||||||
"ERC20Token_v1",
|
|
||||||
"Token_v1",
|
|
||||||
"UnlimitedAllowanceToken_v1",
|
|
||||||
"ZRXToken"
|
"ZRXToken"
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "./IERC20Token.sol";
|
import "./interfaces/IERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC20Token is
|
contract ERC20Token is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
|
||||||
import "./UnlimitedAllowanceERC20Token.sol";
|
import "./UnlimitedAllowanceERC20Token.sol";
|
||||||
|
|
||||||
|
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "../ERC20Token/ERC20Token.sol";
|
import "./ERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
contract UnlimitedAllowanceERC20Token is
|
contract UnlimitedAllowanceERC20Token is
|
150
contracts/erc20/contracts/src/ZRXToken.sol
Normal file
150
contracts/erc20/contracts/src/ZRXToken.sol
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 2018 ZeroEx Intl.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity 0.4.11;
|
||||||
|
|
||||||
|
|
||||||
|
contract Token {
|
||||||
|
|
||||||
|
/// @return total amount of tokens
|
||||||
|
function totalSupply() constant returns (uint supply) {}
|
||||||
|
|
||||||
|
/// @param _owner The address from which the balance will be retrieved
|
||||||
|
/// @return The balance
|
||||||
|
function balanceOf(address _owner) constant returns (uint balance) {}
|
||||||
|
|
||||||
|
/// @notice send `_value` token to `_to` from `msg.sender`
|
||||||
|
/// @param _to The address of the recipient
|
||||||
|
/// @param _value The amount of token to be transferred
|
||||||
|
/// @return Whether the transfer was successful or not
|
||||||
|
function transfer(address _to, uint _value) returns (bool success) {}
|
||||||
|
|
||||||
|
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
|
||||||
|
/// @param _from The address of the sender
|
||||||
|
/// @param _to The address of the recipient
|
||||||
|
/// @param _value The amount of token to be transferred
|
||||||
|
/// @return Whether the transfer was successful or not
|
||||||
|
function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
|
||||||
|
|
||||||
|
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
|
||||||
|
/// @param _spender The address of the account able to transfer the tokens
|
||||||
|
/// @param _value The amount of wei to be approved for transfer
|
||||||
|
/// @return Whether the approval was successful or not
|
||||||
|
function approve(address _spender, uint _value) returns (bool success) {}
|
||||||
|
|
||||||
|
/// @param _owner The address of the account owning tokens
|
||||||
|
/// @param _spender The address of the account able to transfer the tokens
|
||||||
|
/// @return Amount of remaining tokens allowed to spent
|
||||||
|
function allowance(address _owner, address _spender) constant returns (uint remaining) {}
|
||||||
|
|
||||||
|
event Transfer(address indexed _from, address indexed _to, uint _value);
|
||||||
|
event Approval(address indexed _owner, address indexed _spender, uint _value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract ERC20Token is Token {
|
||||||
|
|
||||||
|
function transfer(address _to, uint _value) returns (bool) {
|
||||||
|
//Default assumes totalSupply can't be over max (2^256 - 1).
|
||||||
|
if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
|
||||||
|
balances[msg.sender] -= _value;
|
||||||
|
balances[_to] += _value;
|
||||||
|
Transfer(msg.sender, _to, _value);
|
||||||
|
return true;
|
||||||
|
} else { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function transferFrom(address _from, address _to, uint _value) returns (bool) {
|
||||||
|
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
|
||||||
|
balances[_to] += _value;
|
||||||
|
balances[_from] -= _value;
|
||||||
|
allowed[_from][msg.sender] -= _value;
|
||||||
|
Transfer(_from, _to, _value);
|
||||||
|
return true;
|
||||||
|
} else { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function balanceOf(address _owner) constant returns (uint) {
|
||||||
|
return balances[_owner];
|
||||||
|
}
|
||||||
|
|
||||||
|
function approve(address _spender, uint _value) returns (bool) {
|
||||||
|
allowed[msg.sender][_spender] = _value;
|
||||||
|
Approval(msg.sender, _spender, _value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function allowance(address _owner, address _spender) constant returns (uint) {
|
||||||
|
return allowed[_owner][_spender];
|
||||||
|
}
|
||||||
|
|
||||||
|
mapping (address => uint) balances;
|
||||||
|
mapping (address => mapping (address => uint)) allowed;
|
||||||
|
uint public totalSupply;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract UnlimitedAllowanceToken is ERC20Token {
|
||||||
|
|
||||||
|
uint constant MAX_UINT = 2**256 - 1;
|
||||||
|
|
||||||
|
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.
|
||||||
|
/// @param _from Address to transfer from.
|
||||||
|
/// @param _to Address to transfer to.
|
||||||
|
/// @param _value Amount to transfer.
|
||||||
|
/// @return Success of transfer.
|
||||||
|
function transferFrom(address _from, address _to, uint _value)
|
||||||
|
public
|
||||||
|
returns (bool)
|
||||||
|
{
|
||||||
|
uint allowance = allowed[_from][msg.sender];
|
||||||
|
if (balances[_from] >= _value
|
||||||
|
&& allowance >= _value
|
||||||
|
&& balances[_to] + _value >= balances[_to]
|
||||||
|
) {
|
||||||
|
balances[_to] += _value;
|
||||||
|
balances[_from] -= _value;
|
||||||
|
if (allowance < MAX_UINT) {
|
||||||
|
allowed[_from][msg.sender] -= _value;
|
||||||
|
}
|
||||||
|
Transfer(_from, _to, _value);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
contract ZRXToken is
|
||||||
|
UnlimitedAllowanceToken
|
||||||
|
{
|
||||||
|
|
||||||
|
// solhint-disable const-name-snakecase
|
||||||
|
uint8 constant public decimals = 18;
|
||||||
|
uint256 public totalSupply = 10**27; // 1 billion tokens, 18 decimal places
|
||||||
|
string constant public name = "0x Protocol Token";
|
||||||
|
string constant public symbol = "ZRX";
|
||||||
|
// solhint-enableconst-name-snakecase
|
||||||
|
|
||||||
|
function ZRXToken()
|
||||||
|
public
|
||||||
|
{
|
||||||
|
balances[msg.sender] = totalSupply;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "../ERC20Token/IERC20Token.sol";
|
import "./IERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IEtherToken is
|
contract IEtherToken is
|
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
import "../../tokens/ERC20Token/MintableERC20Token.sol";
|
import "../src/MintableERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
contract DummyERC20Token is
|
contract DummyERC20Token is
|
@@ -19,10 +19,10 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||||
import "../../tokens/ERC20Token/ERC20Token.sol";
|
import "../src/ERC20Token.sol";
|
||||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
|
|
||||||
|
|
||||||
// solhint-disable no-unused-vars
|
// solhint-disable no-unused-vars
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-tokens",
|
"name": "@0x/contracts-erc20",
|
||||||
"version": "1.0.6",
|
"version": "1.0.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token|IEtherToken|WETH9|ERC20Token_v1|Token_v1|UnlimitedAllowanceToken_v1|ZRXToken).json"
|
"abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|IEtherToken|WETH9|ZRXToken).json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -48,41 +48,30 @@
|
|||||||
"@0x/contracts-test-utils": "^2.0.1",
|
"@0x/contracts-test-utils": "^2.0.1",
|
||||||
"@0x/dev-utils": "^1.0.24",
|
"@0x/dev-utils": "^1.0.24",
|
||||||
"@0x/sol-compiler": "^2.0.2",
|
"@0x/sol-compiler": "^2.0.2",
|
||||||
"@0x/subproviders": "^2.1.11",
|
|
||||||
"@0x/tslint-config": "^2.0.2",
|
"@0x/tslint-config": "^2.0.2",
|
||||||
"@types/bn.js": "^4.11.0",
|
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/yargs": "^10.0.0",
|
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
"chai-as-promised": "^7.1.0",
|
"chai-as-promised": "^7.1.0",
|
||||||
"chai-bignumber": "^3.0.0",
|
"chai-bignumber": "^3.0.0",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"ethereumjs-abi": "0.6.5",
|
|
||||||
"make-promises-safe": "^1.1.0",
|
"make-promises-safe": "^1.1.0",
|
||||||
"mocha": "^4.1.0",
|
"mocha": "^4.1.0",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
"solhint": "^1.4.1",
|
"solhint": "^1.4.1",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1"
|
||||||
"yargs": "^10.0.3"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^3.0.13",
|
"@0x/base-contract": "^3.0.13",
|
||||||
"@0x/contracts-interfaces": "^1.0.6",
|
"@0x/contracts-exchange-libs": "^1.0.0",
|
||||||
"@0x/contracts-libs": "^1.0.6",
|
"@0x/contracts-utils": "^3.0.0",
|
||||||
"@0x/contracts-multisig": "^1.0.6",
|
|
||||||
"@0x/contracts-utils": "^1.0.6",
|
|
||||||
"@0x/order-utils": "^3.1.2",
|
|
||||||
"@0x/types": "^1.5.2",
|
"@0x/types": "^1.5.2",
|
||||||
"@0x/typescript-typings": "^3.0.8",
|
"@0x/typescript-typings": "^3.0.8",
|
||||||
"@0x/utils": "^3.0.1",
|
"@0x/utils": "^3.0.1",
|
||||||
"@0x/web3-wrapper": "^3.2.4",
|
"@0x/web3-wrapper": "^3.2.4",
|
||||||
"@types/js-combinatorics": "^0.5.29",
|
|
||||||
"bn.js": "^4.11.8",
|
|
||||||
"ethereum-types": "^1.1.6",
|
"ethereum-types": "^1.1.6",
|
||||||
"ethereumjs-util": "^5.1.1",
|
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
@@ -1,24 +1,14 @@
|
|||||||
import { ContractArtifact } from 'ethereum-types';
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json';
|
import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json';
|
||||||
import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
|
|
||||||
import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
|
|
||||||
import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json';
|
import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json';
|
||||||
import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json';
|
import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json';
|
||||||
import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
|
import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
|
||||||
import * as ERC20Token_v1 from '../../generated-artifacts/ERC20Token_v1.json';
|
|
||||||
import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
|
|
||||||
import * as IERC20Token from '../../generated-artifacts/IERC20Token.json';
|
import * as IERC20Token from '../../generated-artifacts/IERC20Token.json';
|
||||||
import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
|
|
||||||
import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
|
|
||||||
import * as IEtherToken from '../../generated-artifacts/IEtherToken.json';
|
import * as IEtherToken from '../../generated-artifacts/IEtherToken.json';
|
||||||
import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
|
|
||||||
import * as MintableERC20Token from '../../generated-artifacts/MintableERC20Token.json';
|
import * as MintableERC20Token from '../../generated-artifacts/MintableERC20Token.json';
|
||||||
import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
|
|
||||||
import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
|
import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
|
||||||
import * as Token_v1 from '../../generated-artifacts/Token_v1.json';
|
|
||||||
import * as UnlimitedAllowanceERC20Token from '../../generated-artifacts/UnlimitedAllowanceERC20Token.json';
|
import * as UnlimitedAllowanceERC20Token from '../../generated-artifacts/UnlimitedAllowanceERC20Token.json';
|
||||||
import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/UnlimitedAllowanceToken_v1.json';
|
|
||||||
import * as WETH9 from '../../generated-artifacts/WETH9.json';
|
import * as WETH9 from '../../generated-artifacts/WETH9.json';
|
||||||
import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
|
import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
|
||||||
|
|
||||||
@@ -27,23 +17,13 @@ export const artifacts = {
|
|||||||
DummyERC20Token: DummyERC20Token as ContractArtifact,
|
DummyERC20Token: DummyERC20Token as ContractArtifact,
|
||||||
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
|
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
|
||||||
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
|
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
|
||||||
DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
|
|
||||||
InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
|
|
||||||
DummyERC721Token: DummyERC721Token as ContractArtifact,
|
|
||||||
ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
|
ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
|
||||||
ERC20Token: ERC20Token as ContractArtifact,
|
ERC20Token: ERC20Token as ContractArtifact,
|
||||||
IERC20Token: IERC20Token as ContractArtifact,
|
IERC20Token: IERC20Token as ContractArtifact,
|
||||||
MintableERC20Token: MintableERC20Token as ContractArtifact,
|
MintableERC20Token: MintableERC20Token as ContractArtifact,
|
||||||
UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
|
UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
|
||||||
ERC721Token: ERC721Token as ContractArtifact,
|
|
||||||
IERC721Receiver: IERC721Receiver as ContractArtifact,
|
|
||||||
IERC721Token: IERC721Token as ContractArtifact,
|
|
||||||
MintableERC721Token: MintableERC721Token as ContractArtifact,
|
|
||||||
IEtherToken: IEtherToken as ContractArtifact,
|
IEtherToken: IEtherToken as ContractArtifact,
|
||||||
WETH9: WETH9 as ContractArtifact,
|
WETH9: WETH9 as ContractArtifact,
|
||||||
ERC20Token_v1: ERC20Token_v1 as ContractArtifact,
|
|
||||||
Token_v1: Token_v1 as ContractArtifact,
|
|
||||||
UnlimitedAllowanceToken_v1: UnlimitedAllowanceToken_v1 as ContractArtifact,
|
|
||||||
// Note(albrow): "as any" hack still required here because ZRXToken does not
|
// Note(albrow): "as any" hack still required here because ZRXToken does not
|
||||||
// conform to the v2 artifact type.
|
// conform to the v2 artifact type.
|
||||||
ZRXToken: (ZRXToken as any) as ContractArtifact,
|
ZRXToken: (ZRXToken as any) as ContractArtifact,
|
@@ -1,21 +1,11 @@
|
|||||||
export * from '../../generated-wrappers/zrx_token';
|
export * from '../../generated-wrappers/zrx_token';
|
||||||
export * from '../../generated-wrappers/weth9';
|
export * from '../../generated-wrappers/weth9';
|
||||||
export * from '../../generated-wrappers/unlimitedallowancetoken_v1';
|
|
||||||
export * from '../../generated-wrappers/unlimited_allowance_erc20_token';
|
export * from '../../generated-wrappers/unlimited_allowance_erc20_token';
|
||||||
export * from '../../generated-wrappers/token_v1';
|
|
||||||
export * from '../../generated-wrappers/reentrant_erc20_token';
|
export * from '../../generated-wrappers/reentrant_erc20_token';
|
||||||
export * from '../../generated-wrappers/mintable_erc721_token';
|
|
||||||
export * from '../../generated-wrappers/mintable_erc20_token';
|
export * from '../../generated-wrappers/mintable_erc20_token';
|
||||||
export * from '../../generated-wrappers/invalid_erc721_receiver';
|
|
||||||
export * from '../../generated-wrappers/i_ether_token';
|
export * from '../../generated-wrappers/i_ether_token';
|
||||||
export * from '../../generated-wrappers/i_erc721_token';
|
|
||||||
export * from '../../generated-wrappers/i_erc721_receiver';
|
|
||||||
export * from '../../generated-wrappers/i_erc20_token';
|
export * from '../../generated-wrappers/i_erc20_token';
|
||||||
export * from '../../generated-wrappers/erc721_token';
|
|
||||||
export * from '../../generated-wrappers/erc20token_v1';
|
|
||||||
export * from '../../generated-wrappers/erc20_token';
|
export * from '../../generated-wrappers/erc20_token';
|
||||||
export * from '../../generated-wrappers/dummy_no_return_erc20_token';
|
export * from '../../generated-wrappers/dummy_no_return_erc20_token';
|
||||||
export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
|
export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
|
||||||
export * from '../../generated-wrappers/dummy_erc721_token';
|
|
||||||
export * from '../../generated-wrappers/dummy_erc721_receiver';
|
|
||||||
export * from '../../generated-wrappers/dummy_erc20_token';
|
export * from '../../generated-wrappers/dummy_erc20_token';
|
@@ -10,23 +10,13 @@
|
|||||||
"./generated-artifacts/DummyERC20Token.json",
|
"./generated-artifacts/DummyERC20Token.json",
|
||||||
"./generated-artifacts/DummyMultipleReturnERC20Token.json",
|
"./generated-artifacts/DummyMultipleReturnERC20Token.json",
|
||||||
"./generated-artifacts/DummyNoReturnERC20Token.json",
|
"./generated-artifacts/DummyNoReturnERC20Token.json",
|
||||||
"./generated-artifacts/DummyERC721Receiver.json",
|
|
||||||
"./generated-artifacts/InvalidERC721Receiver.json",
|
|
||||||
"./generated-artifacts/DummyERC721Token.json",
|
|
||||||
"./generated-artifacts/ReentrantERC20Token.json",
|
"./generated-artifacts/ReentrantERC20Token.json",
|
||||||
"./generated-artifacts/ERC20Token.json",
|
"./generated-artifacts/ERC20Token.json",
|
||||||
"./generated-artifacts/IERC20Token.json",
|
"./generated-artifacts/IERC20Token.json",
|
||||||
"./generated-artifacts/MintableERC20Token.json",
|
"./generated-artifacts/MintableERC20Token.json",
|
||||||
"./generated-artifacts/UnlimitedAllowanceERC20Token.json",
|
"./generated-artifacts/UnlimitedAllowanceERC20Token.json",
|
||||||
"./generated-artifacts/ERC721Token.json",
|
|
||||||
"./generated-artifacts/IERC721Receiver.json",
|
|
||||||
"./generated-artifacts/IERC721Token.json",
|
|
||||||
"./generated-artifacts/MintableERC721Token.json",
|
|
||||||
"./generated-artifacts/IEtherToken.json",
|
"./generated-artifacts/IEtherToken.json",
|
||||||
"./generated-artifacts/WETH9.json",
|
"./generated-artifacts/WETH9.json",
|
||||||
"./generated-artifacts/ERC20Token_v1.json",
|
|
||||||
"./generated-artifacts/Token_v1.json",
|
|
||||||
"./generated-artifacts/UnlimitedAllowanceToken_v1.json",
|
|
||||||
"./generated-artifacts/ZRXToken.json"
|
"./generated-artifacts/ZRXToken.json"
|
||||||
],
|
],
|
||||||
"exclude": ["./deploy/solc/solc_bin"]
|
"exclude": ["./deploy/solc/solc_bin"]
|
11
contracts/erc721/CHANGELOG.json
Normal file
11
contracts/erc721/CHANGELOG.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Move all ERC721 contracts out of contracts-tokens to new package",
|
||||||
|
"pr": 1539
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
1
contracts/erc721/DEPLOYS.json
Normal file
1
contracts/erc721/DEPLOYS.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[]
|
@@ -1,15 +1,18 @@
|
|||||||
## Contracts libs
|
## ERC721 Tokens
|
||||||
|
|
||||||
Smart contracts libs used in the 0x protocol.
|
This package contains implementations of various [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) tokens. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
|
||||||
|
|
||||||
## Usage
|
## Installation
|
||||||
|
|
||||||
Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
**Install**
|
||||||
|
|
||||||
- [libs](./contracts/protocol)
|
```bash
|
||||||
- This directory contains the libs.
|
npm install @0x/contracts-erc721 --save
|
||||||
- [test](./contracts/test)
|
```
|
||||||
- This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
|
|
||||||
|
## Bug bounty
|
||||||
|
|
||||||
|
A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
@@ -38,13 +41,13 @@ yarn install
|
|||||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-libs yarn build
|
PKG=@0x/contracts-erc721 yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Or continuously rebuild on change:
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-libs yarn watch
|
PKG=@0x/contracts-erc721 yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
30
contracts/erc721/compiler.json
Normal file
30
contracts/erc721/compiler.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"artifactsDir": "./generated-artifacts",
|
||||||
|
"contractsDir": "./contracts",
|
||||||
|
"compilerSettings": {
|
||||||
|
"optimizer": {
|
||||||
|
"enabled": true,
|
||||||
|
"runs": 1000000
|
||||||
|
},
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"*": [
|
||||||
|
"abi",
|
||||||
|
"evm.bytecode.object",
|
||||||
|
"evm.bytecode.sourceMap",
|
||||||
|
"evm.deployedBytecode.object",
|
||||||
|
"evm.deployedBytecode.sourceMap"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contracts": [
|
||||||
|
"DummyERC721Receiver",
|
||||||
|
"InvalidERC721Receiver",
|
||||||
|
"DummyERC721Token",
|
||||||
|
"ERC721Token",
|
||||||
|
"IERC721Receiver",
|
||||||
|
"IERC721Token",
|
||||||
|
"MintableERC721Token"
|
||||||
|
]
|
||||||
|
}
|
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "./IERC721Token.sol";
|
import "./interfaces/IERC721Token.sol";
|
||||||
import "./IERC721Receiver.sol";
|
import "./interfaces/IERC721Receiver.sol";
|
||||||
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC721Token is
|
contract ERC721Token is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../tokens/ERC721Token/IERC721Receiver.sol";
|
import "../src/interfaces/IERC721Receiver.sol";
|
||||||
|
|
||||||
|
|
||||||
contract DummyERC721Receiver is
|
contract DummyERC721Receiver is
|
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../tokens/ERC721Token/MintableERC721Token.sol";
|
import "../src/MintableERC721Token.sol";
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
|
|
||||||
|
|
||||||
// solhint-disable no-empty-blocks
|
// solhint-disable no-empty-blocks
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../tokens/ERC721Token/IERC721Receiver.sol";
|
import "../src/interfaces/IERC721Receiver.sol";
|
||||||
|
|
||||||
|
|
||||||
contract InvalidERC721Receiver is
|
contract InvalidERC721Receiver is
|
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-examples",
|
"name": "@0x/contracts-erc721",
|
||||||
"version": "1.0.6",
|
"version": "1.0.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
"description": "Smart contract examples of 0x protocol",
|
"description": "Token contracts used by 0x protocol",
|
||||||
"main": "lib/src/index.js",
|
"main": "lib/src/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
@@ -13,15 +13,26 @@
|
|||||||
"build": "yarn pre_build && tsc -b",
|
"build": "yarn pre_build && tsc -b",
|
||||||
"build:ci": "yarn build",
|
"build:ci": "yarn build",
|
||||||
"pre_build": "run-s compile generate_contract_wrappers",
|
"pre_build": "run-s compile generate_contract_wrappers",
|
||||||
|
"test": "yarn run_mocha",
|
||||||
|
"rebuild_and_test": "run-s build test",
|
||||||
|
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||||
|
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||||
|
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||||
|
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||||
"compile": "sol-compiler",
|
"compile": "sol-compiler",
|
||||||
"watch": "sol-compiler -w",
|
"watch": "sol-compiler -w",
|
||||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||||
|
"coverage:report:text": "istanbul report text",
|
||||||
|
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||||
|
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||||
|
"coverage:report:lcov": "istanbul report lcov",
|
||||||
|
"test:circleci": "yarn test",
|
||||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json"
|
"abis": "generated-artifacts/@(DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token).json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -31,48 +42,35 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
|
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^1.0.22",
|
"@0x/abi-gen": "^1.0.22",
|
||||||
"@0x/contracts-test-utils": "^2.0.1",
|
"@0x/contracts-test-utils": "^2.0.1",
|
||||||
"@0x/dev-utils": "^1.0.24",
|
"@0x/dev-utils": "^1.0.24",
|
||||||
"@0x/sol-compiler": "^2.0.2",
|
"@0x/sol-compiler": "^2.0.2",
|
||||||
"@0x/subproviders": "^2.1.11",
|
|
||||||
"@0x/tslint-config": "^2.0.2",
|
"@0x/tslint-config": "^2.0.2",
|
||||||
"@types/bn.js": "^4.11.0",
|
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/yargs": "^10.0.0",
|
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
"chai-as-promised": "^7.1.0",
|
"chai-as-promised": "^7.1.0",
|
||||||
"chai-bignumber": "^3.0.0",
|
"chai-bignumber": "^3.0.0",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"ethereumjs-abi": "0.6.5",
|
|
||||||
"make-promises-safe": "^1.1.0",
|
"make-promises-safe": "^1.1.0",
|
||||||
"mocha": "^4.1.0",
|
"mocha": "^4.1.0",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
"solhint": "^1.4.1",
|
"solhint": "^1.4.1",
|
||||||
"tslint": "5.11.0",
|
"tslint": "5.11.0",
|
||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1"
|
||||||
"yargs": "^10.0.3"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^3.0.13",
|
"@0x/base-contract": "^3.0.13",
|
||||||
"@0x/contracts-interfaces": "^1.0.6",
|
"@0x/contracts-utils": "^3.0.0",
|
||||||
"@0x/contracts-libs": "^1.0.6",
|
|
||||||
"@0x/contracts-multisig": "^1.0.6",
|
|
||||||
"@0x/contracts-tokens": "^1.0.6",
|
|
||||||
"@0x/contracts-utils": "^1.0.6",
|
|
||||||
"@0x/order-utils": "^3.1.2",
|
|
||||||
"@0x/types": "^1.5.2",
|
"@0x/types": "^1.5.2",
|
||||||
"@0x/typescript-typings": "^3.0.8",
|
"@0x/typescript-typings": "^3.0.8",
|
||||||
"@0x/utils": "^3.0.1",
|
"@0x/utils": "^3.0.1",
|
||||||
"@0x/web3-wrapper": "^3.2.4",
|
"@0x/web3-wrapper": "^3.2.4",
|
||||||
"@types/js-combinatorics": "^0.5.29",
|
|
||||||
"bn.js": "^4.11.8",
|
|
||||||
"ethereum-types": "^1.1.6",
|
"ethereum-types": "^1.1.6",
|
||||||
"ethereumjs-util": "^5.1.1",
|
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
20
contracts/erc721/src/artifacts/index.ts
Normal file
20
contracts/erc721/src/artifacts/index.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
|
import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
|
||||||
|
import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
|
||||||
|
import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
|
||||||
|
import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
|
||||||
|
import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
|
||||||
|
import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
|
||||||
|
import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
|
||||||
|
|
||||||
|
// tslint:disable:no-unnecessary-type-assertion
|
||||||
|
export const artifacts = {
|
||||||
|
DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
|
||||||
|
InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
|
||||||
|
DummyERC721Token: DummyERC721Token as ContractArtifact,
|
||||||
|
ERC721Token: ERC721Token as ContractArtifact,
|
||||||
|
IERC721Receiver: IERC721Receiver as ContractArtifact,
|
||||||
|
IERC721Token: IERC721Token as ContractArtifact,
|
||||||
|
MintableERC721Token: MintableERC721Token as ContractArtifact,
|
||||||
|
};
|
@@ -1,2 +1,2 @@
|
|||||||
export * from './artifacts';
|
|
||||||
export * from './wrappers';
|
export * from './wrappers';
|
||||||
|
export * from './artifacts';
|
7
contracts/erc721/src/wrappers/index.ts
Normal file
7
contracts/erc721/src/wrappers/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export * from '../../generated-wrappers/mintable_erc721_token';
|
||||||
|
export * from '../../generated-wrappers/invalid_erc721_receiver';
|
||||||
|
export * from '../../generated-wrappers/i_erc721_token';
|
||||||
|
export * from '../../generated-wrappers/i_erc721_receiver';
|
||||||
|
export * from '../../generated-wrappers/erc721_token';
|
||||||
|
export * from '../../generated-wrappers/dummy_erc721_token';
|
||||||
|
export * from '../../generated-wrappers/dummy_erc721_receiver';
|
19
contracts/erc721/tsconfig.json
Normal file
19
contracts/erc721/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": ".",
|
||||||
|
"resolveJsonModule": true
|
||||||
|
},
|
||||||
|
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||||
|
"files": [
|
||||||
|
"./generated-artifacts/DummyERC721Receiver.json",
|
||||||
|
"./generated-artifacts/InvalidERC721Receiver.json",
|
||||||
|
"./generated-artifacts/DummyERC721Token.json",
|
||||||
|
"./generated-artifacts/ERC721Token.json",
|
||||||
|
"./generated-artifacts/IERC721Receiver.json",
|
||||||
|
"./generated-artifacts/IERC721Token.json",
|
||||||
|
"./generated-artifacts/MintableERC721Token.json"
|
||||||
|
],
|
||||||
|
"exclude": ["./deploy/solc/solc_bin"]
|
||||||
|
}
|
@@ -1,56 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Upgrade the bignumber.js to v8.0.2",
|
|
||||||
"pr": 1517
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"timestamp": 1547747677,
|
|
||||||
"version": "1.0.6",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Dependencies updated"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"timestamp": 1547561734,
|
|
||||||
"version": "1.0.5",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Dependencies updated"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"timestamp": 1547225310,
|
|
||||||
"version": "1.0.4",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Dependencies updated"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"timestamp": 1547040760,
|
|
||||||
"version": "1.0.3",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Dependencies updated"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"timestamp": 1544741676,
|
|
||||||
"version": "1.0.2",
|
|
||||||
"changes": [
|
|
||||||
{
|
|
||||||
"note": "Dependencies updated"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
@@ -1,13 +0,0 @@
|
|||||||
import { ContractArtifact } from 'ethereum-types';
|
|
||||||
|
|
||||||
import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
|
|
||||||
import * as Validator from '../../generated-artifacts/Validator.json';
|
|
||||||
import * as Wallet from '../../generated-artifacts/Wallet.json';
|
|
||||||
import * as Whitelist from '../../generated-artifacts/Whitelist.json';
|
|
||||||
|
|
||||||
export const artifacts = {
|
|
||||||
ExchangeWrapper: ExchangeWrapper as ContractArtifact,
|
|
||||||
Validator: Validator as ContractArtifact,
|
|
||||||
Wallet: Wallet as ContractArtifact,
|
|
||||||
Whitelist: Whitelist as ContractArtifact,
|
|
||||||
};
|
|
@@ -1,4 +0,0 @@
|
|||||||
export * from '../../generated-wrappers/exchange_wrapper';
|
|
||||||
export * from '../../generated-wrappers/validator';
|
|
||||||
export * from '../../generated-wrappers/wallet';
|
|
||||||
export * from '../../generated-wrappers/whitelist';
|
|
11
contracts/exchange-forwarder/CHANGELOG.json
Normal file
11
contracts/exchange-forwarder/CHANGELOG.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Move Forwarder contract out of contracts-extensions into new package",
|
||||||
|
"pr": 1539
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@@ -5,21 +5,27 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
## v1.0.6 - _January 17, 2019_
|
## v1.2.3 - _January 17, 2019_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.5 - _January 15, 2019_
|
## v1.2.2 - _January 15, 2019_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.4 - _January 11, 2019_
|
## v1.2.1 - _January 11, 2019_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.3 - _January 9, 2019_
|
## v1.2.0 - _January 9, 2019_
|
||||||
|
|
||||||
* Dependencies updated
|
* Added Dutch Auction Wrapper (#1465)
|
||||||
|
|
||||||
|
## v1.1.0 - _Invalid date_
|
||||||
|
|
||||||
|
* Added Balance Threshold Filter (#1383)
|
||||||
|
* Add OrderMatcher (#1117)
|
||||||
|
* Add OrderValidator (#1464)
|
||||||
|
|
||||||
## v1.0.2 - _December 13, 2018_
|
## v1.0.2 - _December 13, 2018_
|
||||||
|
|
32
contracts/exchange-forwarder/DEPLOYS.json
Normal file
32
contracts/exchange-forwarder/DEPLOYS.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Forwarder",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Round up when calculating remaining amounts in marketBuy functions",
|
||||||
|
"pr": 1162,
|
||||||
|
"networks": {
|
||||||
|
"1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
|
||||||
|
"3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
|
||||||
|
"4": "0xd2dbf3250a764eaaa94fa0c84ed87c0edc8ed04e",
|
||||||
|
"42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Forwarder",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "protocol v2 deploy",
|
||||||
|
"networks": {
|
||||||
|
"1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
|
||||||
|
"3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
|
||||||
|
"42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@@ -1,15 +1,14 @@
|
|||||||
## Token contracts
|
## Exchange Forwarder
|
||||||
|
|
||||||
Token smart contracts that are used in the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
|
This package contains the implementation of the [`Forwarder`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract. This contract is intended to improve the UX of interacting with the 0x [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract by abstracting user approvals, converting ETH to WETH, and paying fees. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
|
||||||
|
|
||||||
## Usage
|
## Installation
|
||||||
|
|
||||||
Token contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
**Install**
|
||||||
|
|
||||||
- [tokens](./contracts/tokens)
|
```bash
|
||||||
- This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
|
npm install @0x/contracts-exchange-forwarder --save
|
||||||
- [test](./contracts/test)
|
```
|
||||||
- This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
|
|
||||||
|
|
||||||
## Bug bounty
|
## Bug bounty
|
||||||
|
|
||||||
@@ -42,13 +41,13 @@ yarn install
|
|||||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-tokens yarn build
|
PKG=@0x/contracts-exchange-forwarder yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Or continuously rebuild on change:
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/contracts-tokens yarn watch
|
PKG=@0x/contracts-exchange-forwarder yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
@@ -18,5 +18,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"]
|
"contracts": ["Forwarder"]
|
||||||
}
|
}
|
@@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/src/Ownable.sol";
|
||||||
import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
|
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
|
||||||
import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
|
import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./mixins/MAssets.sol";
|
import "./mixins/MAssets.sol";
|
||||||
|
|
@@ -21,10 +21,10 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./mixins/MExchangeWrapper.sol";
|
import "./mixins/MExchangeWrapper.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibAbiEncoder.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinExchangeWrapper is
|
contract MixinExchangeWrapper is
|
@@ -24,10 +24,10 @@ import "./mixins/MWeth.sol";
|
|||||||
import "./mixins/MAssets.sol";
|
import "./mixins/MAssets.sol";
|
||||||
import "./mixins/MExchangeWrapper.sol";
|
import "./mixins/MExchangeWrapper.sol";
|
||||||
import "./interfaces/IForwarderCore.sol";
|
import "./interfaces/IForwarderCore.sol";
|
||||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinForwarderCore is
|
contract MixinForwarderCore is
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./mixins/MWeth.sol";
|
import "./mixins/MWeth.sol";
|
||||||
|
|
@@ -19,8 +19,8 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IForwarderCore {
|
contract IForwarderCore {
|
@@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
|
||||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
|
||||||
import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
|
import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol";
|
||||||
import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
|
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
contract LibConstants {
|
contract LibConstants {
|
@@ -19,8 +19,8 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MExchangeWrapper {
|
contract MExchangeWrapper {
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user