diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-10 02:08:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 02:08:28 +0800 |
commit | 4b60a3cbab3a97125499cb89d9c253deebfb7d2d (patch) | |
tree | 3cd745f49d55406e95453bf3efac6383fba5f038 | |
parent | 9f08916cf18ad3e2686811933116122eea0890b9 (diff) | |
parent | 17956efe351e3ec0b1e9cdeee8292ebb0b4e563c (diff) | |
download | dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.gz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.bz2 dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.lz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.xz dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.tar.zst dexon-sol-tools-4b60a3cbab3a97125499cb89d9c253deebfb7d2d.zip |
Merge branch 'v2-prototype' into abi-gen-ignore-unchanged
341 files changed, 2860 insertions, 1152 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 39c3239eb..ff55ac4c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,6 +21,18 @@ If you're adding a new public function/member, make sure you document it with Ja If the sub-package you are modifying has a `CHANGELOG.md` file, make sure to add an entry in it for the change made to the package. For published packages, only changes that modify the public interface or behavior of the package need a CHANGELOG entry. +#### Enabling code coverage checks on your fork + +If you simply fork the repo and then create a PR sourced from it, your PR will fail its test coverage check. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for 0xProject/0x-monorepo, but when running the check against your fork the token needs to match the repo that is your fork, rather than the 0x repo. + +To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following: + +1. Log in to [coveralls.io](https://coveralls.io/), go to Add Repos, and enable your fork. Then go to the settings for that repo, and copy the Repo Token identifier. +2. Log in to [CircleCI](https://circleci.com/login), go to Add Projects, click the Set Up Project button corresponding to your fork, and then click Start Building. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-monorepo, so you can ignore all of the instruction/explanation given on the page with the Start Building button.) +3. In CircleCI, configure your project to add an Environment Variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the Repo Token you copied in step 1. + +Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper Repo Token, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance. + ### Styleguide We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) to keep our code style consistent. diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 04439921e..b39079ff2 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.38.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.38.4", "changes": [ diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 3c7c76662..00048f610 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.38.5 - _July 9, 2018_ + + * Dependencies updated + ## v0.38.4 - _June 19, 2018_ * Dependencies updated diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 1b41a7cf2..226452dbe 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "0.38.4", + "version": "0.38.5", "engines": { "node": ">=6.12" }, @@ -69,12 +69,12 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/migrations": "^0.0.8", - "@0xproject/monorepo-scripts": "^0.2.1", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/migrations": "^0.0.9", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/tslint-config": "^0.4.20", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -100,17 +100,16 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.2.12", - "@0xproject/base-contract": "^0.3.4", + "@0xproject/assert": "^0.2.13", + "@0xproject/base-contract": "^0.3.5", "@0xproject/contract-wrappers": "^0.0.5", - "@0xproject/order-utils": "^0.0.7", - "@0xproject/order-watcher": "^0.0.6", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", - "ethereum-types": "^0.0.2", + "@0xproject/order-utils": "^0.0.8", + "@0xproject/order-watcher": "^0.0.7", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/types": "^0.8.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "ethers": "3.0.22", "lodash": "^4.17.4" }, diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 78aa8a6b4..ef8f5dd39 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -22,6 +22,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.3.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.3.2", "changes": [ diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 5167af522..33bc3276a 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.3.3 - _July 9, 2018_ + + * Dependencies updated + ## v0.3.2 - _June 19, 2018_ * Dependencies updated diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index b85b20d19..4fb335545 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "0.3.2", + "version": "0.3.3", "engines": { "node": ">=6.12" }, @@ -32,8 +32,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "ethereum-types": "^0.0.2", "chalk": "^2.3.0", "ethereum-types": "^0.0.2", "glob": "^7.1.2", @@ -46,9 +47,9 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", - "@types/glob": "^5.0.33", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", + "@types/glob": "5.0.35", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", "@types/node": "^8.0.53", diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index b44cac4a1..1ddc6d280 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "0.2.13", + "version": "0.2.14", "changes": [ { "note": @@ -10,6 +10,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.2.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.2.12", "changes": [ diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index 98a83e81b..f0d2f55b0 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.2.13 - _July 9, 2018_ + + * Dependencies updated + ## v0.2.12 - _June 19, 2018_ * Dependencies updated diff --git a/packages/assert/package.json b/packages/assert/package.json index c24f73c4b..3b9ecbb49 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -31,8 +31,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", @@ -49,8 +49,8 @@ }, "dependencies": { "@0xproject/json-schemas": "^1.0.0", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", "lodash": "^4.17.4", "valid-url": "^1.0.9" }, diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index e5788b867..400489afa 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.3.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "version": "0.3.4", "changes": [ { diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index a37a08584..ad73a1863 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.3.5 - _July 9, 2018_ + + * Dependencies updated + ## v0.3.4 - _June 19, 2018_ * Update EthersJs to fix the `value.toLowerCase()` is not a function bug caused by `ethers.js` breaking patch version https://github.com/ethers-io/ethers.js/issues/201 diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 3b9383033..afde81561 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "0.3.4", + "version": "0.3.5", "engines": { "node": ">=6.12" }, @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "chai": "^4.0.1", "copyfiles": "^1.2.0", @@ -44,9 +44,9 @@ }, "dependencies": { "ethereum-types": "^0.0.2", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "ethers": "3.0.22", "lodash": "^4.17.4" }, diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 9bbb107cb..c426f974b 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.6.16", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.6.15", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 1c44c2a60..5ae4cfbe3 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.6.16 - _July 9, 2018_ + + * Dependencies updated + ## v0.6.15 - _June 19, 2018_ * Dependencies updated diff --git a/packages/connect/package.json b/packages/connect/package.json index 02b23408e..469d47d33 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "0.6.15", + "version": "0.6.16", "engines": { "node": ">=6.12" }, @@ -51,20 +51,20 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^0.2.12", - "@0xproject/json-schemas": "0.8.1", - "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/assert": "^0.2.13", + "@0xproject/json-schemas": "0.8.2", + "@0xproject/types": "^0.8.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", "query-string": "^5.0.1", "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", - "@types/fetch-mock": "^5.12.1", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", + "@types/fetch-mock": "^5.12.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/query-string": "^5.0.1", diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index bee5a4de9..24f722f15 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -9,7 +9,8 @@ "note": "Update to v2 of 0x rpotocol", "pr": 822 } - ] + ], + "timestamp": 1531149657 }, { "timestamp": 1529397769, diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 3f8eb921c..a2cc44f0d 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.1.0 - _July 9, 2018_ + + * Update Blockstream dep. to V5.0 and no longer force unsubscribe on blockstream error (which are not recoverable) + ## v0.0.5 - _June 19, 2018_ * Dependencies updated diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 8c65c8cca..b8fd8bd50 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/contract-wrappers", - "version": "0.0.6", + "version": "0.1.0", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -43,13 +43,13 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/migrations": "^0.0.8", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/subproviders": "^0.10.4", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/migrations": "^0.0.9", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -75,11 +75,11 @@ }, "dependencies": { "@0xproject/assert": "^0.3.0", - "@0xproject/base-contract": "^0.3.4", + "@0xproject/base-contract": "^0.3.5", "@0xproject/order-utils": "^1.0.0", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "@0xproject/fill-scenarios": "^1.0.0", "@0xproject/json-schemas": "^1.0.0", "@0xproject/types": "^1.0.0", diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts index 883d7c4d6..821d1a8a2 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts @@ -1,3 +1,4 @@ +import { AssetProxyId } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; @@ -23,9 +24,9 @@ export class ERC20ProxyWrapper extends ContractWrapper { * Get the 4 bytes ID of this asset proxy * @return Proxy id */ - public async getProxyIdAsync(): Promise<string> { + public async getProxyIdAsync(): Promise<AssetProxyId> { const ERC20ProxyContractInstance = await this._getERC20ProxyContractAsync(); - const proxyId = await ERC20ProxyContractInstance.getProxyId.callAsync(); + const proxyId = (await ERC20ProxyContractInstance.getProxyId.callAsync()) as AssetProxyId; return proxyId; } /** diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts index 648c150df..38ecd4687 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts @@ -1,3 +1,4 @@ +import { AssetProxyId } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; @@ -23,9 +24,9 @@ export class ERC721ProxyWrapper extends ContractWrapper { * Get the 4 bytes ID of this asset proxy * @return Proxy id */ - public async getProxyIdAsync(): Promise<string> { + public async getProxyIdAsync(): Promise<AssetProxyId> { const ERC721ProxyContractInstance = await this._getERC721ProxyContractAsync(); - const proxyId = await ERC721ProxyContractInstance.getProxyId.callAsync(); + const proxyId = (await ERC721ProxyContractInstance.getProxyId.callAsync()) as AssetProxyId; return proxyId; } /** diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index 0e8664cc9..8b7148aed 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -1,5 +1,5 @@ import { schemas } from '@0xproject/json-schemas'; -import { Order, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types'; @@ -9,7 +9,15 @@ import { artifacts } from '../artifacts'; import { methodOptsSchema } from '../schemas/method_opts_schema'; import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema'; import { txOptsSchema } from '../schemas/tx_opts_schema'; -import { BlockRange, EventCallback, IndexedFilterValues, MethodOpts, OrderInfo, OrderTransactionOpts } from '../types'; +import { + BlockRange, + EventCallback, + ExchangeWrapperError, + IndexedFilterValues, + MethodOpts, + OrderInfo, + OrderTransactionOpts, +} from '../types'; import { assert } from '../utils/assert'; import { decorators } from '../utils/decorators'; @@ -38,21 +46,17 @@ export class ExchangeWrapper extends ContractWrapper { } /** * Retrieve the address of an asset proxy by signature. - * @param proxySignature The 4 bytes signature of an asset proxy + * @param proxyId The 4 bytes signature of an asset proxy * @param methodOpts Optional arguments this method accepts. * @return The address of an asset proxy for a given signature */ - public async getAssetProxyBySignatureAsync(proxySignature: string, methodOpts: MethodOpts = {}): Promise<string> { - assert.isHexString('proxySignature', proxySignature); + public async getAssetProxyBySignatureAsync(proxyId: AssetProxyId, methodOpts: MethodOpts = {}): Promise<string> { + assert.doesBelongToStringEnum('proxyId', proxyId, AssetProxyId); assert.doesConformToSchema('methodOpts', methodOpts, methodOptsSchema); const exchangeContract = await this._getExchangeContractAsync(); const txData = {}; - const assetProxy = await exchangeContract.getAssetProxy.callAsync( - proxySignature, - txData, - methodOpts.defaultBlock, - ); + const assetProxy = await exchangeContract.getAssetProxy.callAsync(proxyId, txData, methodOpts.defaultBlock); return assetProxy; } /** @@ -143,7 +147,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrder: SignedOrder, takerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); @@ -152,6 +156,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedTakerAddress = takerAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.fillOrder.callAsync(signedOrder, takerAssetFillAmount, signedOrder.signature, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.fillOrder.sendTransactionAsync( signedOrder, @@ -179,7 +190,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrder: SignedOrder, takerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); @@ -188,7 +199,18 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedTakerAddress = takerAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); - + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.fillOrderNoThrow.callAsync( + signedOrder, + takerAssetFillAmount, + signedOrder.signature, + { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }, + ); + } const txHash = await exchangeInstance.fillOrderNoThrow.sendTransactionAsync( signedOrder, takerAssetFillAmount, @@ -216,7 +238,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrder: SignedOrder, takerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isValidBaseUnitAmount('takerAssetFillAmount', takerAssetFillAmount); @@ -225,7 +247,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedTakerAddress = takerAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); - + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.fillOrKillOrder.callAsync(signedOrder, takerAssetFillAmount, signedOrder.signature, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.fillOrKillOrder.sendTransactionAsync( signedOrder, takerAssetFillAmount, @@ -257,7 +285,7 @@ export class ExchangeWrapper extends ContractWrapper { data: string, signature: string, senderAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.isBigNumber('salt', salt); assert.isETHAddressHex('signerAddress', signerAddress); @@ -268,7 +296,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedSenderAddress = senderAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); - + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.executeTransaction.callAsync(salt, signerAddress, data, signature, { + from: normalizedSenderAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.executeTransaction.sendTransactionAsync( salt, signerAddress, @@ -296,7 +330,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], takerAssetFillAmounts: BigNumber[], takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); _.forEach(takerAssetFillAmounts, takerAssetFillAmount => @@ -308,6 +342,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.batchFillOrders.callAsync(signedOrders, takerAssetFillAmounts, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.batchFillOrders.sendTransactionAsync( signedOrders, takerAssetFillAmounts, @@ -334,7 +375,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], makerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -344,6 +385,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.marketBuyOrders.callAsync(signedOrders, makerAssetFillAmount, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.marketBuyOrders.sendTransactionAsync( signedOrders, makerAssetFillAmount, @@ -370,7 +418,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], takerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -380,6 +428,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.marketSellOrders.callAsync(signedOrders, takerAssetFillAmount, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.marketSellOrders.sendTransactionAsync( signedOrders, takerAssetFillAmount, @@ -406,7 +461,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], makerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -416,6 +471,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.marketBuyOrdersNoThrow.callAsync(signedOrders, makerAssetFillAmount, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.marketBuyOrdersNoThrow.sendTransactionAsync( signedOrders, makerAssetFillAmount, @@ -442,7 +504,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], takerAssetFillAmount: BigNumber, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -452,6 +514,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.marketSellOrdersNoThrow.callAsync(signedOrders, takerAssetFillAmount, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.marketSellOrdersNoThrow.sendTransactionAsync( signedOrders, takerAssetFillAmount, @@ -478,7 +547,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], takerAssetFillAmounts: BigNumber[], takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); _.forEach(takerAssetFillAmounts, takerAssetFillAmount => @@ -490,6 +559,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.batchFillOrdersNoThrow.callAsync(signedOrders, takerAssetFillAmounts, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.batchFillOrdersNoThrow.sendTransactionAsync( signedOrders, takerAssetFillAmounts, @@ -516,7 +592,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrders: SignedOrder[], takerAssetFillAmounts: BigNumber[], takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema); _.forEach(takerAssetFillAmounts, takerAssetFillAmount => @@ -528,6 +604,13 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); const signatures = _.map(signedOrders, signedOrder => signedOrder.signature); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.batchFillOrKillOrders.callAsync(signedOrders, takerAssetFillAmounts, signatures, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.batchFillOrKillOrders.sendTransactionAsync( signedOrders, takerAssetFillAmounts, @@ -549,7 +632,7 @@ export class ExchangeWrapper extends ContractWrapper { @decorators.asyncZeroExErrorHandler public async batchCancelOrdersAsync( orders: Array<Order | SignedOrder>, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('orders', orders, schemas.ordersSchema); assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); @@ -559,6 +642,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedMakerAddress = makerAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.batchCancelOrders.callAsync(orders, { + from: normalizedMakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.batchCancelOrders.sendTransactionAsync(orders, { from: normalizedMakerAddress, gas: orderTransactionOpts.gasLimit, @@ -581,17 +671,37 @@ export class ExchangeWrapper extends ContractWrapper { leftSignedOrder: SignedOrder, rightSignedOrder: SignedOrder, takerAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('leftSignedOrder', leftSignedOrder, schemas.signedOrderSchema); assert.doesConformToSchema('rightSignedOrder', rightSignedOrder, schemas.signedOrderSchema); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); const normalizedTakerAddress = takerAddress.toLowerCase(); - // TODO(logvinov): Check that: - // rightOrder.makerAssetData === leftOrder.takerAssetData; - // rightOrder.takerAssetData === leftOrder.makerAssetData; + if ( + rightSignedOrder.makerAssetData !== leftSignedOrder.takerAssetData || + rightSignedOrder.takerAssetData !== leftSignedOrder.makerAssetData + ) { + throw new Error(ExchangeWrapperError.AssetDataMismatch); + } else { + // Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data + rightSignedOrder.makerAssetData = '0x'; + rightSignedOrder.takerAssetData = '0x'; + } const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.matchOrders.callAsync( + leftSignedOrder, + rightSignedOrder, + leftSignedOrder.signature, + rightSignedOrder.signature, + { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }, + ); + } const txHash = await exchangeInstance.matchOrders.sendTransactionAsync( leftSignedOrder, rightSignedOrder, @@ -620,7 +730,7 @@ export class ExchangeWrapper extends ContractWrapper { signerAddress: string, signature: string, senderAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.isHexString('hash', hash); assert.isETHAddressHex('signerAddress', signerAddress); @@ -629,6 +739,13 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]); const normalizedTakerAddress = senderAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.preSign.callAsync(hash, signerAddress, signature, { + from: normalizedTakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.preSign.sendTransactionAsync(hash, signerAddress, signature, { from: normalizedTakerAddress, gas: orderTransactionOpts.gasLimit, @@ -769,7 +886,7 @@ export class ExchangeWrapper extends ContractWrapper { @decorators.asyncZeroExErrorHandler public async cancelOrderAsync( order: Order | SignedOrder, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.doesConformToSchema('order', order, schemas.orderSchema); await assert.isSenderAddressAsync('order.maker', order.makerAddress, this._web3Wrapper); @@ -777,6 +894,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedMakerAddress = order.makerAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.cancelOrder.callAsync(order, { + from: normalizedMakerAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.cancelOrder.sendTransactionAsync(order, { from: normalizedMakerAddress, gas: orderTransactionOpts.gasLimit, @@ -797,7 +921,7 @@ export class ExchangeWrapper extends ContractWrapper { validatorAddress: string, isApproved: boolean, senderAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.isETHAddressHex('validatorAddress', validatorAddress); assert.isBoolean('isApproved', isApproved); @@ -806,6 +930,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedSenderAddress = senderAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.setSignatureValidatorApproval.callAsync(validatorAddress, isApproved, { + from: normalizedSenderAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.setSignatureValidatorApproval.sendTransactionAsync( validatorAddress, isApproved, @@ -829,7 +960,7 @@ export class ExchangeWrapper extends ContractWrapper { public async cancelOrdersUpToAsync( targetOrderEpoch: BigNumber, senderAddress: string, - orderTransactionOpts: OrderTransactionOpts = {}, + orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true }, ): Promise<string> { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); await assert.isSenderAddressAsync('senderAddress', senderAddress, this._web3Wrapper); @@ -837,6 +968,13 @@ export class ExchangeWrapper extends ContractWrapper { const normalizedSenderAddress = senderAddress.toLowerCase(); const exchangeInstance = await this._getExchangeContractAsync(); + if (orderTransactionOpts.shouldValidate) { + await exchangeInstance.cancelOrdersUpTo.callAsync(targetOrderEpoch, { + from: normalizedSenderAddress, + gas: orderTransactionOpts.gasLimit, + gasPrice: orderTransactionOpts.gasPrice, + }); + } const txHash = await exchangeInstance.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, { from: normalizedSenderAddress, gas: orderTransactionOpts.gasLimit, diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 8d19d085f..f9d7a6b9f 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -8,6 +8,10 @@ import { ERC721TokenEventArgs, ERC721TokenEvents } from './contract_wrappers/gen import { ExchangeEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange'; import { WETH9EventArgs, WETH9Events } from './contract_wrappers/generated/weth9'; +export enum ExchangeWrapperError { + AssetDataMismatch = 'ASSET_DATA_MISMATCH', +} + export enum ContractWrappersError { ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST', ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST', @@ -31,8 +35,6 @@ export enum ContractWrappersError { export enum InternalContractWrappersError { NoAbiDecoder = 'NO_ABI_DECODER', - ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', - WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', } export type LogEvent = LogEntryEvent; diff --git a/packages/contract-wrappers/src/utils/constants.ts b/packages/contract-wrappers/src/utils/constants.ts index 76d805cac..039475b7f 100644 --- a/packages/contract-wrappers/src/utils/constants.ts +++ b/packages/contract-wrappers/src/utils/constants.ts @@ -4,6 +4,7 @@ export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', TESTRPC_NETWORK_ID: 50, INVALID_JUMP_PATTERN: 'invalid JUMP at', + REVERT: 'revert', OUT_OF_GAS_PATTERN: 'out of gas', INVALID_TAKER_FORMAT: 'instance.taker is not of a type(s) string', // tslint:disable-next-line:custom-no-magic-numbers diff --git a/packages/contract-wrappers/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts index ccb4c6e11..6e77450e8 100644 --- a/packages/contract-wrappers/src/utils/decorators.ts +++ b/packages/contract-wrappers/src/utils/decorators.ts @@ -1,3 +1,4 @@ +import { RevertReason } from '@0xproject/types'; import * as _ from 'lodash'; import { AsyncMethod, ContractWrappersError, SyncMethod } from '../types'; @@ -13,6 +14,10 @@ const contractCallErrorTransformer = (error: Error) => { if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) { return new Error(ContractWrappersError.OutOfGas); } + if (_.includes(error.message, constants.REVERT)) { + const revertReason = error.message.split(constants.REVERT)[1].trim(); + return new Error(revertReason); + } return error; }; diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index d0f74a2bc..0810c4d90 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -27,6 +27,7 @@ export enum {{contractName}}Events { {{/each}} {{/if}} +/* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class {{contractName}}Contract extends BaseContract { diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 35fbe3c85..fcaae57c6 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -1,4 +1,3 @@ -{{#hasReturnValue}} async callAsync( {{> typed_params inputs=inputs}} callData: Partial<CallData> = {}, @@ -27,4 +26,3 @@ async callAsync( resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}}; }, -{{/hasReturnValue}} diff --git a/packages/contracts/.solhint.json b/packages/contracts/.solhint.json index 7e3b4dca2..076afe9f3 100644 --- a/packages/contracts/.solhint.json +++ b/packages/contracts/.solhint.json @@ -1,17 +1,20 @@ { "extends": "default", "rules": { - "bracket-align": "warn", - "code-complexity": "warn", - "const-name-snakecase": "warn", - "expression-indent": "warn", - "function-max-lines": "warn", - "statement-indent": "warn", - "indent": ["warn", 4], + "avoid-low-level-calls": false, + "avoid-tx-origin": "warn", + "bracket-align": false, + "code-complexity": false, + "const-name-snakecase": "error", + "expression-indent": "error", + "function-max-lines": false, + "func-order": "error", + "indent": ["error", 4], + "max-line-length": ["warn", 160], + "no-inline-assembly": false, "quotes": ["error", "double"], - "max-line-length": ["warn", 120], - "separate-by-one-line-in-contract": "warn", + "separate-by-one-line-in-contract": "error", "space-after-comma": "error", - "func-order": "warn" + "statement-indent": "error" } } diff --git a/packages/contracts/package.json b/packages/contracts/package.json index a8bbdbe16..98b133e63 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.33", + "version": "2.1.34", "engines": { "node": ">=6.12" }, @@ -24,13 +24,13 @@ "compile": "sol-compiler --contracts-dir src", "clean": "shx rm -rf lib generated_contract_wrappers", "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", - "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/*", + "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --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 src/2.0.0/**/*.sol" + "lint-contracts": "solhint src/2.0.0/**/**/**/**/*.sol" }, "config": { "abis": "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|TestAssetProxyOwner|TestAssetProxyDispatcher|TestLibBytes|TestLibs|TestSignatureValidator|TestValidator|TestWallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/tslint-config": "^0.4.20", - "@0xproject/subproviders": "^0.10.1", - "@0xproject/sol-cov": "^0.1.1", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/tslint-config": "^0.4.21", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/sol-cov": "^0.1.2", "@types/lodash": "4.14.104", "@types/bn.js": "^4.11.0", "@types/node": "^8.0.53", @@ -72,13 +72,13 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^0.3.4", + "@0xproject/base-contract": "^0.3.5", "@0xproject/order-utils": "^1.0.0", - "@0xproject/sol-compiler": "^0.5.2", + "@0xproject/sol-compiler": "^0.5.3", "@0xproject/types": "^1.0.0", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "ethereum-types": "^0.0.2", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/contracts/src/2.0.0/forwarder/Forwarder.sol b/packages/contracts/src/2.0.0/forwarder/Forwarder.sol index 71a4aff13..fc17a4c72 100644 --- a/packages/contracts/src/2.0.0/forwarder/Forwarder.sol +++ b/packages/contracts/src/2.0.0/forwarder/Forwarder.sol @@ -16,24 +16,25 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; -import "./MixinWethFees.sol"; -import "./MixinMarketSellTokens.sol"; -import "./MixinMarketBuyTokens.sol"; +import "./MixinFees.sol"; +import "./MixinForwarderCore.sol"; import "./MixinConstants.sol"; -import "../utils/Ownable/Ownable.sol"; +import "./MixinMarketBuyZrx.sol"; +import "./MixinExpectedResults.sol"; +import "./MixinTransfer.sol"; + contract Forwarder is - Ownable, MixinConstants, - MixinWethFees, + MixinExpectedResults, + MixinFees, MixinMarketBuyZrx, - MixinMarketBuyTokens, - MixinMarketSellTokens + MixinTransfer, + MixinForwarderCore { - uint256 MAX_UINT = 2**256 - 1; constructor ( address _exchange, @@ -44,7 +45,6 @@ contract Forwarder is bytes memory _wethAssetData ) public - Ownable() MixinConstants( _exchange, _etherToken, @@ -52,30 +52,6 @@ contract Forwarder is _zrxAssetData, _wethAssetData ) - { - setERC20ProxyApproval(_erc20AssetProxyId); - } - - /// @dev Default payabale function, this allows us to withdraw WETH - function () - public - payable - { - require( - msg.sender == address(ETHER_TOKEN), - "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY" - ); - } - - /// @dev Sets the allowances to the proxy for this contract - function setERC20ProxyApproval(bytes4 erc20AssetProxyId) - public - onlyOwner - { - address proxyAddress = EXCHANGE.getAssetProxy(erc20AssetProxyId); - if (proxyAddress != address(0)) { - ETHER_TOKEN.approve(proxyAddress, MAX_UINT); - ZRX_TOKEN.approve(proxyAddress, MAX_UINT); - } - } + MixinForwarderCore() + {} } diff --git a/packages/contracts/src/2.0.0/forwarder/MixinConstants.sol b/packages/contracts/src/2.0.0/forwarder/MixinConstants.sol index 18f2ba3bc..2b064d579 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinConstants.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinConstants.sol @@ -16,19 +16,14 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; -import "../protocol/Exchange/Exchange.sol"; -import { WETH9 as EtherToken } from "../tokens/WETH9/WETH9.sol"; -import "../tokens/ERC20Token/IERC20Token.sol"; +import "./mixins/MConstants.sol"; -contract MixinConstants { - Exchange EXCHANGE; - EtherToken ETHER_TOKEN; - IERC20Token ZRX_TOKEN; - bytes ZRX_ASSET_DATA; - bytes WETH_ASSET_DATA; +contract MixinConstants is + MConstants +{ constructor ( address _exchange, @@ -39,11 +34,10 @@ contract MixinConstants { ) public { - EXCHANGE = Exchange(_exchange); - ETHER_TOKEN = EtherToken(_etherToken); + EXCHANGE = IExchange(_exchange); + ETHER_TOKEN = IEtherToken(_etherToken); ZRX_TOKEN = IERC20Token(_zrxToken); ZRX_ASSET_DATA = _zrxAssetData; WETH_ASSET_DATA = _wethAssetData; } - -}
\ No newline at end of file +} diff --git a/packages/contracts/src/2.0.0/forwarder/MixinERC721.sol b/packages/contracts/src/2.0.0/forwarder/MixinERC721.sol deleted file mode 100644 index b2e8803a9..000000000 --- a/packages/contracts/src/2.0.0/forwarder/MixinERC721.sol +++ /dev/null @@ -1,64 +0,0 @@ -/* - - 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.24; -pragma experimental ABIEncoderV2; - -import "../utils/LibBytes/LibBytes.sol"; -import "../tokens/ERC721Token/IERC721Token.sol"; - -contract MixinERC721 { - - using LibBytes for bytes; - bytes4 constant ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,uint256,bytes)")); - bytes4 constant ERC721_RECEIVED_OPERATOR = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); - - function onERC721Received(address, uint256, bytes memory) - public - pure - returns(bytes4) - { - return ERC721_RECEIVED; - } - - function onERC721Received(address, address, uint256, bytes memory) - public - pure - returns(bytes4) - { - return ERC721_RECEIVED_OPERATOR; - } - - function transferERC721Token( - bytes memory assetData, - address to - ) - internal - { - // Decode asset data. - address token = assetData.readAddress(16); - uint256 tokenId = assetData.readUint256(36); - bytes memory receiverData = assetData.readBytesWithLength(100); - IERC721Token(token).safeTransferFrom( - address(this), - to, - tokenId, - receiverData - ); - } -} diff --git a/packages/contracts/src/2.0.0/forwarder/MixinErrorMessages.sol b/packages/contracts/src/2.0.0/forwarder/MixinErrorMessages.sol index c2a6ea0a4..1b3e3f488 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinErrorMessages.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinErrorMessages.sol @@ -16,7 +16,9 @@ */ -pragma solidity ^0.4.24; +// solhint-disable +pragma solidity 0.4.24; + /// This contract is intended to serve as a reference, but is not actually used for efficiency reasons. contract MixinErrorMessages { diff --git a/packages/contracts/src/2.0.0/forwarder/MixinExpectedResults.sol b/packages/contracts/src/2.0.0/forwarder/MixinExpectedResults.sol index 0bca7dc80..a575c9675 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinExpectedResults.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinExpectedResults.sol @@ -16,106 +16,71 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../utils/LibBytes/LibBytes.sol"; import "../protocol/Exchange/libs/LibFillResults.sol"; import "../protocol/Exchange/libs/LibMath.sol"; import "../protocol/Exchange/libs/LibOrder.sol"; -import "./MixinConstants.sol"; +import "./mixins/MConstants.sol"; +import "./mixins/MExpectedResults.sol"; + contract MixinExpectedResults is LibMath, LibFillResults, - MixinConstants + MConstants, + MExpectedResults { - /// @dev Simulates the 0x Exchange fillOrder validation and calculations, without performing any state changes. - /// @param order An Order struct containing order specifications. - /// @param takerAssetFillAmount A number representing the amount of this order to fill. - /// @return fillResults Amounts filled and fees paid by maker and taker. - function calculateFillResults( - LibOrder.Order memory order, - uint256 takerAssetFillAmount - ) - internal - view - returns (FillResults memory fillResults) - { - LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(order); - if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) { - return fillResults; - } - uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount); - uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount); - - fillResults.takerAssetFilledAmount = takerAssetFilledAmount; - fillResults.makerAssetFilledAmount = getPartialAmount( - takerAssetFilledAmount, - order.takerAssetAmount, - order.makerAssetAmount - ); - fillResults.makerFeePaid = getPartialAmount( - takerAssetFilledAmount, - order.takerAssetAmount, - order.makerFee - ); - fillResults.takerFeePaid = getPartialAmount( - takerAssetFilledAmount, - order.takerAssetAmount, - order.takerFee - ); - return fillResults; - } - - /// @dev Calculates a FillResults total for selling takerAssetFillAmount over all orders. + /// @dev Calculates a total FillResults for buying makerAssetFillAmount over all orders. /// Including the fees required to be paid. /// @param orders An array of Order struct containing order specifications. - /// @param takerAssetFillAmount A number representing the amount of this order to fill. + /// @param makerAssetFillAmount A number representing the amount of this order to fill. /// @return totalFillResults Amounts filled and fees paid by maker and taker. - function calculateMarketSellResults( + function calculateMarketBuyResults( LibOrder.Order[] memory orders, - uint256 takerAssetFillAmount + uint256 makerAssetFillAmount ) - internal + public view returns (FillResults memory totalFillResults) { for (uint256 i = 0; i < orders.length; i++) { - uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount); + uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount); + uint256 remainingTakerAssetFillAmount = getPartialAmount( + orders[i].takerAssetAmount, + orders[i].makerAssetAmount, + remainingMakerAssetFillAmount + ); FillResults memory singleFillResult = calculateFillResults(orders[i], remainingTakerAssetFillAmount); addFillResults(totalFillResults, singleFillResult); - if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) { + if (totalFillResults.makerAssetFilledAmount == makerAssetFillAmount) { break; } } return totalFillResults; } - /// @dev Calculates a total FillResults for buying makerAssetFillAmount over all orders. + /// @dev Calculates a FillResults total for selling takerAssetFillAmount over all orders. /// Including the fees required to be paid. /// @param orders An array of Order struct containing order specifications. - /// @param makerAssetFillAmount A number representing the amount of this order to fill. + /// @param takerAssetFillAmount A number representing the amount of this order to fill. /// @return totalFillResults Amounts filled and fees paid by maker and taker. - function calculateMarketBuyResults( + function calculateMarketSellResults( LibOrder.Order[] memory orders, - uint256 makerAssetFillAmount + uint256 takerAssetFillAmount ) public view returns (FillResults memory totalFillResults) { for (uint256 i = 0; i < orders.length; i++) { - uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount); - uint256 remainingTakerAssetFillAmount = getPartialAmount( - orders[i].takerAssetAmount, - orders[i].makerAssetAmount, - remainingMakerAssetFillAmount - ); + uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount); FillResults memory singleFillResult = calculateFillResults(orders[i], remainingTakerAssetFillAmount); addFillResults(totalFillResults, singleFillResult); - if (totalFillResults.makerAssetFilledAmount == makerAssetFillAmount) { + if (totalFillResults.takerAssetFilledAmount == takerAssetFillAmount) { break; } } @@ -155,4 +120,42 @@ contract MixinExpectedResults is } return totalFillResults; } + + /// @dev Simulates the 0x Exchange fillOrder validation and calculations, without performing any state changes. + /// @param order An Order struct containing order specifications. + /// @param takerAssetFillAmount A number representing the amount of this order to fill. + /// @return fillResults Amounts filled and fees paid by maker and taker. + function calculateFillResults( + LibOrder.Order memory order, + uint256 takerAssetFillAmount + ) + internal + view + returns (FillResults memory fillResults) + { + LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(order); + if (orderInfo.orderStatus != uint8(LibOrder.OrderStatus.FILLABLE)) { + return fillResults; + } + uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount); + uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount); + + fillResults.takerAssetFilledAmount = takerAssetFilledAmount; + fillResults.makerAssetFilledAmount = getPartialAmount( + takerAssetFilledAmount, + order.takerAssetAmount, + order.makerAssetAmount + ); + fillResults.makerFeePaid = getPartialAmount( + takerAssetFilledAmount, + order.takerAssetAmount, + order.makerFee + ); + fillResults.takerFeePaid = getPartialAmount( + takerAssetFilledAmount, + order.takerAssetAmount, + order.takerFee + ); + return fillResults; + } } diff --git a/packages/contracts/src/2.0.0/forwarder/MixinWethFees.sol b/packages/contracts/src/2.0.0/forwarder/MixinFees.sol index 9206c5fe0..8ea00a1d5 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinWethFees.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinFees.sol @@ -16,21 +16,33 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; -import { WETH9 as EtherToken } from "../tokens/WETH9/WETH9.sol"; import "../protocol/Exchange/libs/LibMath.sol"; -import "./MixinConstants.sol"; +import "./mixins/MConstants.sol"; +import "./mixins/MFees.sol"; -contract MixinWethFees is + +contract MixinFees is LibMath, - MixinConstants + MConstants, + MFees { - uint16 constant public PERCENTAGE_DENOMINATOR = 10000; // 9800 == 98%, 10000 == 100% - uint16 constant public MAX_FEE = 1000; // 10% - uint16 constant public ALLOWABLE_EXCHANGE_PERCENTAGE = 9500; // 95% + uint16 constant public PERCENTAGE_DENOMINATOR = 10000; // 9800 == 98%, 10000 == 100% + uint16 constant public MAX_FEE = 1000; // 10% + uint16 constant public ALLOWABLE_EXCHANGE_PERCENTAGE = 9500; // 95% + + /// @dev Default payabale function, this allows us to withdraw WETH + function () + public + payable + { + require( + msg.sender == address(ETHER_TOKEN), + "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY" + ); + } /// @dev Pays the feeRecipient feeProportion of the total takerEthAmount, denominated in ETH /// @param takerEthAmount The total amount that was transacted in WETH, fees are calculated from this value. diff --git a/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyTokens.sol b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol index ef06fe519..eadeaf5ba 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyTokens.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol @@ -16,28 +16,122 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../utils/LibBytes/LibBytes.sol"; -import "./MixinWethFees.sol"; -import "./MixinMarketBuyZrx.sol"; -import "./MixinExpectedResults.sol"; -import "./MixinERC20.sol"; -import "./MixinERC721.sol"; -import "./MixinConstants.sol"; +import "./mixins/MFees.sol"; +import "./mixins/MMarketBuyZrx.sol"; +import "./mixins/MExpectedResults.sol"; +import "./mixins/MTransfer.sol"; +import "./mixins/MConstants.sol"; +import "./mixins/MForwarderCore.sol"; import "../protocol/Exchange/libs/LibOrder.sol"; +import "../protocol/Exchange/libs/LibFillResults.sol"; -contract MixinMarketBuyTokens is - MixinConstants, - MixinWethFees, - MixinMarketBuyZrx, - MixinExpectedResults, - MixinERC20, - MixinERC721 + +contract MixinForwarderCore is + LibFillResults, + MConstants, + MExpectedResults, + MFees, + MMarketBuyZrx, + MTransfer, + MForwarderCore { - bytes4 public constant ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)")); - bytes4 public constant ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)")); + bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + uint256 constant internal MAX_UINT = 2**256 - 1; + + constructor () + public + { + address proxyAddress = EXCHANGE.getAssetProxy(ERC20_DATA_ID); + if (proxyAddress != address(0)) { + ETHER_TOKEN.approve(proxyAddress, MAX_UINT); + ZRX_TOKEN.approve(proxyAddress, MAX_UINT); + } + } + + /// @dev Market sells ETH for ERC20 tokens, performing fee abstraction if required. This does not support ERC721 tokens. This function is payable + /// and will convert all incoming ETH into WETH and perform the trade on behalf of the caller. + /// This function allows for a deduction of a proportion of incoming ETH sent to the feeRecipient. + /// The caller is sent all tokens from the operation. + /// If the purchased token amount does not meet an acceptable threshold then this function reverts. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param feeOrders An array of Order struct containing order specifications for fees. + /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. + /// @param feeProportion A proportion deducted off the incoming ETH and sent to feeRecipient. The maximum value for this + /// is 1000, aka 10%. Supports up to 2 decimal places. I.e 0.59% is 59. + /// @param feeRecipient An address of the fee recipient whom receives feeProportion of ETH. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForERC20( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint16 feeProportion, + address feeRecipient + ) + public + payable + returns (FillResults memory totalFillResults) + { + uint256 takerEthAmount = msg.value; + require( + takerEthAmount > 0, + "VALUE_GREATER_THAN_ZERO" + ); + // Deduct the fee from the total amount of ETH sent in + uint256 ethFeeAmount = payEthFee( + takerEthAmount, + feeProportion, + feeRecipient + ); + uint256 wethSellAmount = safeSub(takerEthAmount, ethFeeAmount); + + // Deposit the remaining to be used for trading + ETHER_TOKEN.deposit.value(wethSellAmount)(); + // Populate the known assetData, as it is always WETH the caller can provide null bytes to save gas + // marketSellOrders fills the remaining + address makerTokenAddress = LibBytes.readAddress(orders[0].makerAssetData, 16); + orders[0].takerAssetData = WETH_ASSET_DATA; + if (makerTokenAddress == address(ZRX_TOKEN)) { + // If this is ZRX then we market sell from the orders, rather than a 2 step of buying ZRX fees from feeOrders + // then buying ZRX from orders + totalFillResults = marketSellEthForZRXInternal( + orders, + signatures, + wethSellAmount + ); + } else { + totalFillResults = marketSellEthForERC20Internal( + orders, + signatures, + feeOrders, + feeSignatures, + wethSellAmount + ); + } + // Prevent accidental WETH owned by this contract and it being spent + require( + takerEthAmount >= totalFillResults.takerAssetFilledAmount, + "INVALID_MSG_VALUE" + ); + // Ensure no WETH is left in this contract + require( + wethSellAmount == totalFillResults.takerAssetFilledAmount, + "UNACCEPTABLE_THRESHOLD" + ); + // Transfer all tokens to msg.sender + transferERC20Token( + makerTokenAddress, + msg.sender, + totalFillResults.makerAssetFilledAmount + ); + return totalFillResults; + } /// @dev Buys the exact amount of assets (ERC20 and ERC721), performing fee abstraction if required. /// All order assets must be of the same type. Deducts a proportional fee to fee recipient. @@ -62,8 +156,8 @@ contract MixinMarketBuyTokens is uint16 feeProportion, address feeRecipient ) - payable public + payable returns (FillResults memory totalFillResults) { uint256 takerEthAmount = msg.value; @@ -112,6 +206,85 @@ contract MixinMarketBuyTokens is return totalFillResults; } + /// @dev Market sells WETH for ERC20 tokens. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param feeOrders An array of Order struct containing order specifications for fees. + /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. + /// @param wethSellAmount The amount of WETH to sell. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForERC20Internal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint256 wethSellAmount + ) + internal + returns (FillResults memory totalFillResults) + { + uint256 remainingWethSellAmount = wethSellAmount; + FillResults memory calculatedMarketSellResults = calculateMarketSellResults(orders, wethSellAmount); + if (calculatedMarketSellResults.takerFeePaid > 0) { + // Fees are required for these orders. Buy enough ZRX to cover the future market buy + FillResults memory feeTokensResults = marketBuyZrxInternal( + feeOrders, + feeSignatures, + calculatedMarketSellResults.takerFeePaid + ); + // Ensure the token abstraction was fair if fees were proportionally too high, we fail + require( + isAcceptableThreshold( + wethSellAmount, + safeSub(wethSellAmount, feeTokensResults.takerAssetFilledAmount) + ), + "UNACCEPTABLE_THRESHOLD" + ); + remainingWethSellAmount = safeSub(remainingWethSellAmount, feeTokensResults.takerAssetFilledAmount); + totalFillResults.takerFeePaid = feeTokensResults.takerFeePaid; + totalFillResults.takerAssetFilledAmount = feeTokensResults.takerAssetFilledAmount; + } + // Make our market sell to buy the requested tokens with the remaining balance + FillResults memory requestedTokensResults = EXCHANGE.marketSellOrders( + orders, + remainingWethSellAmount, + signatures + ); + // Update our return FillResult with the market sell + addFillResults(totalFillResults, requestedTokensResults); + return totalFillResults; + } + + /// @dev Market sells WETH for ZRX tokens. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param wethSellAmount The amount of WETH to sell. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForZRXInternal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + uint256 wethSellAmount + ) + internal + returns (FillResults memory totalFillResults) + { + // Make our market sell to buy the requested tokens with the remaining balance + totalFillResults = EXCHANGE.marketSellOrders( + orders, + wethSellAmount, + signatures + ); + // Exchange does not special case ZRX in the makerAssetFilledAmount, if fees were deducted then using this amount + // for future transfers is invalid. + uint256 zrxAmountBought = safeSub(totalFillResults.makerAssetFilledAmount, totalFillResults.takerFeePaid); + require( + isAcceptableThreshold(totalFillResults.makerAssetFilledAmount, zrxAmountBought), + "UNACCEPTABLE_THRESHOLD" + ); + totalFillResults.makerAssetFilledAmount = zrxAmountBought; + return totalFillResults; + } + /// @dev Buys an exact amount of an ERC20 token using WETH. /// @param orders Orders to fill. The maker asset is the ERC20 token to buy. The taker asset is WETH. /// @param signatures Proof that the orders were created by their respective makers. @@ -126,8 +299,8 @@ contract MixinMarketBuyTokens is bytes[] memory feeSignatures, uint256 makerTokenFillAmount ) - private - returns (FillResults memory totalFillResults) + internal + returns (LibFillResults.FillResults memory totalFillResults) { // We read the maker token address to check if it is ZRX and later use it for transfer address makerTokenAddress = LibBytes.readAddress(orders[0].makerAssetData, 16); @@ -188,7 +361,7 @@ contract MixinMarketBuyTokens is ); } // Transfer all purchased tokens to msg.sender - transferToken( + transferERC20Token( makerTokenAddress, msg.sender, marketBuyResults.makerAssetFilledAmount @@ -208,8 +381,8 @@ contract MixinMarketBuyTokens is LibOrder.Order[] memory feeOrders, bytes[] memory feeSignatures ) - private - returns (FillResults memory totalFillResults) + internal + returns (LibFillResults.FillResults memory totalFillResults) { uint256 totalZrxFeeAmount; uint256 ordersLength = orders.length; diff --git a/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyZrx.sol b/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyZrx.sol index 4dbb34de3..e272f8aad 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyZrx.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinMarketBuyZrx.sol @@ -16,20 +16,23 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; -import "../protocol/Exchange/Exchange.sol"; import "../protocol/Exchange/libs/LibFillResults.sol"; import "../protocol/Exchange/libs/LibOrder.sol"; import "../protocol/Exchange/libs/LibMath.sol"; -import "./MixinConstants.sol"; +import "./mixins/MConstants.sol"; +import "./mixins/MMarketBuyZrx.sol"; + contract MixinMarketBuyZrx is LibMath, LibFillResults, - MixinConstants + MConstants, + MMarketBuyZrx { + /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account the fees on buying fee tokens. This will guarantee /// At least zrxBuyAmount of ZRX fee tokens are purchased (sometimes slightly over due to rounding issues). /// It is possible that a request to buy 200 ZRX fee tokens will require purchasing 202 ZRX tokens diff --git a/packages/contracts/src/2.0.0/forwarder/MixinMarketSellTokens.sol b/packages/contracts/src/2.0.0/forwarder/MixinMarketSellTokens.sol deleted file mode 100644 index 8c9cdb8d5..000000000 --- a/packages/contracts/src/2.0.0/forwarder/MixinMarketSellTokens.sol +++ /dev/null @@ -1,196 +0,0 @@ -/* - - 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.24; -pragma experimental ABIEncoderV2; - -import "../protocol/Exchange/libs/LibOrder.sol"; -import "../utils/LibBytes/LibBytes.sol"; -import "./MixinWethFees.sol"; -import "./MixinExpectedResults.sol"; -import "./MixinERC20.sol"; -import "./MixinConstants.sol"; -import "./MixinMarketBuyZrx.sol"; - -contract MixinMarketSellTokens is - MixinConstants, - MixinWethFees, - MixinMarketBuyZrx, - MixinExpectedResults, - MixinERC20 -{ - /// @dev Market sells ETH for ERC20 tokens, performing fee abstraction if required. This does not support ERC721 tokens. This function is payable - /// and will convert all incoming ETH into WETH and perform the trade on behalf of the caller. - /// This function allows for a deduction of a proportion of incoming ETH sent to the feeRecipient. - /// The caller is sent all tokens from the operation. - /// If the purchased token amount does not meet an acceptable threshold then this function reverts. - /// @param orders An array of Order struct containing order specifications. - /// @param signatures An array of Proof that order has been created by maker. - /// @param feeOrders An array of Order struct containing order specifications for fees. - /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. - /// @param feeProportion A proportion deducted off the incoming ETH and sent to feeRecipient. The maximum value for this - /// is 1000, aka 10%. Supports up to 2 decimal places. I.e 0.59% is 59. - /// @param feeRecipient An address of the fee recipient whom receives feeProportion of ETH. - /// @return FillResults amounts filled and fees paid by maker and taker. - function marketSellEthForERC20( - LibOrder.Order[] memory orders, - bytes[] memory signatures, - LibOrder.Order[] memory feeOrders, - bytes[] memory feeSignatures, - uint16 feeProportion, - address feeRecipient - ) - payable - public - returns (FillResults memory totalFillResults) - { - uint256 takerEthAmount = msg.value; - require( - takerEthAmount > 0, - "VALUE_GREATER_THAN_ZERO" - ); - // Deduct the fee from the total amount of ETH sent in - uint256 ethFeeAmount = payEthFee( - takerEthAmount, - feeProportion, - feeRecipient - ); - uint256 wethSellAmount = safeSub(takerEthAmount, ethFeeAmount); - - // Deposit the remaining to be used for trading - ETHER_TOKEN.deposit.value(wethSellAmount)(); - // Populate the known assetData, as it is always WETH the caller can provide null bytes to save gas - // marketSellOrders fills the remaining - address makerTokenAddress = LibBytes.readAddress(orders[0].makerAssetData, 16); - orders[0].takerAssetData = WETH_ASSET_DATA; - if (makerTokenAddress == address(ZRX_TOKEN)) { - // If this is ZRX then we market sell from the orders, rather than a 2 step of buying ZRX fees from feeOrders - // then buying ZRX from orders - totalFillResults = marketSellEthForZRXInternal( - orders, - signatures, - wethSellAmount - ); - } else { - totalFillResults = marketSellEthForERC20Internal( - orders, - signatures, - feeOrders, - feeSignatures, - wethSellAmount - ); - } - // Prevent accidental WETH owned by this contract and it being spent - require( - takerEthAmount >= totalFillResults.takerAssetFilledAmount, - "INVALID_MSG_VALUE" - ); - // Ensure no WETH is left in this contract - require( - wethSellAmount == totalFillResults.takerAssetFilledAmount, - "UNACCEPTABLE_THRESHOLD" - ); - // Transfer all tokens to msg.sender - transferToken( - makerTokenAddress, - msg.sender, - totalFillResults.makerAssetFilledAmount - ); - return totalFillResults; - } - - /// @dev Market sells WETH for ERC20 tokens. - /// @param orders An array of Order struct containing order specifications. - /// @param signatures An array of Proof that order has been created by maker. - /// @param feeOrders An array of Order struct containing order specifications for fees. - /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. - /// @param wethSellAmount The amount of WETH to sell. - /// @return FillResults amounts filled and fees paid by maker and taker. - function marketSellEthForERC20Internal( - LibOrder.Order[] memory orders, - bytes[] memory signatures, - LibOrder.Order[] memory feeOrders, - bytes[] memory feeSignatures, - uint256 wethSellAmount - ) - internal - returns (FillResults memory totalFillResults) - { - uint256 remainingWethSellAmount = wethSellAmount; - FillResults memory calculatedMarketSellResults = calculateMarketSellResults(orders, wethSellAmount); - if (calculatedMarketSellResults.takerFeePaid > 0) { - // Fees are required for these orders. Buy enough ZRX to cover the future market buy - FillResults memory feeTokensResults = marketBuyZrxInternal( - feeOrders, - feeSignatures, - calculatedMarketSellResults.takerFeePaid - ); - // Ensure the token abstraction was fair if fees were proportionally too high, we fail - require( - isAcceptableThreshold( - wethSellAmount, - safeSub(wethSellAmount, feeTokensResults.takerAssetFilledAmount) - ), - "UNACCEPTABLE_THRESHOLD" - ); - remainingWethSellAmount = safeSub(remainingWethSellAmount, feeTokensResults.takerAssetFilledAmount); - totalFillResults.takerFeePaid = feeTokensResults.takerFeePaid; - totalFillResults.takerAssetFilledAmount = feeTokensResults.takerAssetFilledAmount; - } - // Make our market sell to buy the requested tokens with the remaining balance - FillResults memory requestedTokensResults = EXCHANGE.marketSellOrders( - orders, - remainingWethSellAmount, - signatures - ); - // Update our return FillResult with the market sell - addFillResults(totalFillResults, requestedTokensResults); - return totalFillResults; - } - - /// @dev Market sells WETH for ZRX tokens. - /// @param orders An array of Order struct containing order specifications. - /// @param signatures An array of Proof that order has been created by maker. - /// @param wethSellAmount The amount of WETH to sell. - /// @return FillResults amounts filled and fees paid by maker and taker. - function marketSellEthForZRXInternal( - LibOrder.Order[] memory orders, - bytes[] memory signatures, - uint256 wethSellAmount - ) - internal - returns (FillResults memory totalFillResults) - { - // Make our market sell to buy the requested tokens with the remaining balance - totalFillResults = EXCHANGE.marketSellOrders( - orders, - wethSellAmount, - signatures - ); - // Exchange does not special case ZRX in the makerAssetFilledAmount, if fees were deducted then using this amount - // for future transfers is invalid. - uint256 zrxAmountBought = safeSub(totalFillResults.makerAssetFilledAmount, totalFillResults.takerFeePaid); - require( - isAcceptableThreshold(totalFillResults.makerAssetFilledAmount, zrxAmountBought), - "UNACCEPTABLE_THRESHOLD" - ); - totalFillResults.makerAssetFilledAmount = zrxAmountBought; - return totalFillResults; - } - -} diff --git a/packages/contracts/src/2.0.0/forwarder/MixinERC20.sol b/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol index 53d4116d7..6c49330f2 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinERC20.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol @@ -16,15 +16,49 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; -contract MixinERC20 { +import "../utils/LibBytes/LibBytes.sol"; +import "../tokens/ERC721Token/IERC721Token.sol"; +import "./mixins/MTransfer.sol"; - string constant ERROR_TRANSFER_FAILED = "TRANSFER_FAILED"; - bytes4 constant ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)")); - function transferToken( +contract MixinTransfer is + MTransfer +{ + + using LibBytes for bytes; + + bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)")); + bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,uint256,bytes)")); + bytes4 constant internal ERC721_RECEIVED_OPERATOR = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); + + function onERC721Received( + address, + uint256, + bytes memory + ) + public + pure + returns(bytes4) + { + return ERC721_RECEIVED; + } + + function onERC721Received( + address, + address, + uint256, + bytes memory + ) + public + pure + returns(bytes4) + { + return ERC721_RECEIVED_OPERATOR; + } + + function transferERC20Token( address token, address to, uint256 amount @@ -65,4 +99,22 @@ contract MixinERC20 { "TRANSFER_FAILED" ); } + + function transferERC721Token( + bytes memory assetData, + address to + ) + internal + { + // Decode asset data. + address token = assetData.readAddress(16); + uint256 tokenId = assetData.readUint256(36); + bytes memory receiverData = assetData.readBytesWithLength(100); + IERC721Token(token).safeTransferFrom( + address(this), + to, + tokenId, + receiverData + ); + } } diff --git a/packages/contracts/src/2.0.0/forwarder/interfaces/IExpectedResults.sol b/packages/contracts/src/2.0.0/forwarder/interfaces/IExpectedResults.sol new file mode 100644 index 000000000..89187b750 --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/interfaces/IExpectedResults.sol @@ -0,0 +1,66 @@ +/* + + 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.24; +pragma experimental ABIEncoderV2; + +import "../../protocol/Exchange/libs/LibFillResults.sol"; +import "../../protocol/Exchange/libs/LibOrder.sol"; + + +contract IExpectedResults { + + /// @dev Calculates a total FillResults for buying makerAssetFillAmount over all orders. + /// Including the fees required to be paid. + /// @param orders An array of Order struct containing order specifications. + /// @param makerAssetFillAmount A number representing the amount of this order to fill. + /// @return totalFillResults Amounts filled and fees paid by maker and taker. + function calculateMarketBuyResults( + LibOrder.Order[] memory orders, + uint256 makerAssetFillAmount + ) + public + view + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Calculates a FillResults total for selling takerAssetFillAmount over all orders. + /// Including the fees required to be paid. + /// @param orders An array of Order struct containing order specifications. + /// @param takerAssetFillAmount A number representing the amount of this order to fill. + /// @return totalFillResults Amounts filled and fees paid by maker and taker. + function calculateMarketSellResults( + LibOrder.Order[] memory orders, + uint256 takerAssetFillAmount + ) + public + view + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Calculates fill results for buyFeeTokens. This handles fees on buying ZRX + /// so the end result is the expected amount of ZRX (not less after fees). + /// @param orders An array of Order struct containing order specifications. + /// @param zrxFillAmount A number representing the amount zrx to buy + /// @return totalFillResults Expected fill result amounts from buying fees + function calculateMarketBuyZrxResults( + LibOrder.Order[] memory orders, + uint256 zrxFillAmount + ) + public + view + returns (LibFillResults.FillResults memory totalFillResults); +} diff --git a/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarder.sol b/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarder.sol new file mode 100644 index 000000000..745dd29a9 --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarder.sol @@ -0,0 +1,30 @@ +/* + + 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.24; +pragma experimental ABIEncoderV2; + +import "./IForwarderCore.sol"; +import "./IExpectedResults.sol"; + + +// solhint-disable no-empty-blocks +contract IForwarder is + IForwarderCore, + IExpectedResults +{} diff --git a/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarderCore.sol b/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarderCore.sol new file mode 100644 index 000000000..7ac2a8af3 --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/interfaces/IForwarderCore.sol @@ -0,0 +1,79 @@ +/* + + 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.24; +pragma experimental ABIEncoderV2; + +import "../../protocol/Exchange/libs/LibOrder.sol"; +import "../../protocol/Exchange/libs/LibFillResults.sol"; + + +contract IForwarderCore { + + /// @dev Market sells ETH for ERC20 tokens, performing fee abstraction if required. This does not support ERC721 tokens. This function is payable + /// and will convert all incoming ETH into WETH and perform the trade on behalf of the caller. + /// This function allows for a deduction of a proportion of incoming ETH sent to the feeRecipient. + /// The caller is sent all tokens from the operation. + /// If the purchased token amount does not meet an acceptable threshold then this function reverts. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param feeOrders An array of Order struct containing order specifications for fees. + /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. + /// @param feeProportion A proportion deducted off the incoming ETH and sent to feeRecipient. The maximum value for this + /// is 1000, aka 10%. Supports up to 2 decimal places. I.e 0.59% is 59. + /// @param feeRecipient An address of the fee recipient whom receives feeProportion of ETH. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForERC20( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint16 feeProportion, + address feeRecipient + ) + public + payable + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Buys the exact amount of assets (ERC20 and ERC721), performing fee abstraction if required. + /// All order assets must be of the same type. Deducts a proportional fee to fee recipient. + /// This function is payable and will convert all incoming ETH into WETH and perform the trade on behalf of the caller. + /// The caller is sent all assets from the fill of orders. This function will revert unless the requested amount of assets are purchased. + /// Any excess ETH sent will be returned to the caller + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param feeOrders An array of Order struct containing order specifications for fees. + /// @param makerTokenFillAmount The amount of maker asset to buy. + /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. + /// @param feeProportion A proportion deducted off the ETH spent and sent to feeRecipient. The maximum value for this + /// is 1000, aka 10%. Supports up to 2 decimal places. I.e 0.59% is 59. + /// @param feeRecipient An address of the fee recipient whom receives feeProportion of ETH. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketBuyTokensWithEth( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint256 makerTokenFillAmount, + uint16 feeProportion, + address feeRecipient + ) + public + payable + returns (LibFillResults.FillResults memory totalFillResults); +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MConstants.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MConstants.sol new file mode 100644 index 000000000..348bf169e --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MConstants.sol @@ -0,0 +1,35 @@ +/* + + 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.24; + +import "../../protocol/Exchange/interfaces/IExchange.sol"; +import "../../tokens/EtherToken/IEtherToken.sol"; +import "../../tokens/ERC20Token/IERC20Token.sol"; + + +contract MConstants { + + // solhint-disable var-name-mixedcase + IExchange internal EXCHANGE; + IEtherToken internal ETHER_TOKEN; + IERC20Token internal ZRX_TOKEN; + bytes internal ZRX_ASSET_DATA; + bytes internal WETH_ASSET_DATA; + // solhint-enable var-name-mixedcase +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MExpectedResults.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MExpectedResults.sol new file mode 100644 index 000000000..cf03bb32e --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MExpectedResults.sol @@ -0,0 +1,42 @@ +/* + + 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.24; +pragma experimental ABIEncoderV2; + +import "../../protocol/Exchange/libs/LibFillResults.sol"; +import "../../protocol/Exchange/libs/LibOrder.sol"; +import "../interfaces/IExpectedResults.sol"; + + +contract MExpectedResults is + IExpectedResults +{ + + /// @dev Simulates the 0x Exchange fillOrder validation and calculations, without performing any state changes. + /// @param order An Order struct containing order specifications. + /// @param takerAssetFillAmount A number representing the amount of this order to fill. + /// @return fillResults Amounts filled and fees paid by maker and taker. + function calculateFillResults( + LibOrder.Order memory order, + uint256 takerAssetFillAmount + ) + internal + view + returns (LibFillResults.FillResults memory fillResults); +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MFees.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MFees.sol new file mode 100644 index 000000000..f332637ea --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MFees.sol @@ -0,0 +1,63 @@ +/* + + 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.24; + + +contract MFees { + + /// @dev Pays the feeRecipient feeProportion of the total takerEthAmount, denominated in ETH + /// @param takerEthAmount The total amount that was transacted in WETH, fees are calculated from this value. + /// @param feeProportion The proportion of fees + /// @param feeRecipient The recipient of the fees + /// @return ethFeeAmount Amount of ETH paid to feeRecipient as fee. + function payEthFee( + uint256 takerEthAmount, + uint16 feeProportion, + address feeRecipient + ) + internal + returns (uint256 ethFeeAmount); + + /// @dev Withdraws the remaining WETH, deduct and pay fees from this amount based on the takerTokenAmount to the feeRecipient. + /// If a user overpaid ETH initially, the fees are calculated from the amount traded and deducted from withdrawAmount. + /// Any remaining ETH is sent back to the user. + /// @param ethWithdrawAmount The amount to withdraw from the WETH contract. + /// @param wethAmountSold The total amount that was transacted in WETH, fees are calculated from this value. + /// @param feeProportion The proportion of fees + /// @param feeRecipient The recipient of the fees + function withdrawPayAndDeductEthFee( + uint256 ethWithdrawAmount, + uint256 wethAmountSold, + uint16 feeProportion, + address feeRecipient + ) + internal; + + /// @dev Checks whether the amount of tokens sold against the amount of tokens requested + /// is within a certain threshold. This ensures the caller gets a fair deal when + /// performing any token fee abstraction. Threshold is 95%. If fee abstraction costs more than + /// 5% of the total transaction, we return false. + /// @param requestedSellAmount The amount the user requested, or sent in to a payable function + /// @param tokenAmountSold The amount of the token that was sold after fee abstraction + /// @return bool of whether this is within an acceptable threshold + function isAcceptableThreshold(uint256 requestedSellAmount, uint256 tokenAmountSold) + internal + pure + returns (bool); +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MForwarderCore.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MForwarderCore.sol new file mode 100644 index 000000000..4a54e76b1 --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MForwarderCore.sol @@ -0,0 +1,92 @@ +/* + + 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.24; +pragma experimental ABIEncoderV2; + +import "../../protocol/Exchange/libs/LibOrder.sol"; +import "../../protocol/Exchange/libs/LibFillResults.sol"; +import "../interfaces/IForwarderCore.sol"; + + +contract MForwarderCore is + IForwarderCore +{ + + /// @dev Market sells WETH for ERC20 tokens. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param feeOrders An array of Order struct containing order specifications for fees. + /// @param feeSignatures An array of Proof that order has been created by maker for the fee orders. + /// @param wethSellAmount The amount of WETH to sell. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForERC20Internal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint256 wethSellAmount + ) + internal + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Market sells WETH for ZRX tokens. + /// @param orders An array of Order struct containing order specifications. + /// @param signatures An array of Proof that order has been created by maker. + /// @param wethSellAmount The amount of WETH to sell. + /// @return FillResults amounts filled and fees paid by maker and taker. + function marketSellEthForZRXInternal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + uint256 wethSellAmount + ) + internal + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Buys an exact amount of an ERC20 token using WETH. + /// @param orders Orders to fill. The maker asset is the ERC20 token to buy. The taker asset is WETH. + /// @param signatures Proof that the orders were created by their respective makers. + /// @param feeOrders to fill. The maker asset is ZRX and the taker asset is WETH. + /// @param feeSignatures Proof that the feeOrders were created by their respective makers. + /// @param makerTokenFillAmount Amount of the ERC20 token to buy. + /// @return totalFillResults Aggregated fill results of buying the ERC20 and ZRX tokens. + function marketBuyERC20TokensInternal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures, + uint256 makerTokenFillAmount + ) + internal + returns (LibFillResults.FillResults memory totalFillResults); + + /// @dev Buys an all of the ERC721 tokens in the orders. + /// @param orders Orders to fill. The maker asset is the ERC721 token to buy. The taker asset is WETH. + /// @param signatures Proof that the orders were created by their respective makers. + /// @param feeOrders to fill. The maker asset is ZRX and the taker asset is WETH. + /// @param feeSignatures Proof that the feeOrders were created by their respective makers. + /// @return totalFillResults Aggregated fill results of buying the ERC721 tokens and ZRX tokens. + function batchBuyERC721TokensInternal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + LibOrder.Order[] memory feeOrders, + bytes[] memory feeSignatures + ) + internal + returns (LibFillResults.FillResults memory totalFillResults); +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MMarketBuyZrx.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MMarketBuyZrx.sol new file mode 100644 index 000000000..3501ef001 --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MMarketBuyZrx.sol @@ -0,0 +1,42 @@ +/* + + 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.24; + +import "../../protocol/Exchange/libs/LibFillResults.sol"; +import "../../protocol/Exchange/libs/LibOrder.sol"; + + +contract MMarketBuyZrx { + + /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account the fees on buying fee tokens. This will guarantee + /// At least zrxBuyAmount of ZRX fee tokens are purchased (sometimes slightly over due to rounding issues). + /// It is possible that a request to buy 200 ZRX fee tokens will require purchasing 202 ZRX tokens + /// As 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases. + /// @param orders An array of Order struct containing order specifications for fees. + /// @param signatures An array of Proof that order has been created by maker for the fee orders. + /// @param zrxBuyAmount The number of requested ZRX fee tokens. + /// @return totalFillResults Amounts filled and fees paid by maker and taker. makerTokenAmount is the zrx amount deducted of fees + function marketBuyZrxInternal( + LibOrder.Order[] memory orders, + bytes[] memory signatures, + uint256 zrxBuyAmount + ) + internal + returns (LibFillResults.FillResults memory totalFillResults); +} diff --git a/packages/contracts/src/2.0.0/forwarder/mixins/MTransfer.sol b/packages/contracts/src/2.0.0/forwarder/mixins/MTransfer.sol new file mode 100644 index 000000000..418a6288b --- /dev/null +++ b/packages/contracts/src/2.0.0/forwarder/mixins/MTransfer.sol @@ -0,0 +1,46 @@ +/* + + 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.24; + + +contract MTransfer { + + function onERC721Received(address, uint256, bytes memory) + public + pure + returns(bytes4); + + function onERC721Received(address, address, uint256, bytes memory) + public + pure + returns(bytes4); + + function transferERC20Token( + address token, + address to, + uint256 amount + ) + internal; + + function transferERC721Token( + bytes memory assetData, + address to + ) + internal; +} diff --git a/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol b/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol index 1ceecd907..eb54fe047 100644 --- a/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol +++ b/packages/contracts/src/2.0.0/multisig/MultiSigWallet.sol @@ -1,6 +1,6 @@ +// solhint-disable pragma solidity ^0.4.10; -// solhint-disable /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> diff --git a/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol b/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol index d714b661d..8c5e6e1e6 100644 --- a/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol +++ b/packages/contracts/src/2.0.0/multisig/MultiSigWalletWithTimeLock.sol @@ -16,11 +16,11 @@ */ +// solhint-disable pragma solidity ^0.4.10; import "./MultiSigWallet.sol"; -// solhint-disable /// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed. /// @author Amir Bandeali - <amir@0xProject.com> diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol index aed62f54f..b5cec6b64 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol @@ -16,18 +16,19 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAuthorizable.sol"; + contract ERC20Proxy is MixinAuthorizable { // Id of this proxy. - bytes4 constant PROXY_ID = bytes4(keccak256("ERC20Token(address)")); + bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC20Token(address)")); + // solhint-disable-next-line payable-fallback function () external { diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol index b73dc36cc..1f9958b43 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol @@ -16,18 +16,19 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAuthorizable.sol"; + contract ERC721Proxy is MixinAuthorizable { // Id of this proxy. - bytes4 constant PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + // solhint-disable-next-line payable-fallback function () external { diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol index 5bc5f3a47..ff4660a31 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/MixinAuthorizable.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../utils/Ownable/Ownable.sol"; import "./mixins/MAuthorizable.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol index b4ff2d900..3e76e38dd 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetData.sol @@ -16,7 +16,8 @@ */ -pragma solidity ^0.4.23; +// solhint-disable +pragma solidity 0.4.24; // @dev Interface of the asset proxy's assetData. @@ -24,12 +25,10 @@ pragma solidity ^0.4.23; // This argument is ABI encoded as one of the methods of this interface. interface IAssetData { - // solhint-disable-next-line func-name-mixedcase function ERC20Token(address tokenContract) external pure; - // solhint-disable-next-line func-name-mixedcase function ERC721Token( address tokenContract, uint256 tokenId, diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol index 0ef1ed2e0..3651dd694 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "./IAuthorizable.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol index 286db74aa..8fac43a47 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../../utils/Ownable/IOwnable.sol"; @@ -26,13 +25,6 @@ contract IAuthorizable is IOwnable { - /// @dev Gets all authorized addresses. - /// @return Array of authorized addresses. - function getAuthorizedAddresses() - external - view - returns (address[]); - /// @dev Authorizes an address. /// @param target Address to authorize. function addAuthorizedAddress(address target) @@ -51,4 +43,11 @@ contract IAuthorizable is uint256 index ) external; + + /// @dev Gets all authorized addresses. + /// @return Array of authorized addresses. + function getAuthorizedAddresses() + external + view + returns (address[] memory); } diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol index 4b460ea9a..1d9a70cc1 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/libs/LibAssetProxyErrors.sol @@ -16,7 +16,8 @@ */ -pragma solidity ^0.4.24; +// solhint-disable +pragma solidity 0.4.24; /// @dev This contract documents the revert reasons used in the AssetProxy contracts. diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol index 66c259a23..8afc8c8d8 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../interfaces/IAuthorizable.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol index 232155a6b..e7cf4ab5c 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -33,7 +33,7 @@ contract AssetProxyOwner is // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock. mapping (address => bool) public isAssetProxyRegistered; - bytes4 constant REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)")); + bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)")); /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex` /// on an approved AssetProxy contract. @@ -89,6 +89,7 @@ contract AssetProxyOwner is { Transaction storage tx = transactions[transactionId]; tx.executed = true; + // solhint-disable-next-line avoid-call-value if (tx.destination.call.value(tx.value)(tx.data)) Execution(transactionId); else { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol b/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol index effff82e0..7507d3da1 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/Exchange.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "./libs/LibConstants.sol"; @@ -28,6 +28,7 @@ import "./MixinTransactions.sol"; import "./MixinMatchOrders.sol"; +// solhint-disable no-empty-blocks contract Exchange is MixinExchangeCore, MixinMatchOrders, diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol index dcfe9e1de..e9f882194 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../utils/Ownable/Ownable.sol"; import "../../utils/LibBytes/LibBytes.sol"; @@ -151,6 +151,7 @@ contract MixinAssetProxyDispatcher is /////// Setup Data Area /////// // This area holds `assetData`. let dataArea := add(cdStart, 132) + // solhint-disable-next-line no-empty-blocks for {} lt(dataArea, cdEnd) {} { mstore(dataArea, mload(assetData)) dataArea := add(dataArea, 32) diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol index 9e63dc1c0..ec84b1e19 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "./libs/LibConstants.sol"; @@ -49,8 +49,6 @@ contract MixinExchangeCore is // Orders with specified senderAddress and with a salt less than their epoch to are considered cancelled mapping (address => mapping (address => uint256)) public orderEpoch; - ////// Core exchange functions ////// - /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress). /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. @@ -175,6 +173,7 @@ contract MixinExchangeCore is } // Validate order expiration + // solhint-disable-next-line not-rely-on-time if (block.timestamp >= order.expirationTimeSeconds) { orderInfo.orderStatus = uint8(OrderStatus.EXPIRED); return orderInfo; @@ -375,21 +374,19 @@ contract MixinExchangeCore is returns (FillResults memory fillResults) { // Compute proportional transfer amounts - // TODO: All three are multiplied by the same fraction. This can - // potentially be optimized. fillResults.takerAssetFilledAmount = takerAssetFilledAmount; fillResults.makerAssetFilledAmount = getPartialAmount( - fillResults.takerAssetFilledAmount, + takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount ); fillResults.makerFeePaid = getPartialAmount( - fillResults.takerAssetFilledAmount, + takerAssetFilledAmount, order.takerAssetAmount, order.makerFee ); fillResults.takerFeePaid = getPartialAmount( - fillResults.takerAssetFilledAmount, + takerAssetFilledAmount, order.takerAssetAmount, order.takerFee ); diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol index bfe838837..56b309a1b 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol @@ -11,7 +11,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "./libs/LibConstants.sol"; @@ -41,7 +41,6 @@ contract MixinMatchOrders is /// @param leftSignature Proof that order was created by the left maker. /// @param rightSignature Proof that order was created by the right maker. /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders. - /// TODO: Make this function external once supported by Solidity (See Solidity Issues #3199, #1603) function matchOrders( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, @@ -184,7 +183,6 @@ contract MixinMatchOrders is leftTakerAssetFilledAmount = leftTakerAssetAmountRemaining; // The right order receives an amount proportional to how much was spent. - // TODO: Can we ensure rounding error is in the correct direction? rightTakerAssetFilledAmount = getPartialAmount( rightOrder.takerAssetAmount, rightOrder.makerAssetAmount, @@ -195,7 +193,6 @@ contract MixinMatchOrders is rightTakerAssetFilledAmount = rightTakerAssetAmountRemaining; // The left order receives an amount proportional to how much was spent. - // TODO: Can we ensure rounding error is in the correct direction? leftTakerAssetFilledAmount = getPartialAmount( rightOrder.makerAssetAmount, rightOrder.takerAssetAmount, diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol index 78f13286f..ac7382715 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../utils/LibBytes/LibBytes.sol"; import "./mixins/MSignatureValidator.sol"; @@ -91,7 +91,6 @@ contract MixinSignatureValidator is view returns (bool isValid) { - // TODO: Domain separation: make hash depend on role. (Taker sig should not be valid as maker sig, etc.) require( signature.length > 0, "LENGTH_GREATER_THAN_0_REQUIRED" diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol index 3b18ac733..88d2da7d7 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinTransactions.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "./libs/LibExchangeErrors.sol"; import "./mixins/MSignatureValidator.sol"; @@ -37,7 +37,7 @@ contract MixinTransactions is address public currentContextAddress; // Hash for the EIP712 ZeroEx Transaction Schema - bytes32 constant EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked( + bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked( "ZeroExTransaction(", "uint256 salt,", "address signerAddress,", @@ -45,41 +45,6 @@ contract MixinTransactions is ")" )); - /// @dev Calculates EIP712 hash of the Transaction. - /// @param salt Arbitrary number to ensure uniqueness of transaction hash. - /// @param signerAddress Address of transaction signer. - /// @param data AbiV2 encoded calldata. - /// @return EIP712 hash of the Transaction. - function hashZeroExTransaction( - uint256 salt, - address signerAddress, - bytes memory data - ) - internal - pure - returns (bytes32 result) - { - bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH; - bytes32 dataHash = keccak256(data); - // Assembly for more efficiently computing: - // keccak256(abi.encode( - // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH, - // salt, - // signerAddress, - // keccak256(data) - // )); - assembly { - let memPtr := mload(64) - mstore(memPtr, schemaHash) - mstore(add(memPtr, 32), salt) - mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) - mstore(add(memPtr, 96), dataHash) - result := keccak256(memPtr, 128) - } - - return result; - } - /// @dev Executes an exchange method call in the context of signer. /// @param salt Arbitrary number to ensure uniqueness of transaction hash. /// @param signerAddress Address of transaction signer. @@ -134,9 +99,47 @@ contract MixinTransactions is "FAILED_EXECUTION" ); - // Reset current transaction signer - // TODO: Check if gas is paid when currentContextAddress is already 0. - currentContextAddress = address(0); + // Reset current transaction signer if it was previously updated + if (signerAddress != msg.sender) { + currentContextAddress = address(0); + } + } + + /// @dev Calculates EIP712 hash of the Transaction. + /// @param salt Arbitrary number to ensure uniqueness of transaction hash. + /// @param signerAddress Address of transaction signer. + /// @param data AbiV2 encoded calldata. + /// @return EIP712 hash of the Transaction. + function hashZeroExTransaction( + uint256 salt, + address signerAddress, + bytes memory data + ) + internal + pure + returns (bytes32 result) + { + bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH; + bytes32 dataHash = keccak256(data); + + // Assembly for more efficiently computing: + // keccak256(abi.encode( + // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH, + // salt, + // signerAddress, + // keccak256(data) + // )); + + assembly { + let memPtr := mload(64) + mstore(memPtr, schemaHash) + mstore(add(memPtr, 32), salt) + mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) + mstore(add(memPtr, 96), dataHash) + result := keccak256(memPtr, 128) + } + + return result; } /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`). diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol index 678d0252a..a16d2f897 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "./libs/LibMath.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol index b73881c07..8db8d6f6c 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract IAssetProxyDispatcher { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol index 05e5dedf4..b92abba04 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchange.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "./IExchangeCore.sol"; @@ -27,6 +27,7 @@ import "./IAssetProxyDispatcher.sol"; import "./IWrapperFunctions.sol"; +// solhint-disable no-empty-blocks contract IExchange is IExchangeCore, IMatchOrders, diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol index 2b573eb1a..9995e0385 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol index d44116474..73447f3ae 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; @@ -33,7 +33,6 @@ contract IMatchOrders { /// @param leftSignature Proof that order was created by the left maker. /// @param rightSignature Proof that order was created by the right maker. /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders. - /// TODO: Make this function external once supported by Solidity (See Solidity Issues #3199, #1603) function matchOrders( LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder, diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol index c5a4a57e1..1fd0eccf0 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract ISignatureValidator { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol index aaaee389f..4446c55ce 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/ITransactions.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract ITransactions { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol index 2c0a5dbe2..2dd69100c 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.23; +pragma solidity 0.4.24; contract IValidator { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol index c2db4a5b1..c97161ca6 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWallet.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract IWallet { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol index 04257b883..ad7a56a06 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; @@ -24,6 +24,7 @@ import "../libs/LibFillResults.sol"; contract IWrapperFunctions { + /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled. /// @param order LibOrder.Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol index 76200ec44..6918d755e 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibConstants.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract LibConstants { diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol index 2bd7b60d4..1fc41dafd 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibEIP712.sol @@ -16,18 +16,18 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; contract LibEIP712 { // EIP191 header for EIP712 prefix - string constant EIP191_HEADER = "\x19\x01"; + string constant internal EIP191_HEADER = "\x19\x01"; // EIP712 Domain Name value - string constant EIP712_DOMAIN_NAME = "0x Protocol"; + string constant internal EIP712_DOMAIN_NAME = "0x Protocol"; // EIP712 Domain Version value - string constant EIP712_DOMAIN_VERSION = "2"; + string constant internal EIP712_DOMAIN_VERSION = "2"; // Hash of the EIP712 Domain Separator Schema bytes32 public constant EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked( diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol index 99f683e1a..a0f75bc06 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol @@ -16,7 +16,8 @@ */ -pragma solidity ^0.4.24; +// solhint-disable +pragma solidity 0.4.24; /// @dev This contract documents the revert reasons used in the Exchange contract. diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol index 35fa9ac0f..1b4181d94 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibFillResults.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../../utils/SafeMath/SafeMath.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol index 9da784854..46c13d390 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../../utils/SafeMath/SafeMath.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol index dda581d9f..68f2c8aed 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibOrder.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "./LibEIP712.sol"; @@ -26,7 +26,7 @@ contract LibOrder is { // Hash for the EIP712 Order Schema - bytes32 constant EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( + bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked( "Order(", "address makerAddress,", "address takerAddress,", @@ -55,6 +55,7 @@ contract LibOrder is CANCELLED // Order has been cancelled } + // solhint-disable max-line-length struct Order { address makerAddress; // Address that created the order. address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. @@ -69,6 +70,7 @@ contract LibOrder is bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy. bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy. } + // solhint-enable max-line-length struct OrderInfo { uint8 orderStatus; // Status that describes order's validity and fillability. @@ -99,21 +101,23 @@ contract LibOrder is bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH; bytes32 makerAssetDataHash = keccak256(order.makerAssetData); bytes32 takerAssetDataHash = keccak256(order.takerAssetData); + // Assembly for more efficiently computing: - // keccak256(abi.encode( - // order.makerAddress, - // order.takerAddress, - // order.feeRecipientAddress, - // order.senderAddress, - // order.makerAssetAmount, - // order.takerAssetAmount, - // order.makerFee, - // order.takerFee, - // order.expirationTimeSeconds, - // order.salt, - // keccak256(order.makerAssetData), - // keccak256(order.takerAssetData) - // )); + // keccak256(abi.encode( + // order.makerAddress, + // order.takerAddress, + // order.feeRecipientAddress, + // order.senderAddress, + // order.makerAssetAmount, + // order.takerAssetAmount, + // order.makerFee, + // order.takerFee, + // order.expirationTimeSeconds, + // order.salt, + // keccak256(order.makerAssetData), + // keccak256(order.takerAssetData) + // )); + assembly { // Backup // solhint-disable-next-line space-after-comma diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol index 367b37e80..c6904300a 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../interfaces/IAssetProxyDispatcher.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol index e28d9d25b..9e3b5a2e2 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; @@ -102,7 +102,6 @@ contract MExchangeCore is internal view; - /// @dev Validates context for cancelOrder. Succeeds or throws. /// @param order to be cancelled. /// @param orderInfo OrderStatus, orderHash, and amount already filled of order. diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol index 289514b24..a31ec1585 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MMatchOrders.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol index 83650b4aa..f14f2ba00 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../interfaces/ISignatureValidator.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol index a9fa6d4e2..f2b5e4b16 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MTransactions.sol @@ -15,7 +15,7 @@ limitations under the License. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../interfaces/ITransactions.sol"; diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol index 7a2702449..97801166a 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol +++ b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyERC20Token.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../Mintable/Mintable.sol"; import "../../utils/Ownable/Ownable.sol"; diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol index b027ac960..5dce74a14 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol +++ b/packages/contracts/src/2.0.0/test/DummyERC721Receiver/DummyERC721Receiver.sol @@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../tokens/ERC721Token/IERC721Receiver.sol"; diff --git a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol index de76f10c5..627746a52 100644 --- a/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol +++ b/packages/contracts/src/2.0.0/test/DummyERC721Token/DummyERC721Token.sol @@ -16,13 +16,13 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../tokens/ERC721Token/ERC721Token.sol"; import "../../utils/Ownable/Ownable.sol"; +// solhint-disable no-empty-blocks contract DummyERC721Token is Ownable, ERC721Token diff --git a/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol b/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol index f20e2a944..2fa0e3c5e 100644 --- a/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol +++ b/packages/contracts/src/2.0.0/test/ExchangeWrapper/ExchangeWrapper.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../../protocol/Exchange/interfaces/IExchange.sol"; @@ -27,7 +27,7 @@ contract ExchangeWrapper { // Exchange contract. // solhint-disable-next-line var-name-mixedcase - IExchange EXCHANGE; + IExchange internal EXCHANGE; constructor (address _exchange) public @@ -35,6 +35,35 @@ contract ExchangeWrapper { EXCHANGE = IExchange(_exchange); } + /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch + /// and senderAddress equal to this contract. + /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. + /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash. + /// @param makerSignature Proof that maker wishes to call this function with given params. + function cancelOrdersUpTo( + uint256 targetOrderEpoch, + uint256 salt, + bytes makerSignature + ) + external + { + address makerAddress = msg.sender; + + // Encode arguments into byte array. + bytes memory data = abi.encodeWithSelector( + EXCHANGE.cancelOrdersUpTo.selector, + targetOrderEpoch + ); + + // Call `cancelOrdersUpTo` via `executeTransaction`. + EXCHANGE.executeTransaction( + salt, + makerAddress, + data, + makerSignature + ); + } + /// @dev Fills an order using `msg.sender` as the taker. /// @param order Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. @@ -68,33 +97,4 @@ contract ExchangeWrapper { takerSignature ); } - - /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch - /// and senderAddress equal to this contract. - /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled. - /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash. - /// @param makerSignature Proof that maker wishes to call this function with given params. - function cancelOrdersUpTo( - uint256 targetOrderEpoch, - uint256 salt, - bytes makerSignature - ) - external - { - address makerAddress = msg.sender; - - // Encode arguments into byte array. - bytes memory data = abi.encodeWithSelector( - EXCHANGE.cancelOrdersUpTo.selector, - targetOrderEpoch - ); - - // Call `cancelOrdersUpTo` via `executeTransaction`. - EXCHANGE.executeTransaction( - salt, - makerAddress, - data, - makerSignature - ); - } } diff --git a/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol b/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol index bccb74ce8..767cc8d25 100644 --- a/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol +++ b/packages/contracts/src/2.0.0/test/Mintable/Mintable.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol"; import "../../utils/SafeMath/SafeMath.sol"; @@ -27,7 +26,10 @@ import "../../utils/SafeMath/SafeMath.sol"; * Mintable * Base contract that creates a mintable UnlimitedAllowanceToken */ -contract Mintable is UnlimitedAllowanceToken, SafeMath { +contract Mintable is + UnlimitedAllowanceToken, + SafeMath +{ function mint(uint256 _value) public { diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol index be7fea7d3..07986f4bb 100644 --- a/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol +++ b/packages/contracts/src/2.0.0/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol"; @@ -27,7 +26,8 @@ contract TestAssetProxyDispatcher is MixinAssetProxyDispatcher { bytes memory assetData, address from, address to, - uint256 amount) + uint256 amount + ) public { dispatchTransferFrom(assetData, from, to, amount); diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol index ddcc62f35..d6b6b29f2 100644 --- a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol @@ -16,14 +16,16 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol"; +// solhint-disable no-empty-blocks contract TestAssetProxyOwner is AssetProxyOwner { + constructor( address[] memory _owners, address[] memory _assetProxyContracts, @@ -32,11 +34,11 @@ contract TestAssetProxyOwner is ) public AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked) - { - } + {} function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id) public + view validRemoveAuthorizedAddressAtIndexTx(id) returns (bool) { diff --git a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol index f52f635e1..00d861e61 100644 --- a/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol +++ b/packages/contracts/src/2.0.0/test/TestLibBytes/TestLibBytes.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../utils/LibBytes/LibBytes.sol"; diff --git a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol index df8eb55ce..5a349527b 100644 --- a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol +++ b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../../protocol/Exchange/libs/LibMath.sol"; @@ -32,7 +32,8 @@ contract TestLibs is function publicGetPartialAmount( uint256 numerator, uint256 denominator, - uint256 target) + uint256 target + ) public pure returns (uint256 partialAmount) @@ -48,7 +49,8 @@ contract TestLibs is function publicIsRoundingError( uint256 numerator, uint256 denominator, - uint256 target) + uint256 target + ) public pure returns (bool isError) diff --git a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol b/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol index 591ae3378..e1a610469 100644 --- a/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol +++ b/packages/contracts/src/2.0.0/test/TestSignatureValidator/TestSignatureValidator.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../../protocol/Exchange/MixinSignatureValidator.sol"; import "../../protocol/Exchange/MixinTransactions.sol"; diff --git a/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol b/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol index 5076dedc9..6278aede0 100644 --- a/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol +++ b/packages/contracts/src/2.0.0/test/TestValidator/TestValidator.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../protocol/Exchange/interfaces/IValidator.sol"; @@ -27,7 +27,7 @@ contract TestValidator is // The single valid signer for this wallet. // solhint-disable-next-line var-name-mixedcase - address VALID_SIGNER; + address internal VALID_SIGNER; /// @dev constructs a new `TestValidator` with a single valid signer. /// @param validSigner The sole, valid signer. @@ -40,6 +40,7 @@ contract TestValidator is /// @param signerAddress Address that should have signed the given hash. /// @param signature Proof of signing. /// @return Validity of signature. + // solhint-disable no-unused-vars function isValidSignature( bytes32 hash, address signerAddress, @@ -51,4 +52,5 @@ contract TestValidator is { return (signerAddress == VALID_SIGNER); } + // solhint-enable no-unused-vars } diff --git a/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol b/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol index 07dfac588..0415823e3 100644 --- a/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol +++ b/packages/contracts/src/2.0.0/test/TestWallet/TestWallet.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "../../protocol/Exchange/interfaces/IWallet.sol"; import "../../utils/LibBytes/LibBytes.sol"; @@ -27,11 +27,9 @@ contract TestWallet is { using LibBytes for bytes; - string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED"; - // The owner of this wallet. // solhint-disable-next-line var-name-mixedcase - address WALLET_OWNER; + address internal WALLET_OWNER; /// @dev constructs a new `TestWallet` with a single owner. /// @param walletOwner The owner of this wallet. @@ -54,7 +52,7 @@ contract TestWallet is { require( eip712Signature.length == 65, - LENGTH_65_REQUIRED + "LENGTH_65_REQUIRED" ); uint8 v = uint8(eip712Signature[0]); diff --git a/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol b/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol index 07bd7d531..60cac26ea 100644 --- a/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol +++ b/packages/contracts/src/2.0.0/test/Whitelist/Whitelist.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; pragma experimental ABIEncoderV2; import "../../protocol/Exchange/interfaces/IExchange.sol"; @@ -27,28 +27,22 @@ import "../../utils/Ownable/Ownable.sol"; contract Whitelist is Ownable { - // Revert reasons - string constant MAKER_NOT_WHITELISTED = "MAKER_NOT_WHITELISTED"; // Maker address not whitelisted. - string constant TAKER_NOT_WHITELISTED = "TAKER_NOT_WHITELISTED"; // Taker address not whitelisted. - string constant INVALID_SENDER = "INVALID_SENDER"; // Sender must equal transaction origin. // Mapping of address => whitelist status. mapping (address => bool) public isWhitelisted; // Exchange contract. - // solhint-disable-next-line var-name-mixedcase - IExchange EXCHANGE; + // solhint-disable var-name-mixedcase + IExchange internal EXCHANGE; + bytes internal TX_ORIGIN_SIGNATURE; + // solhint-enable var-name-mixedcase - byte constant VALIDATOR_SIGNATURE_BYTE = "\x06"; - // solhint-disable-next-line var-name-mixedcase - bytes TX_ORIGIN_SIGNATURE; + byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x06"; constructor (address _exchange) public { - // solhint-disable-next-line var-name-mixedcase EXCHANGE = IExchange(_exchange); - // solhint-disable-next-line var-name-mixedcase TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE); } @@ -65,6 +59,27 @@ contract Whitelist is isWhitelisted[target] = isApproved; } + /// @dev Verifies signer is same as signer of current Ethereum transaction. + /// NOTE: This function can currently be used to validate signatures coming from outside of this contract. + /// Extra safety checks can be added for a production contract. + /// @param signerAddress Address that should have signed the given hash. + /// @param signature Proof of signing. + /// @return Validity of order signature. + // solhint-disable no-unused-vars + function isValidSignature( + bytes32 hash, + address signerAddress, + bytes signature + ) + external + view + returns (bool isValid) + { + // solhint-disable-next-line avoid-tx-origin + return signerAddress == tx.origin; + } + // solhint-enable no-unused-vars + /// @dev Fills an order using `msg.sender` as the taker. /// The transaction will revert if both the maker and taker are not whitelisted. /// Orders should specify this contract as the `senderAddress` in order to gaurantee @@ -85,20 +100,21 @@ contract Whitelist is // This contract must be the entry point for the transaction. require( + // solhint-disable-next-line avoid-tx-origin takerAddress == tx.origin, - INVALID_SENDER + "INVALID_SENDER" ); // Check if maker is on the whitelist. require( isWhitelisted[order.makerAddress], - MAKER_NOT_WHITELISTED + "MAKER_NOT_WHITELISTED" ); // Check if taker is on the whitelist. require( isWhitelisted[takerAddress], - TAKER_NOT_WHITELISTED + "TAKER_NOT_WHITELISTED" ); // Encode arguments into byte array. @@ -117,22 +133,4 @@ contract Whitelist is TX_ORIGIN_SIGNATURE ); } - - /// @dev Verifies signer is same as signer of current Ethereum transaction. - /// NOTE: This function can currently be used to validate signatures coming from outside of this contract. - /// Extra safety checks can be added for a production contract. - /// @param signerAddress Address that should have signed the given hash. - /// @param signature Proof of signing. - /// @return Validity of order signature. - function isValidSignature( - bytes32 hash, - address signerAddress, - bytes signature - ) - external - view - returns (bool isValid) - { - return signerAddress == tx.origin; - } } diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol b/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol index 59dc7d7bf..d9950145d 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol +++ b/packages/contracts/src/2.0.0/tokens/ERC20Token/ERC20Token.sol @@ -16,20 +16,15 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "./IERC20Token.sol"; contract ERC20Token is IERC20Token { - string constant INSUFFICIENT_BALANCE = "ERC20_INSUFFICIENT_BALANCE"; - string constant INSUFFICIENT_ALLOWANCE = "ERC20_INSUFFICIENT_ALLOWANCE"; - string constant OVERFLOW = "Transfer would result in an overflow."; - - mapping (address => uint256) balances; - mapping (address => mapping (address => uint256)) allowed; + mapping (address => uint256) internal balances; + mapping (address => mapping (address => uint256)) internal allowed; uint256 public totalSupply; @@ -39,11 +34,11 @@ contract ERC20Token is IERC20Token { { require( balances[msg.sender] >= _value, - INSUFFICIENT_BALANCE + "ERC20_INSUFFICIENT_BALANCE" ); require( balances[_to] + _value >= balances[_to], - OVERFLOW + "OVERFLOW" ); balances[msg.sender] -= _value; balances[_to] += _value; @@ -57,15 +52,15 @@ contract ERC20Token is IERC20Token { { require( balances[_from] >= _value, - INSUFFICIENT_BALANCE + "ERC20_INSUFFICIENT_BALANCE" ); require( allowed[_from][msg.sender] >= _value, - INSUFFICIENT_ALLOWANCE + "ERC20_INSUFFICIENT_ALLOWANCE" ); require( balances[_to] + _value >= balances[_to], - OVERFLOW + "OVERFLOW" ); balances[_to] += _value; balances[_from] -= _value; @@ -84,7 +79,8 @@ contract ERC20Token is IERC20Token { } function balanceOf(address _owner) - public view + public + view returns (uint256) { return balances[_owner]; diff --git a/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol b/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol index de4ed2af9..5ee5e1011 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol +++ b/packages/contracts/src/2.0.0/tokens/ERC20Token/IERC20Token.sol @@ -16,8 +16,7 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; contract IERC20Token { @@ -60,6 +59,7 @@ contract IERC20Token { public view returns (uint256); + // solhint-disable-next-line no-simple-event-func-name event Transfer( address indexed _from, address indexed _to, diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol b/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol index defb506a8..60603aa19 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol +++ b/packages/contracts/src/2.0.0/tokens/ERC721Token/ERC721Token.sol @@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; import "./IERC721Token.sol"; import "./IERC721Receiver.sol"; @@ -41,7 +41,7 @@ contract ERC721Token is { // Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))` // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` - bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; + bytes4 constant internal ERC721_RECEIVED = 0xf0b9e5ba; // Mapping from token ID to owner mapping (uint256 => address) internal tokenOwner; @@ -73,7 +73,7 @@ contract ERC721Token is _; } - function ERC721Token( + constructor ( string _name, string _symbol) public diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol b/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol index f72c75638..f2e8f3c88 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol +++ b/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Receiver.sol @@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; /** @@ -38,7 +38,7 @@ contract IERC721Receiver { * Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`, * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` */ - bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; + bytes4 constant internal ERC721_RECEIVED = 0xf0b9e5ba; /** * @notice Handle the receipt of an NFT diff --git a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol b/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol index 0d64ee861..4d57ece38 100644 --- a/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol +++ b/packages/contracts/src/2.0.0/tokens/ERC721Token/IERC721Token.sol @@ -23,7 +23,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; /** @@ -40,11 +40,13 @@ contract IERC721Token { address indexed _to, uint256 _tokenId ); + event Approval( address indexed _owner, address indexed _approved, uint256 _tokenId ); + event ApprovalForAll( address indexed _owner, address indexed _operator, @@ -55,6 +57,7 @@ contract IERC721Token { public view returns (string); + function symbol() public view @@ -64,10 +67,12 @@ contract IERC721Token { public view returns (uint256 _balance); + function ownerOf(uint256 _tokenId) public view returns (address _owner); + function exists(uint256 _tokenId) public view @@ -75,6 +80,7 @@ contract IERC721Token { function approve(address _to, uint256 _tokenId) public; + function getApproved(uint256 _tokenId) public view @@ -82,6 +88,7 @@ contract IERC721Token { function setApprovalForAll(address _operator, bool _approved) public; + function isApprovedForAll(address _owner, address _operator) public view @@ -90,17 +97,22 @@ contract IERC721Token { function transferFrom( address _from, address _to, - uint256 _tokenId) + uint256 _tokenId + ) public; + function safeTransferFrom( address _from, address _to, - uint256 _tokenId) + uint256 _tokenId + ) public; + function safeTransferFrom( address _from, address _to, uint256 _tokenId, - bytes _data) + bytes _data + ) public; } diff --git a/packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol b/packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol new file mode 100644 index 000000000..9e2e68766 --- /dev/null +++ b/packages/contracts/src/2.0.0/tokens/EtherToken/IEtherToken.sol @@ -0,0 +1,33 @@ +/* + + 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.24; + +import "../ERC20Token/IERC20Token.sol"; + + +contract IEtherToken is + IERC20Token +{ + function deposit() + public + payable; + + function withdraw(uint256 amount) + public; +} diff --git a/packages/contracts/src/2.0.0/tokens/WETH9/WETH9.sol b/packages/contracts/src/2.0.0/tokens/EtherToken/WETH9.sol index 378a507b9..1fdb04de5 100644 --- a/packages/contracts/src/2.0.0/tokens/WETH9/WETH9.sol +++ b/packages/contracts/src/2.0.0/tokens/EtherToken/WETH9.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. +// solhint-disable pragma solidity ^0.4.18; diff --git a/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol b/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol index 845324e4e..9feb5c914 100644 --- a/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol +++ b/packages/contracts/src/2.0.0/tokens/UnlimitedAllowanceToken/UnlimitedAllowanceToken.sol @@ -16,15 +16,14 @@ */ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; import "../ERC20Token/ERC20Token.sol"; contract UnlimitedAllowanceToken is ERC20Token { - uint256 constant MAX_UINT = 2**256 - 1; + uint256 constant internal MAX_UINT = 2**256 - 1; /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717 /// @param _from Address to transfer from. @@ -38,15 +37,15 @@ contract UnlimitedAllowanceToken is ERC20Token { uint256 allowance = allowed[_from][msg.sender]; require( balances[_from] >= _value, - INSUFFICIENT_BALANCE + "ERC20_INSUFFICIENT_BALANCE" ); require( allowance >= _value, - INSUFFICIENT_ALLOWANCE + "ERC20_INSUFFICIENT_ALLOWANCE" ); require( balances[_to] + _value >= balances[_to], - OVERFLOW + "OVERFLOW" ); balances[_to] += _value; balances[_from] -= _value; diff --git a/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol b/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol index ed0670072..28c0b2fb3 100644 --- a/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol +++ b/packages/contracts/src/2.0.0/tokens/ZRXToken/ZRXToken.sol @@ -16,20 +16,24 @@ */ -pragma solidity ^0.4.11; +pragma solidity 0.4.11; +// solhint-disable-next-line max-line-length import { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from "../../../1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol"; - contract ZRXToken is UnlimitedAllowanceToken { + // solhint-disable const-name-snakecase uint8 constant public decimals = 18; uint 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() { + function ZRXToken() + public + { balances[msg.sender] = totalSupply; } } diff --git a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol index c2fff5efb..01d34fa8f 100644 --- a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.4.24; +pragma solidity 0.4.24; library LibBytes { @@ -115,6 +115,7 @@ library LibBytes { // Copy whole words front to back // Note: the first check is always true, // this could have been a do-while loop. + // solhint-disable-next-line no-empty-blocks for {} lt(source, sEnd) {} { mstore(dest, mload(source)) source := add(source, 32) @@ -145,6 +146,7 @@ library LibBytes { // 2**255, so they can be safely re-interpreted as signed. // Note: the first check is always true, // this could have been a do-while loop. + // solhint-disable-next-line no-empty-blocks for {} slt(dest, dEnd) {} { mstore(dEnd, mload(sEnd)) sEnd := sub(sEnd, 32) @@ -157,13 +159,17 @@ library LibBytes { } } } - + /// @dev Returns a slices from a byte array. /// @param b The byte array to take a slice from. /// @param from The starting index for the slice (inclusive). /// @param to The final index for the slice (exclusive). /// @return result The slice containing bytes at indices [from, to) - function slice(bytes memory b, uint256 from, uint256 to) + function slice( + bytes memory b, + uint256 from, + uint256 to + ) internal pure returns (bytes memory result) @@ -192,7 +198,11 @@ library LibBytes { /// @param to The final index for the slice (exclusive). /// @return result The slice containing bytes at indices [from, to) /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted. - function sliceDestructive(bytes memory b, uint256 from, uint256 to) + function sliceDestructive( + bytes memory b, + uint256 from, + uint256 to + ) internal pure returns (bytes memory result) @@ -344,7 +354,10 @@ library LibBytes { // 1. Add index to address of bytes array // 2. Load 32-byte word from memory // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address - let neighbors := and(mload(add(b, index)), 0xffffffffffffffffffffffff0000000000000000000000000000000000000000) + let neighbors := and( + mload(add(b, index)), + 0xffffffffffffffffffffffff0000000000000000000000000000000000000000 + ) // Make sure input address is clean. // (Solidity does not guarantee this) @@ -509,7 +522,7 @@ library LibBytes { // Assert length of <b> is valid, given // length of input require( - b.length >= index + 32 /* 32 bytes to store length */ + input.length, + b.length >= index + 32 + input.length, // 32 bytes to store length "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED" ); diff --git a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol b/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol index e77680903..116b8dc89 100644 --- a/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol +++ b/packages/contracts/src/2.0.0/utils/Ownable/IOwnable.sol @@ -1,5 +1,4 @@ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; /* * Ownable diff --git a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol b/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol index 489793a95..aca65aad2 100644 --- a/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol +++ b/packages/contracts/src/2.0.0/utils/Ownable/Ownable.sol @@ -1,5 +1,4 @@ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; /* * Ownable diff --git a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol b/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol index ec0a3fe76..4413244db 100644 --- a/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol +++ b/packages/contracts/src/2.0.0/utils/SafeMath/SafeMath.sol @@ -1,28 +1,27 @@ -pragma solidity ^0.4.24; -pragma experimental ABIEncoderV2; +pragma solidity 0.4.24; contract SafeMath { - function safeMul(uint a, uint b) + function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { - uint c = a * b; + uint256 c = a * b; assert(a == 0 || c / a == b); return c; } - function safeDiv(uint a, uint b) + function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { - uint c = a / b; + uint256 c = a / b; return c; } - function safeSub(uint a, uint b) + function safeSub(uint256 a, uint256 b) internal pure returns (uint256) @@ -31,12 +30,12 @@ contract SafeMath { return a - b; } - function safeAdd(uint a, uint b) + function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { - uint c = a + b; + uint256 c = a + b; assert(c >= a); return c; } diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 6c52bbf6b..56ecd023e 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.4.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.4.4", "changes": [ diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index af4a800cc..55e12b2dd 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.4.5 - _July 9, 2018_ + + * Dependencies updated + ## v0.4.4 - _June 19, 2018_ * Dependencies updated diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 15f8d6ab0..1808e23e4 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "0.4.4", + "version": "0.4.5", "engines": { "node": ">=6.12" }, @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "chai": "^4.0.1", @@ -45,12 +45,12 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/subproviders": "^0.10.4", - "@0xproject/types": "^0.8.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/types": "^0.8.2", + "@0xproject/utils": "^0.7.2", "ethereum-types": "^0.0.2", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/web3-wrapper": "^0.7.2", "lodash": "^4.17.4", "web3-provider-engine": "14.0.6" }, diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 822f8d5d5..cf36adf16 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -9,6 +9,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.4", "changes": [ diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index e609fc88c..02618b89c 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.5 - _July 9, 2018_ + + * Dependencies updated + ## v0.0.4 - _June 19, 2018_ * Dependencies updated diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 32b02947f..4e1ceeac0 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -28,10 +28,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", @@ -41,13 +41,13 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/base-contract": "^0.3.4", + "@0xproject/base-contract": "^0.3.5", "@0xproject/order-utils": "^1.0.0", "@0xproject/types": "1.0.0", "ethereum-types": "^0.0.2", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "ethers": "3.0.22", "lodash": "^4.17.4" }, diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index dfefdfc77..42ef2065e 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -13,6 +13,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.8.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.8.1", "changes": [ diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 46a7c18cd..2524cd768 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.8.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.8.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index f7c9d101b..8ecb41721 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -47,15 +47,15 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", "dependencies": { - "@0xproject/typescript-typings": "^0.4.1", + "@0xproject/typescript-typings": "^0.4.2", "@types/node": "^8.0.53", "jsonschema": "^1.2.0", "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", - "@0xproject/utils": "^0.7.1", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", + "@0xproject/utils": "^0.7.2", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 3fa79387e..9b96441c4 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.8", + "version": "0.0.9", "engines": { "node": ">=6.12" }, @@ -29,16 +29,16 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/base-contract": "^0.3.4", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/sol-cov": "^0.1.1", - "@0xproject/subproviders": "^0.10.4", - "@0xproject/tslint-config": "^0.4.20", - "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/base-contract": "^0.3.5", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/sol-cov": "^0.1.2", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/tslint-config": "^0.4.21", + "@0xproject/types": "^0.8.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", "ethereum-types": "^0.0.2", @@ -48,7 +48,7 @@ "web3-provider-engine": "14.0.6" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.4", + "@0xproject/dev-utils": "^0.4.5", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 0eb67736e..9852eeb11 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.0.9", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.8", "changes": [ diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index a5445ce80..e97b1fdec 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.9 - _July 9, 2018_ + + * Dependencies updated + ## v0.0.8 - _June 19, 2018_ * Dependencies updated diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 32accb57a..0b7ab8ae2 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "0.0.8", + "version": "0.0.9", "engines": { "node": ">=6.12" }, @@ -37,10 +37,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/tslint-config": "^0.4.20", - "@0xproject/types": "^0.8.1", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/tslint-config": "^0.4.21", + "@0xproject/types": "^0.8.2", "@types/yargs": "^10.0.0", "yargs": "^10.0.3", "make-promises-safe": "^1.1.0", @@ -50,13 +50,13 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/base-contract": "^0.3.4", + "@0xproject/base-contract": "^0.3.5", "@0xproject/order-utils": "^1.0.0", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/subproviders": "^0.10.4", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/subproviders": "^0.10.5", "@0xproject/typescript-typings": "^0.4.2", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^0.0.2", "ethers": "3.0.22", diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json index 781704a8e..8cf8c60c6 100644 --- a/packages/monorepo-scripts/CHANGELOG.json +++ b/packages/monorepo-scripts/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "0.2.2", + "version": "0.2.3", "changes": [ { "note": "Fix git remote tag removal step & add an additional sanity assertion", @@ -9,6 +9,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.2.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.2.1", "changes": [ diff --git a/packages/monorepo-scripts/CHANGELOG.md b/packages/monorepo-scripts/CHANGELOG.md index 7e5aadef0..aa3a06440 100644 --- a/packages/monorepo-scripts/CHANGELOG.md +++ b/packages/monorepo-scripts/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.2.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.2.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 270b5d2c7..7ebe4fb84 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/monorepo-scripts", - "version": "0.2.1", + "version": "0.2.2", "engines": { "node": ">=6.12" }, diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 199ce2173..715d58a43 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -13,6 +13,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.0.8", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.7", "changes": [ diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 81b66373a..672affc19 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.8 - _July 9, 2018_ + + * Dependencies updated + ## v0.0.7 - _June 19, 2018_ * Dependencies updated diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index ce209561f..8f5041609 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -51,9 +51,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/ethereumjs-abi": "^0.6.0", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -73,13 +73,13 @@ }, "dependencies": { "@0xproject/assert": "^0.3.0", - "@0xproject/base-contract": "^0.3.4", + "@0xproject/base-contract": "^0.3.5", "@0xproject/json-schemas": "1.0.0", - "@0xproject/sol-compiler": "^0.5.2", + "@0xproject/sol-compiler": "^0.5.3", "@0xproject/types": "^1.0.0", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "@types/node": "^8.0.53", "bn.js": "^4.11.8", "ethereum-types": "^0.0.2", diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 6104fc81c..a66db6eec 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Do not stop subscription if error is encountered", "pr": 825 } - ] + ], + "timestamp": 1531149657 }, { "timestamp": 1529397769, diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index 5e216f90c..c14b66e39 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.7 - _July 9, 2018_ + + * Switch out simple getLogs polling with ethereumjs-blockstream (#825) + * Do not stop subscription if error is encountered (#825) + ## v0.0.6 - _June 19, 2018_ * Dependencies updated diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 44748ddf9..27d64a371 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -47,12 +47,12 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.3.2", - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/migrations": "^0.0.8", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/abi-gen": "^0.3.3", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/migrations": "^0.0.9", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/tslint-config": "^0.4.21", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -77,16 +77,16 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/assert": "0.2.12", - "@0xproject/base-contract": "^0.3.4", + "@0xproject/assert": "0.2.13", + "@0xproject/base-contract": "^0.3.5", "@0xproject/contract-wrappers": "0.0.5", - "@0xproject/fill-scenarios": "^0.0.4", - "@0xproject/json-schemas": "0.8.1", - "@0xproject/order-utils": "^0.0.7", - "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", + "@0xproject/fill-scenarios": "^0.0.5", + "@0xproject/json-schemas": "0.8.2", + "@0xproject/order-utils": "^0.0.8", + "@0xproject/types": "^0.8.2", + "@0xproject/typescript-typings": "^0.4.2", "@0xproject/utils": "^0.7.2", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/web3-wrapper": "^0.7.2", "ethereumjs-blockstream": "5.0.0", "ethereum-types": "^0.0.2", "bintrees": "^1.0.2", diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index 3a743df77..6fd9aca22 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/react-docs-example", - "version": "0.0.13", + "version": "0.0.14", "engines": { "node": ">=6.12" }, @@ -26,7 +26,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", @@ -50,7 +50,7 @@ "webpack-dev-server": "^2.11.1" }, "dependencies": { - "@0xproject/react-docs": "^0.0.14", + "@0xproject/react-docs": "^0.0.15", "basscss": "^8.0.3", "lodash": "^4.17.4", "material-ui": "^0.17.1", diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 30e48197d..c6ee9510c 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.0.15", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.14", "changes": [ diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index fcbf3698b..c438a535a 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.15 - _July 9, 2018_ + + * Dependencies updated + ## v0.0.14 - _June 19, 2018_ * Dependencies updated diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 8c70f4f6d..5fe493457 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "0.0.14", + "version": "0.0.15", "engines": { "node": ">=6.12" }, @@ -25,9 +25,9 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/compare-versions": "^3.0.0", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", @@ -36,8 +36,8 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/react-shared": "^0.2.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/react-shared": "^0.2.2", + "@0xproject/utils": "^0.7.2", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index deee2c6e6..f05207c0c 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.2.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.2.1", "changes": [ diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index b28923eec..5b3b16f37 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.2.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.2.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index b2ba67ed3..52c37d924 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "0.2.1", + "version": "0.2.2", "engines": { "node": ">=6.12" }, @@ -25,9 +25,9 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index bb1a5f006..c96efcd89 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.5.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.5.2", "changes": [ diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 524a361de..1a69a1c8e 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.5.3 - _July 9, 2018_ + + * Dependencies updated + ## v0.5.2 - _June 19, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index d5a2e6e77..e738ab56b 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "0.5.2", + "version": "0.5.3", "engines": { "node": ">=6.12" }, @@ -53,9 +53,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.4.4", - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/dev-utils": "^0.4.5", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", "@types/semver": "^5.5.0", @@ -76,13 +76,13 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0xproject/assert": "0.2.12", - "@0xproject/json-schemas": "0.8.1", - "@0xproject/sol-resolver": "^0.0.7", - "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/assert": "0.2.13", + "@0xproject/json-schemas": "0.8.2", + "@0xproject/sol-resolver": "^0.0.8", + "@0xproject/types": "^0.8.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "@types/yargs": "^11.0.0", "ethereum-types": "^0.0.2", "chalk": "^2.3.0", diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 3b6071801..8a622162f 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -77,6 +77,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.1.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.1.1", "changes": [ diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index d8f7c5310..0ed77253e 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.1.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.1.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 483500ca9..8553da7a4 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "0.1.1", + "version": "0.1.2", "engines": { "node": ">=6.12" }, @@ -50,12 +50,12 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/sol-compiler": "^0.5.2", - "@0xproject/subproviders": "^0.10.4", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", - "@0xproject/dev-utils": "^0.4.4", + "@0xproject/sol-compiler": "^0.5.3", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", + "@0xproject/dev-utils": "^0.4.5", "ethereum-types": "^0.0.2", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 99c1387d1..1e39c1b39 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "0.0.8", + "version": "0.0.9", "changes": [ { "note": "Fix a bug in FsResolver where it tries to read directories as files", @@ -13,6 +13,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.0.8", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.7", "changes": [ diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 514121ee1..ecfff34e3 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.0.8 - _July 9, 2018_ + + * Dependencies updated + ## v0.0.7 - _June 19, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index ae36648e9..715b19d0e 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "0.0.7", + "version": "0.0.8", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", @@ -33,7 +33,7 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.8.1", + "@0xproject/types": "^0.8.2", "@0xproject/typescript-typings": "^0.0.3", "lodash": "^4.17.4" }, diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index d4ca1aebb..1a90331c7 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.1.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.1.4", "changes": [ diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 8acda5aa5..8831789ac 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.1.5 - _July 9, 2018_ + + * Dependencies updated + ## v0.1.4 - _June 19, 2018_ * Dependencies updated diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 4bd0a4800..29a2dcfcb 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "0.1.4", + "version": "0.1.5", "engines": { "node": ">=6.12" }, @@ -36,20 +36,20 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { "@0xproject/assert": "^0.3.0", - "@0xproject/types": "^0.8.1", - "@0xproject/order-utils": "^0.0.7", - "@0xproject/connect": "0.6.15", - "@0xproject/json-schemas": "0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/types": "^0.8.2", + "@0xproject/order-utils": "^0.0.8", + "@0xproject/connect": "0.6.16", + "@0xproject/json-schemas": "0.8.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", "chalk": "^2.3.0", "lodash": "^4.17.4", "newman": "^3.9.3", "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.48", "@types/nock": "^9.1.2", diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index c4dca2864..7a3f29fe0 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -5,7 +5,8 @@ { "note": "Add `EthLightwalletSubprovider`" } - ] + ], + "timestamp": 1531149657 }, { "timestamp": 1529397769, diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 855524e4a..6fab0a4c4 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.10.5 - _July 9, 2018_ + + * Update web3-provider-engine to v14.0.6 including the leaked global.XMLHttpRequest bug fix + ## v0.10.4 - _June 19, 2018_ * Dependencies updated diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index a5886cbb2..bdc846e6b 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "0.10.4", + "version": "0.10.5", "engines": { "node": ">=6.12" }, @@ -42,9 +42,9 @@ "dependencies": { "@0xproject/assert": "^0.3.0", "@0xproject/types": "^1.0.0", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/web3-wrapper": "^0.7.2", "@0xproject/typescript-typings": "^0.4.2", - "@0xproject/utils": "^0.7.1", + "@0xproject/utils": "^0.7.2", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "ethereum-types": "^0.0.2", @@ -60,9 +60,9 @@ "web3-provider-engine": "14.0.6" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", - "@0xproject/utils": "^0.7.1", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", + "@0xproject/utils": "^0.7.2", "@types/bip39": "^2.4.0", "@types/bn.js": "^4.11.0", "@types/hdkey": "^0.7.0", diff --git a/packages/subproviders/src/subproviders/signer.ts b/packages/subproviders/src/subproviders/signer.ts index 08a9daceb..f7329e00c 100644 --- a/packages/subproviders/src/subproviders/signer.ts +++ b/packages/subproviders/src/subproviders/signer.ts @@ -1,4 +1,4 @@ -import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; import { JSONRPCRequestPayload, Provider } from 'ethereum-types'; import { Callback, ErrorCallback } from '../types'; @@ -51,7 +51,8 @@ export class SignerSubprovider extends Subprovider { case 'eth_sendTransaction': const [txParams] = payload.params; try { - const txHash = await this._web3Wrapper.sendTransactionAsync(txParams); + const txData = marshaller.unmarshalTxData(txParams); + const txHash = await this._web3Wrapper.sendTransactionAsync(txData); end(null, txHash); } catch (err) { end(err); diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 5acd4ae35..72ab8f61b 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.34", + "version": "1.0.35", "engines": { "node": ">=6.12" }, @@ -19,10 +19,10 @@ "license": "Apache-2.0", "dependencies": { "0x.js": "^0.38.0", - "@0xproject/subproviders": "^0.10.4", - "@0xproject/web3-wrapper": "^0.7.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/subproviders": "^0.10.5", + "@0xproject/web3-wrapper": "^0.7.2", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", @@ -32,7 +32,7 @@ "web3-provider-engine": "14.0.6" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/tslint-config": "^0.4.21", "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "4.14.104", diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json index ffb0c4e81..f2a3456f4 100644 --- a/packages/tslint-config/CHANGELOG.json +++ b/packages/tslint-config/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1531149657, + "version": "0.4.21", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.4.20", "changes": [ diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md index 2a862f8e1..88e17b694 100644 --- a/packages/tslint-config/CHANGELOG.md +++ b/packages/tslint-config/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.4.21 - _July 9, 2018_ + + * Dependencies updated + ## v0.4.20 - _June 19, 2018_ * Dependencies updated diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 9cb6a2da0..356499f6b 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/tslint-config", - "version": "0.4.20", + "version": "0.4.21", "engines": { "node": ">=6.12" }, @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/tslint-config/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.2.2", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 36be06d0f..ea3b49c8a 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -14,6 +14,15 @@ ] }, { + "timestamp": 1531149657, + "version": "0.8.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.8.1", "changes": [ diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index aa3ba5eab..d235e31b7 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.8.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.8.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/types/package.json b/packages/types/package.json index f79b558fa..b5e09d42e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 3b71366f5..03fa2fe8a 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -158,7 +158,6 @@ export interface ECSignature { } export enum AssetProxyId { - INVALID = '0x00000000', ERC20 = '0xf47261b0', ERC721 = '0x08e937fa', } diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index 1d4230783..813da155e 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -27,9 +27,11 @@ { "note": "Dependencies updated" } - ] + ], + "timestamp": 1531149657 }, { + "timestamp": 1529397769, "version": "0.4.0", "changes": [ { diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index a34ff86e1..26d54716c 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,9 +5,16 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v0.4.1 - _June 19, 2018_ +## v0.4.2 - _July 9, 2018_ - * Dependencies updated + * Improve 'web3-provider-engine' typings (#768) + * Additional error type for `ethers.js` (#763) + +## v0.4.0 - _June 19, 2018_ + + * Add types for `react-joyride` + * Add types for `react-popper`, remove types for `react-joyride` + * Remove types for blockies, bn.js, compare-versions, ethereumjs-abi, ethereumjs-tx, find-versions, hdkey, is-mobile, solidity-parser-antlr, xml-js as they were moved to DefinitelyTyped (#641) ## v0.4.0 - _June 1, 2018_ diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index e3f226294..6bd533676 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -29,7 +29,7 @@ "bignumber.js": "~4.1.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.2.2", "copyfiles": "^1.2.0", "shx": "^0.2.2" }, diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index a27216be7..0ac49952b 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -13,7 +13,8 @@ "note": "Fixes uncaught Error in abi_decoder", "pr": 763 } - ] + ], + "timestamp": 1531149657 }, { "timestamp": 1529397769, diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 60a575297..e2464232c 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.7.2 - _July 9, 2018_ + + * Added errorUtils.spawnSwitchErr + * Add logUtils.warn (#589) + * Fixes uncaught Error in abi_decoder (#763) + ## v0.7.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/utils/package.json b/packages/utils/package.json index 0ba7a7ba4..9168a3538 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", @@ -40,6 +40,8 @@ "@types/node": "^8.0.53", "ethereumjs-util": "^5.1.1", "bignumber.js": "~4.1.0", + "ethereum-types": "^0.0.2", + "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "js-sha3": "^0.7.0", "lodash": "^4.17.4" diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index f8b1dab85..0b83ad13d 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,15 +1,27 @@ [ { - "timestamp": 1529397769, - "version": "0.7.2", + "version": "0.7.3", "changes": [ { + "note": "Export `marshaller` utility file.", + "pr": 829 + }, + { "note": "Add `getNodeTypeAsync` method", "pr": 812 } ] }, { + "timestamp": 1531149657, + "version": "0.7.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.7.1", "changes": [ diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 1ac36a316..f6795100e 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v0.7.2 - _July 9, 2018_ + + * Dependencies updated + ## v0.7.1 - _June 19, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 21455f67a..9716be5bf 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "0.7.1", + "version": "0.7.2", "engines": { "node": ">=6.12" }, @@ -45,8 +45,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.2.1", - "@0xproject/tslint-config": "^0.4.20", + "@0xproject/monorepo-scripts": "^0.2.2", + "@0xproject/tslint-config": "^0.4.21", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -66,8 +66,8 @@ "dependencies": { "@0xproject/assert": "0.3.0", "@0xproject/json-schemas": "^1.0.0", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", "ethereum-types": "^0.0.2", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 66ef0a784..19fe0836c 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,2 +1,3 @@ export { Web3Wrapper, uniqueVersionIds, NodeType } from './web3_wrapper'; export { Web3WrapperErrors } from './types'; +export { marshaller } from './marshaller'; diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts index e9fd35a11..15384417e 100644 --- a/packages/web3-wrapper/src/marshaller.ts +++ b/packages/web3-wrapper/src/marshaller.ts @@ -73,6 +73,19 @@ export const marshaller = { }; return tx; }, + unmarshalTxData(txDataRpc: TxDataRPC): TxData { + if (_.isUndefined(txDataRpc.from)) { + throw new Error(`txData must include valid 'from' value.`); + } + const txData = { + ...txDataRpc, + value: !_.isUndefined(txDataRpc.value) ? utils.convertHexToNumber(txDataRpc.value) : undefined, + gas: !_.isUndefined(txDataRpc.gas) ? utils.convertHexToNumber(txDataRpc.gas) : undefined, + gasPrice: !_.isUndefined(txDataRpc.gasPrice) ? utils.convertHexToNumber(txDataRpc.gasPrice) : undefined, + nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined, + }; + return txData; + }, marshalTxData(txData: Partial<TxData>): Partial<TxDataRPC> { if (_.isUndefined(txData.from)) { throw new Error(`txData must include valid 'from' value.`); diff --git a/packages/website/package.json b/packages/website/package.json index a5768a60b..a3ca047fa 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.37", + "version": "0.0.38", "engines": { "node": ">=6.12" }, @@ -19,13 +19,14 @@ "license": "Apache-2.0", "dependencies": { "@0xproject/contract-wrappers": "^0.0.5", - "@0xproject/react-docs": "^0.0.14", - "@0xproject/react-shared": "^0.2.1", - "@0xproject/subproviders": "^0.10.4", + "@0xproject/order-utils": "^0.0.8", + "@0xproject/react-docs": "^0.0.15", + "@0xproject/react-shared": "^0.2.2", + "@0xproject/subproviders": "^0.10.5", "@0xproject/types": "^0.8.1", - "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", - "@0xproject/web3-wrapper": "^0.7.1", + "@0xproject/typescript-typings": "^0.4.2", + "@0xproject/utils": "^0.7.2", + "@0xproject/web3-wrapper": "^0.7.2", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", diff --git a/packages/website/public/images/token_icons/firstblood.jpg b/packages/website/public/images/token_icons/1ST.png Binary files differindex 9cd23b10e..9cd23b10e 100644 --- a/packages/website/public/images/token_icons/firstblood.jpg +++ b/packages/website/public/images/token_icons/1ST.png diff --git a/packages/website/public/images/token_icons/ABYSS.png b/packages/website/public/images/token_icons/ABYSS.png Binary files differnew file mode 100644 index 000000000..6ed2efef8 --- /dev/null +++ b/packages/website/public/images/token_icons/ABYSS.png diff --git a/packages/website/public/images/token_icons/ADT.png b/packages/website/public/images/token_icons/ADT.png Binary files differnew file mode 100644 index 000000000..2e7f3f54f --- /dev/null +++ b/packages/website/public/images/token_icons/ADT.png diff --git a/packages/website/public/images/token_icons/AE.png b/packages/website/public/images/token_icons/AE.png Binary files differnew file mode 100644 index 000000000..01dc13dda --- /dev/null +++ b/packages/website/public/images/token_icons/AE.png diff --git a/packages/website/public/images/token_icons/AION.png b/packages/website/public/images/token_icons/AION.png Binary files differnew file mode 100644 index 000000000..a2bfb9253 --- /dev/null +++ b/packages/website/public/images/token_icons/AION.png diff --git a/packages/website/public/images/token_icons/AIR.png b/packages/website/public/images/token_icons/AIR.png Binary files differnew file mode 100644 index 000000000..ab3a13b6d --- /dev/null +++ b/packages/website/public/images/token_icons/AIR.png diff --git a/packages/website/public/images/token_icons/ANT.png b/packages/website/public/images/token_icons/ANT.png Binary files differnew file mode 100644 index 000000000..437a8f21a --- /dev/null +++ b/packages/website/public/images/token_icons/ANT.png diff --git a/packages/website/public/images/token_icons/APCC.png b/packages/website/public/images/token_icons/APCC.png Binary files differnew file mode 100644 index 000000000..4294618be --- /dev/null +++ b/packages/website/public/images/token_icons/APCC.png diff --git a/packages/website/public/images/token_icons/APPC.png b/packages/website/public/images/token_icons/APPC.png Binary files differnew file mode 100644 index 000000000..4294618be --- /dev/null +++ b/packages/website/public/images/token_icons/APPC.png diff --git a/packages/website/public/images/token_icons/ARN.png b/packages/website/public/images/token_icons/ARN.png Binary files differnew file mode 100644 index 000000000..0d17bb0dd --- /dev/null +++ b/packages/website/public/images/token_icons/ARN.png diff --git a/packages/website/public/images/token_icons/ART.png b/packages/website/public/images/token_icons/ART.png Binary files differnew file mode 100644 index 000000000..194f58fa0 --- /dev/null +++ b/packages/website/public/images/token_icons/ART.png diff --git a/packages/website/public/images/token_icons/AST.png b/packages/website/public/images/token_icons/AST.png Binary files differnew file mode 100644 index 000000000..25d7c00ee --- /dev/null +++ b/packages/website/public/images/token_icons/AST.png diff --git a/packages/website/public/images/token_icons/BAT.png b/packages/website/public/images/token_icons/BAT.png Binary files differnew file mode 100644 index 000000000..840ed0a16 --- /dev/null +++ b/packages/website/public/images/token_icons/BAT.png diff --git a/packages/website/public/images/token_icons/BCAP.png b/packages/website/public/images/token_icons/BCAP.png Binary files differnew file mode 100644 index 000000000..acf50e368 --- /dev/null +++ b/packages/website/public/images/token_icons/BCAP.png diff --git a/packages/website/public/images/token_icons/BCPT.png b/packages/website/public/images/token_icons/BCPT.png Binary files differnew file mode 100644 index 000000000..e1ecbeafe --- /dev/null +++ b/packages/website/public/images/token_icons/BCPT.png diff --git a/packages/website/public/images/token_icons/BNT.png b/packages/website/public/images/token_icons/BNT.png Binary files differnew file mode 100644 index 000000000..a3b91ec34 --- /dev/null +++ b/packages/website/public/images/token_icons/BNT.png diff --git a/packages/website/public/images/token_icons/BRM.png b/packages/website/public/images/token_icons/BRM.png Binary files differnew file mode 100644 index 000000000..109c21ef5 --- /dev/null +++ b/packages/website/public/images/token_icons/BRM.png diff --git a/packages/website/public/images/token_icons/CAG.png b/packages/website/public/images/token_icons/CAG.png Binary files differnew file mode 100644 index 000000000..2aa368381 --- /dev/null +++ b/packages/website/public/images/token_icons/CAG.png diff --git a/packages/website/public/images/token_icons/CAN.png b/packages/website/public/images/token_icons/CAN.png Binary files differnew file mode 100644 index 000000000..7fdf3a9b9 --- /dev/null +++ b/packages/website/public/images/token_icons/CAN.png diff --git a/packages/website/public/images/token_icons/CAT.png b/packages/website/public/images/token_icons/CAT.png Binary files differnew file mode 100644 index 000000000..c59b6b15d --- /dev/null +++ b/packages/website/public/images/token_icons/CAT.png diff --git a/packages/website/public/images/token_icons/CFI.png b/packages/website/public/images/token_icons/CFI.png Binary files differnew file mode 100644 index 000000000..b1f2e6db9 --- /dev/null +++ b/packages/website/public/images/token_icons/CFI.png diff --git a/packages/website/public/images/token_icons/civic.png b/packages/website/public/images/token_icons/CVC.png Binary files differindex 1daf28d00..1daf28d00 100644 --- a/packages/website/public/images/token_icons/civic.png +++ b/packages/website/public/images/token_icons/CVC.png diff --git a/packages/website/public/images/token_icons/DAI.png b/packages/website/public/images/token_icons/DAI.png Binary files differnew file mode 100644 index 000000000..bf7da4a01 --- /dev/null +++ b/packages/website/public/images/token_icons/DAI.png diff --git a/packages/website/public/images/token_icons/DATA.png b/packages/website/public/images/token_icons/DATA.png Binary files differnew file mode 100644 index 000000000..43f2e6dde --- /dev/null +++ b/packages/website/public/images/token_icons/DATA.png diff --git a/packages/website/public/images/token_icons/DEB.png b/packages/website/public/images/token_icons/DEB.png Binary files differnew file mode 100644 index 000000000..c729fd265 --- /dev/null +++ b/packages/website/public/images/token_icons/DEB.png diff --git a/packages/website/public/images/token_icons/DGD.png b/packages/website/public/images/token_icons/DGD.png Binary files differnew file mode 100644 index 000000000..cb81ecb45 --- /dev/null +++ b/packages/website/public/images/token_icons/DGD.png diff --git a/packages/website/public/images/token_icons/DIVX.png b/packages/website/public/images/token_icons/DIVX.png Binary files differnew file mode 100644 index 000000000..d8d50f1f8 --- /dev/null +++ b/packages/website/public/images/token_icons/DIVX.png diff --git a/packages/website/public/images/token_icons/DNT.png b/packages/website/public/images/token_icons/DNT.png Binary files differnew file mode 100644 index 000000000..b4ac550f6 --- /dev/null +++ b/packages/website/public/images/token_icons/DNT.png diff --git a/packages/website/public/images/token_icons/edgeless.png b/packages/website/public/images/token_icons/EDG.png Binary files differindex 606784154..606784154 100644 --- a/packages/website/public/images/token_icons/edgeless.png +++ b/packages/website/public/images/token_icons/EDG.png diff --git a/packages/website/public/images/token_icons/EDU.png b/packages/website/public/images/token_icons/EDU.png Binary files differnew file mode 100644 index 000000000..d74785e5a --- /dev/null +++ b/packages/website/public/images/token_icons/EDU.png diff --git a/packages/website/public/images/token_icons/ELEC.png b/packages/website/public/images/token_icons/ELEC.png Binary files differnew file mode 100644 index 000000000..cc1a3745a --- /dev/null +++ b/packages/website/public/images/token_icons/ELEC.png diff --git a/packages/website/public/images/token_icons/EMONT.png b/packages/website/public/images/token_icons/EMONT.png Binary files differnew file mode 100644 index 000000000..ba7fe4a3d --- /dev/null +++ b/packages/website/public/images/token_icons/EMONT.png diff --git a/packages/website/public/images/token_icons/ENG.png b/packages/website/public/images/token_icons/ENG.png Binary files differnew file mode 100644 index 000000000..6f83a35ea --- /dev/null +++ b/packages/website/public/images/token_icons/ENG.png diff --git a/packages/website/public/images/token_icons/ENTR.png b/packages/website/public/images/token_icons/ENTR.png Binary files differnew file mode 100644 index 000000000..2936c20e2 --- /dev/null +++ b/packages/website/public/images/token_icons/ENTR.png diff --git a/packages/website/public/images/token_icons/EVE.png b/packages/website/public/images/token_icons/EVE.png Binary files differnew file mode 100644 index 000000000..d78362134 --- /dev/null +++ b/packages/website/public/images/token_icons/EVE.png diff --git a/packages/website/public/images/token_icons/FUN.png b/packages/website/public/images/token_icons/FUN.png Binary files differnew file mode 100644 index 000000000..a473a1c72 --- /dev/null +++ b/packages/website/public/images/token_icons/FUN.png diff --git a/packages/website/public/images/token_icons/GEE.png b/packages/website/public/images/token_icons/GEE.png Binary files differnew file mode 100644 index 000000000..887cc8429 --- /dev/null +++ b/packages/website/public/images/token_icons/GEE.png diff --git a/packages/website/public/images/token_icons/GEN.png b/packages/website/public/images/token_icons/GEN.png Binary files differnew file mode 100644 index 000000000..b1fe28370 --- /dev/null +++ b/packages/website/public/images/token_icons/GEN.png diff --git a/packages/website/public/images/token_icons/GET.png b/packages/website/public/images/token_icons/GET.png Binary files differnew file mode 100644 index 000000000..6a5fbdf63 --- /dev/null +++ b/packages/website/public/images/token_icons/GET.png diff --git a/packages/website/public/images/token_icons/GNO.png b/packages/website/public/images/token_icons/GNO.png Binary files differnew file mode 100644 index 000000000..7c7d09433 --- /dev/null +++ b/packages/website/public/images/token_icons/GNO.png diff --git a/packages/website/public/images/token_icons/golem.png b/packages/website/public/images/token_icons/GNT.png Binary files differindex e61a4367d..e61a4367d 100644 --- a/packages/website/public/images/token_icons/golem.png +++ b/packages/website/public/images/token_icons/GNT.png diff --git a/packages/website/public/images/token_icons/HGT.png b/packages/website/public/images/token_icons/HGT.png Binary files differnew file mode 100644 index 000000000..b35c601a3 --- /dev/null +++ b/packages/website/public/images/token_icons/HGT.png diff --git a/packages/website/public/images/token_icons/HOT.png b/packages/website/public/images/token_icons/HOT.png Binary files differnew file mode 100644 index 000000000..0c7f61755 --- /dev/null +++ b/packages/website/public/images/token_icons/HOT.png diff --git a/packages/website/public/images/token_icons/ICN.png b/packages/website/public/images/token_icons/ICN.png Binary files differnew file mode 100644 index 000000000..e7eebad10 --- /dev/null +++ b/packages/website/public/images/token_icons/ICN.png diff --git a/packages/website/public/images/token_icons/IND.png b/packages/website/public/images/token_icons/IND.png Binary files differnew file mode 100644 index 000000000..edc3d217b --- /dev/null +++ b/packages/website/public/images/token_icons/IND.png diff --git a/packages/website/public/images/token_icons/J8T.png b/packages/website/public/images/token_icons/J8T.png Binary files differnew file mode 100644 index 000000000..74a2f4855 --- /dev/null +++ b/packages/website/public/images/token_icons/J8T.png diff --git a/packages/website/public/images/token_icons/JET.png b/packages/website/public/images/token_icons/JET.png Binary files differnew file mode 100644 index 000000000..f34a28481 --- /dev/null +++ b/packages/website/public/images/token_icons/JET.png diff --git a/packages/website/public/images/token_icons/KIN.png b/packages/website/public/images/token_icons/KIN.png Binary files differnew file mode 100644 index 000000000..a38d656e1 --- /dev/null +++ b/packages/website/public/images/token_icons/KIN.png diff --git a/packages/website/public/images/token_icons/KNC.png b/packages/website/public/images/token_icons/KNC.png Binary files differnew file mode 100644 index 000000000..7ebe359b7 --- /dev/null +++ b/packages/website/public/images/token_icons/KNC.png diff --git a/packages/website/public/images/token_icons/LINK.png b/packages/website/public/images/token_icons/LINK.png Binary files differnew file mode 100644 index 000000000..0873f72c9 --- /dev/null +++ b/packages/website/public/images/token_icons/LINK.png diff --git a/packages/website/public/images/token_icons/LOOM.png b/packages/website/public/images/token_icons/LOOM.png Binary files differnew file mode 100644 index 000000000..0da2c41c9 --- /dev/null +++ b/packages/website/public/images/token_icons/LOOM.png diff --git a/packages/website/public/images/token_icons/LUN.png b/packages/website/public/images/token_icons/LUN.png Binary files differnew file mode 100644 index 000000000..d661bdc9f --- /dev/null +++ b/packages/website/public/images/token_icons/LUN.png diff --git a/packages/website/public/images/token_icons/MANA.png b/packages/website/public/images/token_icons/MANA.png Binary files differnew file mode 100644 index 000000000..52cdffa69 --- /dev/null +++ b/packages/website/public/images/token_icons/MANA.png diff --git a/packages/website/public/images/token_icons/MCO.png b/packages/website/public/images/token_icons/MCO.png Binary files differnew file mode 100644 index 000000000..7c3c5bfa0 --- /dev/null +++ b/packages/website/public/images/token_icons/MCO.png diff --git a/packages/website/public/images/token_icons/MKR.png b/packages/website/public/images/token_icons/MKR.png Binary files differnew file mode 100644 index 000000000..6da588979 --- /dev/null +++ b/packages/website/public/images/token_icons/MKR.png diff --git a/packages/website/public/images/token_icons/melon.png b/packages/website/public/images/token_icons/MLN.png Binary files differindex 29f58e631..29f58e631 100644 --- a/packages/website/public/images/token_icons/melon.png +++ b/packages/website/public/images/token_icons/MLN.png diff --git a/packages/website/public/images/token_icons/MOD.png b/packages/website/public/images/token_icons/MOD.png Binary files differnew file mode 100644 index 000000000..4fbe66b83 --- /dev/null +++ b/packages/website/public/images/token_icons/MOD.png diff --git a/packages/website/public/images/token_icons/MORPH.png b/packages/website/public/images/token_icons/MORPH.png Binary files differnew file mode 100644 index 000000000..a9a8dd067 --- /dev/null +++ b/packages/website/public/images/token_icons/MORPH.png diff --git a/packages/website/public/images/token_icons/MOT.png b/packages/website/public/images/token_icons/MOT.png Binary files differnew file mode 100644 index 000000000..b5457f9f1 --- /dev/null +++ b/packages/website/public/images/token_icons/MOT.png diff --git a/packages/website/public/images/token_icons/MTL.png b/packages/website/public/images/token_icons/MTL.png Binary files differnew file mode 100644 index 000000000..3297462ce --- /dev/null +++ b/packages/website/public/images/token_icons/MTL.png diff --git a/packages/website/public/images/token_icons/NANJ.png b/packages/website/public/images/token_icons/NANJ.png Binary files differnew file mode 100644 index 000000000..0c54c5bde --- /dev/null +++ b/packages/website/public/images/token_icons/NANJ.png diff --git a/packages/website/public/images/token_icons/NAVI.png b/packages/website/public/images/token_icons/NAVI.png Binary files differnew file mode 100644 index 000000000..3dc359c47 --- /dev/null +++ b/packages/website/public/images/token_icons/NAVI.png diff --git a/packages/website/public/images/token_icons/NCT.png b/packages/website/public/images/token_icons/NCT.png Binary files differnew file mode 100644 index 000000000..879c8d085 --- /dev/null +++ b/packages/website/public/images/token_icons/NCT.png diff --git a/packages/website/public/images/token_icons/NDC.png b/packages/website/public/images/token_icons/NDC.png Binary files differnew file mode 100644 index 000000000..b16890ca3 --- /dev/null +++ b/packages/website/public/images/token_icons/NDC.png diff --git a/packages/website/public/images/token_icons/NEXO.png b/packages/website/public/images/token_icons/NEXO.png Binary files differnew file mode 100644 index 000000000..f6459a39f --- /dev/null +++ b/packages/website/public/images/token_icons/NEXO.png diff --git a/packages/website/public/images/token_icons/NMR.png b/packages/website/public/images/token_icons/NMR.png Binary files differnew file mode 100644 index 000000000..8767f019a --- /dev/null +++ b/packages/website/public/images/token_icons/NMR.png diff --git a/packages/website/public/images/token_icons/OAX.png b/packages/website/public/images/token_icons/OAX.png Binary files differnew file mode 100644 index 000000000..7a53e71af --- /dev/null +++ b/packages/website/public/images/token_icons/OAX.png diff --git a/packages/website/public/images/token_icons/OCC.png b/packages/website/public/images/token_icons/OCC.png Binary files differnew file mode 100644 index 000000000..049812208 --- /dev/null +++ b/packages/website/public/images/token_icons/OCC.png diff --git a/packages/website/public/images/token_icons/OMG.png b/packages/website/public/images/token_icons/OMG.png Binary files differnew file mode 100644 index 000000000..c1552abf2 --- /dev/null +++ b/packages/website/public/images/token_icons/OMG.png diff --git a/packages/website/public/images/token_icons/OMX.png b/packages/website/public/images/token_icons/OMX.png Binary files differnew file mode 100644 index 000000000..0c3485d79 --- /dev/null +++ b/packages/website/public/images/token_icons/OMX.png diff --git a/packages/website/public/images/token_icons/PAL.png b/packages/website/public/images/token_icons/PAL.png Binary files differnew file mode 100644 index 000000000..211e42ea5 --- /dev/null +++ b/packages/website/public/images/token_icons/PAL.png diff --git a/packages/website/public/images/token_icons/tenx.png b/packages/website/public/images/token_icons/PAY.png Binary files differindex d9ffca043..d9ffca043 100644 --- a/packages/website/public/images/token_icons/tenx.png +++ b/packages/website/public/images/token_icons/PAY.png diff --git a/packages/website/public/images/token_icons/PKT.png b/packages/website/public/images/token_icons/PKT.png Binary files differnew file mode 100644 index 000000000..169390929 --- /dev/null +++ b/packages/website/public/images/token_icons/PKT.png diff --git a/packages/website/public/images/token_icons/PLAY.png b/packages/website/public/images/token_icons/PLAY.png Binary files differnew file mode 100644 index 000000000..9b141a6ec --- /dev/null +++ b/packages/website/public/images/token_icons/PLAY.png diff --git a/packages/website/public/images/token_icons/PLU.png b/packages/website/public/images/token_icons/PLU.png Binary files differnew file mode 100644 index 000000000..6f9b0344e --- /dev/null +++ b/packages/website/public/images/token_icons/PLU.png diff --git a/packages/website/public/images/token_icons/POLY.png b/packages/website/public/images/token_icons/POLY.png Binary files differnew file mode 100644 index 000000000..03ded07dc --- /dev/null +++ b/packages/website/public/images/token_icons/POLY.png diff --git a/packages/website/public/images/token_icons/REN.png b/packages/website/public/images/token_icons/REN.png Binary files differnew file mode 100644 index 000000000..f70856e9f --- /dev/null +++ b/packages/website/public/images/token_icons/REN.png diff --git a/packages/website/public/images/token_icons/REP.png b/packages/website/public/images/token_icons/REP.png Binary files differnew file mode 100644 index 000000000..c767f4b6f --- /dev/null +++ b/packages/website/public/images/token_icons/REP.png diff --git a/packages/website/public/images/token_icons/REQ.png b/packages/website/public/images/token_icons/REQ.png Binary files differnew file mode 100644 index 000000000..3c0e8ed9a --- /dev/null +++ b/packages/website/public/images/token_icons/REQ.png diff --git a/packages/website/public/images/token_icons/RFR.png b/packages/website/public/images/token_icons/RFR.png Binary files differnew file mode 100644 index 000000000..05d71c4f3 --- /dev/null +++ b/packages/website/public/images/token_icons/RFR.png diff --git a/packages/website/public/images/token_icons/RLC.png b/packages/website/public/images/token_icons/RLC.png Binary files differnew file mode 100644 index 000000000..c21dee4c4 --- /dev/null +++ b/packages/website/public/images/token_icons/RLC.png diff --git a/packages/website/public/images/token_icons/ROL.png b/packages/website/public/images/token_icons/ROL.png Binary files differnew file mode 100644 index 000000000..430fa9af1 --- /dev/null +++ b/packages/website/public/images/token_icons/ROL.png diff --git a/packages/website/public/images/token_icons/RVT.png b/packages/website/public/images/token_icons/RVT.png Binary files differnew file mode 100644 index 000000000..4f32c0e87 --- /dev/null +++ b/packages/website/public/images/token_icons/RVT.png diff --git a/packages/website/public/images/token_icons/SALT.png b/packages/website/public/images/token_icons/SALT.png Binary files differnew file mode 100644 index 000000000..ce425eed5 --- /dev/null +++ b/packages/website/public/images/token_icons/SALT.png diff --git a/packages/website/public/images/token_icons/SAN.png b/packages/website/public/images/token_icons/SAN.png Binary files differnew file mode 100644 index 000000000..36aa6a554 --- /dev/null +++ b/packages/website/public/images/token_icons/SAN.png diff --git a/packages/website/public/images/token_icons/SIG.png b/packages/website/public/images/token_icons/SIG.png Binary files differnew file mode 100644 index 000000000..33af7f085 --- /dev/null +++ b/packages/website/public/images/token_icons/SIG.png diff --git a/packages/website/public/images/token_icons/SNGLS.png b/packages/website/public/images/token_icons/SNGLS.png Binary files differnew file mode 100644 index 000000000..16bf28819 --- /dev/null +++ b/packages/website/public/images/token_icons/SNGLS.png diff --git a/packages/website/public/images/token_icons/SNT.png b/packages/website/public/images/token_icons/SNT.png Binary files differnew file mode 100644 index 000000000..6f072cffb --- /dev/null +++ b/packages/website/public/images/token_icons/SNT.png diff --git a/packages/website/public/images/token_icons/SPANK.png b/packages/website/public/images/token_icons/SPANK.png Binary files differnew file mode 100644 index 000000000..aab84ef90 --- /dev/null +++ b/packages/website/public/images/token_icons/SPANK.png diff --git a/packages/website/public/images/token_icons/SPN.png b/packages/website/public/images/token_icons/SPN.png Binary files differnew file mode 100644 index 000000000..c569c4687 --- /dev/null +++ b/packages/website/public/images/token_icons/SPN.png diff --git a/packages/website/public/images/token_icons/SS.png b/packages/website/public/images/token_icons/SS.png Binary files differnew file mode 100644 index 000000000..127e42c45 --- /dev/null +++ b/packages/website/public/images/token_icons/SS.png diff --git a/packages/website/public/images/token_icons/STORJ.png b/packages/website/public/images/token_icons/STORJ.png Binary files differnew file mode 100644 index 000000000..4539afb4a --- /dev/null +++ b/packages/website/public/images/token_icons/STORJ.png diff --git a/packages/website/public/images/token_icons/SUB.png b/packages/website/public/images/token_icons/SUB.png Binary files differnew file mode 100644 index 000000000..633bcbbd1 --- /dev/null +++ b/packages/website/public/images/token_icons/SUB.png diff --git a/packages/website/public/images/token_icons/SWT.png b/packages/website/public/images/token_icons/SWT.png Binary files differnew file mode 100644 index 000000000..910d9fdbf --- /dev/null +++ b/packages/website/public/images/token_icons/SWT.png diff --git a/packages/website/public/images/token_icons/SXDT.png b/packages/website/public/images/token_icons/SXDT.png Binary files differnew file mode 100644 index 000000000..b37e92050 --- /dev/null +++ b/packages/website/public/images/token_icons/SXDT.png diff --git a/packages/website/public/images/token_icons/TIME.png b/packages/website/public/images/token_icons/TIME.png Binary files differnew file mode 100644 index 000000000..920cc7636 --- /dev/null +++ b/packages/website/public/images/token_icons/TIME.png diff --git a/packages/website/public/images/token_icons/TKN.png b/packages/website/public/images/token_icons/TKN.png Binary files differnew file mode 100644 index 000000000..e1b276416 --- /dev/null +++ b/packages/website/public/images/token_icons/TKN.png diff --git a/packages/website/public/images/token_icons/TRL.png b/packages/website/public/images/token_icons/TRL.png Binary files differnew file mode 100644 index 000000000..afd5815ba --- /dev/null +++ b/packages/website/public/images/token_icons/TRL.png diff --git a/packages/website/public/images/token_icons/TRST.png b/packages/website/public/images/token_icons/TRST.png Binary files differnew file mode 100644 index 000000000..0ba34778f --- /dev/null +++ b/packages/website/public/images/token_icons/TRST.png diff --git a/packages/website/public/images/token_icons/TRX.png b/packages/website/public/images/token_icons/TRX.png Binary files differnew file mode 100644 index 000000000..56338957c --- /dev/null +++ b/packages/website/public/images/token_icons/TRX.png diff --git a/packages/website/public/images/token_icons/UPP.png b/packages/website/public/images/token_icons/UPP.png Binary files differnew file mode 100644 index 000000000..bc90081a0 --- /dev/null +++ b/packages/website/public/images/token_icons/UPP.png diff --git a/packages/website/public/images/token_icons/VSL.png b/packages/website/public/images/token_icons/VSL.png Binary files differnew file mode 100644 index 000000000..b3d0950d2 --- /dev/null +++ b/packages/website/public/images/token_icons/VSL.png diff --git a/packages/website/public/images/token_icons/WAND.png b/packages/website/public/images/token_icons/WAND.png Binary files differnew file mode 100644 index 000000000..e22531e21 --- /dev/null +++ b/packages/website/public/images/token_icons/WAND.png diff --git a/packages/website/public/images/token_icons/ether_erc20.png b/packages/website/public/images/token_icons/WETH.png Binary files differindex bc8beae8b..bc8beae8b 100644 --- a/packages/website/public/images/token_icons/ether_erc20.png +++ b/packages/website/public/images/token_icons/WETH.png diff --git a/packages/website/public/images/token_icons/WTC.png b/packages/website/public/images/token_icons/WTC.png Binary files differnew file mode 100644 index 000000000..06aac0617 --- /dev/null +++ b/packages/website/public/images/token_icons/WTC.png diff --git a/packages/website/public/images/token_icons/WYV.png b/packages/website/public/images/token_icons/WYV.png Binary files differnew file mode 100644 index 000000000..d63aa857b --- /dev/null +++ b/packages/website/public/images/token_icons/WYV.png diff --git a/packages/website/public/images/token_icons/XAUR.png b/packages/website/public/images/token_icons/XAUR.png Binary files differnew file mode 100644 index 000000000..c356cc9dd --- /dev/null +++ b/packages/website/public/images/token_icons/XAUR.png diff --git a/packages/website/public/images/token_icons/XNK.png b/packages/website/public/images/token_icons/XNK.png Binary files differnew file mode 100644 index 000000000..04b2ebf80 --- /dev/null +++ b/packages/website/public/images/token_icons/XNK.png diff --git a/packages/website/public/images/token_icons/XSC.png b/packages/website/public/images/token_icons/XSC.png Binary files differnew file mode 100644 index 000000000..7f70686aa --- /dev/null +++ b/packages/website/public/images/token_icons/XSC.png diff --git a/packages/website/public/images/token_icons/XYO.png b/packages/website/public/images/token_icons/XYO.png Binary files differnew file mode 100644 index 000000000..81314d2ff --- /dev/null +++ b/packages/website/public/images/token_icons/XYO.png diff --git a/packages/website/public/images/token_icons/ZIL.png b/packages/website/public/images/token_icons/ZIL.png Binary files differnew file mode 100644 index 000000000..197227803 --- /dev/null +++ b/packages/website/public/images/token_icons/ZIL.png diff --git a/packages/website/public/images/token_icons/zero_ex.png b/packages/website/public/images/token_icons/ZRX.png Binary files differindex 8ed9a984b..8ed9a984b 100644 --- a/packages/website/public/images/token_icons/zero_ex.png +++ b/packages/website/public/images/token_icons/ZRX.png diff --git a/packages/website/public/images/token_icons/adtoken.png b/packages/website/public/images/token_icons/adtoken.png Binary files differdeleted file mode 100644 index 59290af6b..000000000 --- a/packages/website/public/images/token_icons/adtoken.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/aragon.png b/packages/website/public/images/token_icons/aragon.png Binary files differdeleted file mode 100644 index d162aab24..000000000 --- a/packages/website/public/images/token_icons/aragon.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/augur.png b/packages/website/public/images/token_icons/augur.png Binary files differdeleted file mode 100644 index b7d61100a..000000000 --- a/packages/website/public/images/token_icons/augur.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/bancor.png b/packages/website/public/images/token_icons/bancor.png Binary files differdeleted file mode 100644 index d2b2fa472..000000000 --- a/packages/website/public/images/token_icons/bancor.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/basicattentiontoken.png b/packages/website/public/images/token_icons/basicattentiontoken.png Binary files differdeleted file mode 100644 index 77e7dfb1f..000000000 --- a/packages/website/public/images/token_icons/basicattentiontoken.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/bitquence.png b/packages/website/public/images/token_icons/bitquence.png Binary files differdeleted file mode 100644 index d8a2c6960..000000000 --- a/packages/website/public/images/token_icons/bitquence.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/btc.png b/packages/website/public/images/token_icons/btc.png Binary files differdeleted file mode 100644 index 1d9fc8347..000000000 --- a/packages/website/public/images/token_icons/btc.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/clams.png b/packages/website/public/images/token_icons/clams.png Binary files differdeleted file mode 100644 index 04c2ba7d3..000000000 --- a/packages/website/public/images/token_icons/clams.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/cofound-it.png b/packages/website/public/images/token_icons/cofound-it.png Binary files differdeleted file mode 100644 index 7bccd6248..000000000 --- a/packages/website/public/images/token_icons/cofound-it.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/default.png b/packages/website/public/images/token_icons/default.png Binary files differdeleted file mode 100644 index 5c9ea4b0f..000000000 --- a/packages/website/public/images/token_icons/default.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/digixdao.png b/packages/website/public/images/token_icons/digixdao.png Binary files differdeleted file mode 100644 index f292db716..000000000 --- a/packages/website/public/images/token_icons/digixdao.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/district0x.png b/packages/website/public/images/token_icons/district0x.png Binary files differdeleted file mode 100644 index 7427b1146..000000000 --- a/packages/website/public/images/token_icons/district0x.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/eos.png b/packages/website/public/images/token_icons/eos.png Binary files differindex a08f3c042..622df61bc 100644 --- a/packages/website/public/images/token_icons/eos.png +++ b/packages/website/public/images/token_icons/eos.png diff --git a/packages/website/public/images/token_icons/etheroll.png b/packages/website/public/images/token_icons/etheroll.png Binary files differdeleted file mode 100644 index 89dd5e04b..000000000 --- a/packages/website/public/images/token_icons/etheroll.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/funfair.png b/packages/website/public/images/token_icons/funfair.png Binary files differdeleted file mode 100644 index 1b7c67ec6..000000000 --- a/packages/website/public/images/token_icons/funfair.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/gnosis.png b/packages/website/public/images/token_icons/gnosis.png Binary files differdeleted file mode 100644 index 0111846d0..000000000 --- a/packages/website/public/images/token_icons/gnosis.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/iconomi.png b/packages/website/public/images/token_icons/iconomi.png Binary files differdeleted file mode 100644 index 3499e4765..000000000 --- a/packages/website/public/images/token_icons/iconomi.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/iexec.png b/packages/website/public/images/token_icons/iexec.png Binary files differdeleted file mode 100644 index ef4860457..000000000 --- a/packages/website/public/images/token_icons/iexec.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/lunyr.png b/packages/website/public/images/token_icons/lunyr.png Binary files differdeleted file mode 100644 index f77094ba5..000000000 --- a/packages/website/public/images/token_icons/lunyr.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/makerdao.png b/packages/website/public/images/token_icons/makerdao.png Binary files differdeleted file mode 100644 index adbc9f38c..000000000 --- a/packages/website/public/images/token_icons/makerdao.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/metal.png b/packages/website/public/images/token_icons/metal.png Binary files differdeleted file mode 100644 index d8a8c33ec..000000000 --- a/packages/website/public/images/token_icons/metal.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/monaco.png b/packages/website/public/images/token_icons/monaco.png Binary files differdeleted file mode 100644 index 865341fd3..000000000 --- a/packages/website/public/images/token_icons/monaco.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/numeraire.png b/packages/website/public/images/token_icons/numeraire.png Binary files differdeleted file mode 100644 index 698f7cfdd..000000000 --- a/packages/website/public/images/token_icons/numeraire.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/omisego.png b/packages/website/public/images/token_icons/omisego.png Binary files differdeleted file mode 100644 index 40a86b9d7..000000000 --- a/packages/website/public/images/token_icons/omisego.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/santiment.png b/packages/website/public/images/token_icons/santiment.png Binary files differdeleted file mode 100644 index 05ce98c1d..000000000 --- a/packages/website/public/images/token_icons/santiment.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/singularity.png b/packages/website/public/images/token_icons/singularity.png Binary files differdeleted file mode 100644 index 9db788935..000000000 --- a/packages/website/public/images/token_icons/singularity.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/status.png b/packages/website/public/images/token_icons/status.png Binary files differdeleted file mode 100644 index a73ba23ba..000000000 --- a/packages/website/public/images/token_icons/status.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/storjcoinx.png b/packages/website/public/images/token_icons/storjcoinx.png Binary files differdeleted file mode 100644 index 87c4d4292..000000000 --- a/packages/website/public/images/token_icons/storjcoinx.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/taas.png b/packages/website/public/images/token_icons/taas.png Binary files differindex 4cca722f7..266e3690b 100644 --- a/packages/website/public/images/token_icons/taas.png +++ b/packages/website/public/images/token_icons/taas.png diff --git a/packages/website/public/images/token_icons/tokencard.png b/packages/website/public/images/token_icons/tokencard.png Binary files differdeleted file mode 100644 index 490c1be69..000000000 --- a/packages/website/public/images/token_icons/tokencard.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/trust.png b/packages/website/public/images/token_icons/trust.png Binary files differdeleted file mode 100644 index 62b412b41..000000000 --- a/packages/website/public/images/token_icons/trust.png +++ /dev/null diff --git a/packages/website/public/images/token_icons/wings.png b/packages/website/public/images/token_icons/wings.png Binary files differindex cd0eb4213..c0a9ce527 100644 --- a/packages/website/public/images/token_icons/wings.png +++ b/packages/website/public/images/token_icons/wings.png diff --git a/packages/website/public/images/unlock-mm.png b/packages/website/public/images/unlock-mm.png Binary files differnew file mode 100644 index 000000000..531c95dd2 --- /dev/null +++ b/packages/website/public/images/unlock-mm.png diff --git a/packages/website/ts/artifacts/Exchange.json b/packages/website/ts/artifacts/Exchange.json new file mode 100644 index 000000000..af8db7360 --- /dev/null +++ b/packages/website/ts/artifacts/Exchange.json @@ -0,0 +1,610 @@ +{ + "contract_name": "Exchange", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "isRoundingError", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "filled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "name": "cancelled", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "fillOrdersUpTo", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "cancelTakerTokenAmount", + "type": "uint256" + } + ], + "name": "cancelOrder", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ZRX_TOKEN_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrKillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrKillOrder", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "getUnavailableTakerTokenAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "signer", + "type": "address" + }, + { + "name": "hash", + "type": "bytes32" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "numerator", + "type": "uint256" + }, + { + "name": "denominator", + "type": "uint256" + }, + { + "name": "target", + "type": "uint256" + } + ], + "name": "getPartialAmount", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "TOKEN_TRANSFER_PROXY_CONTRACT", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "fillTakerTokenAmounts", + "type": "uint256[]" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8[]" + }, + { + "name": "r", + "type": "bytes32[]" + }, + { + "name": "s", + "type": "bytes32[]" + } + ], + "name": "batchFillOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5][]" + }, + { + "name": "orderValues", + "type": "uint256[6][]" + }, + { + "name": "cancelTakerTokenAmounts", + "type": "uint256[]" + } + ], + "name": "batchCancelOrders", + "outputs": [], + "payable": false, + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + }, + { + "name": "fillTakerTokenAmount", + "type": "uint256" + }, + { + "name": "shouldThrowOnInsufficientBalanceOrAllowance", + "type": "bool" + }, + { + "name": "v", + "type": "uint8" + }, + { + "name": "r", + "type": "bytes32" + }, + { + "name": "s", + "type": "bytes32" + } + ], + "name": "fillOrder", + "outputs": [ + { + "name": "filledTakerTokenAmount", + "type": "uint256" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "orderAddresses", + "type": "address[5]" + }, + { + "name": "orderValues", + "type": "uint256[6]" + } + ], + "name": "getOrderHash", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "EXTERNAL_QUERY_GAS_LIMIT", + "outputs": [ + { + "name": "", + "type": "uint16" + } + ], + "payable": false, + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "type": "function" + }, + { + "inputs": [ + { + "name": "_zrxToken", + "type": "address" + }, + { + "name": "_tokenTransferProxy", + "type": "address" + } + ], + "payable": false, + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": false, + "name": "taker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "filledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "filledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidMakerFee", + "type": "uint256" + }, + { + "indexed": false, + "name": "paidTakerFee", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogFill", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "name": "feeRecipient", + "type": "address" + }, + { + "indexed": false, + "name": "makerToken", + "type": "address" + }, + { + "indexed": false, + "name": "takerToken", + "type": "address" + }, + { + "indexed": false, + "name": "cancelledMakerTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "cancelledTakerTokenAmount", + "type": "uint256" + }, + { + "indexed": true, + "name": "tokens", + "type": "bytes32" + }, + { + "indexed": false, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogCancel", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "errorId", + "type": "uint8" + }, + { + "indexed": true, + "name": "orderHash", + "type": "bytes32" + } + ], + "name": "LogError", + "type": "event" + } + ], + "networks": { + "1": { + "address": "0x12459c951127e0c374ff9105dda097662a027093" + }, + "3": { + "address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac" + }, + "4": { + "address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05" + }, + "42": { + "address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364" + }, + "50": { + "address": "0x48bacb9266a570d521063ef5dd96e61686dbe788" + } + } +} diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index cc2afa28a..fde134b18 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -66,6 +66,9 @@ import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import * as MintableArtifacts from '../contracts/Mintable.json'; +// HACK: remove this hard-coded abi and use @0xproject/contract-wrappers +import * as Exchange from './artifacts/Exchange.json'; + const BLOCK_NUMBER_BACK_TRACK = 50; const GWEI_IN_WEI = 1000000000; @@ -89,6 +92,7 @@ export class Blockchain { private _userAddressIfExists: string; private _ledgerSubprovider: LedgerSubprovider; private _defaultGasPrice: BigNumber; + private _watchGasPriceIntervalId: NodeJS.Timer; private static _getNameGivenProvider(provider: Provider): string { const providerType = utils.getProviderType(provider); const providerNameIfExists = providerToName[providerType]; @@ -196,13 +200,11 @@ export class Blockchain { } constructor(dispatcher: Dispatcher) { this._dispatcher = dispatcher; - const defaultGasPrice = GWEI_IN_WEI * 30; + const defaultGasPrice = GWEI_IN_WEI * 40; this._defaultGasPrice = new BigNumber(defaultGasPrice); // We need a unique reference to this function so we can use it to unsubcribe. this._injectedProviderUpdateHandler = this._handleInjectedProviderUpdateAsync.bind(this); // tslint:disable-next-line:no-floating-promises - this._updateDefaultGasPriceAsync(); - // tslint:disable-next-line:no-floating-promises this._onPageLoadInitFireAndForgetAsync(); } public async networkIdUpdatedFireAndForgetAsync(newNetworkId: number): Promise<void> { @@ -537,6 +539,7 @@ export class Blockchain { this._blockchainWatcher.destroy(); this._injectedProviderObservable.unsubscribe(this._injectedProviderUpdateHandler); this._stopWatchingExchangeLogFillEvents(); + this._stopWatchingGasPrice(); } public async fetchTokenInformationAsync(): Promise<void> { utils.assert( @@ -624,7 +627,9 @@ export class Blockchain { ); const provider = this._contractWrappers.getProvider(); const web3Wrapper = new Web3Wrapper(provider); - web3Wrapper.abiDecoder.addABI(this._contractWrappers.exchange.abi); + // HACK: remove this hard-coded abi and use @0xproject/contract-wrappers + const exchangeAbi = _.get(Exchange, 'abi', []); + web3Wrapper.abiDecoder.addABI(exchangeAbi); const receipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); return receipt; } @@ -769,7 +774,7 @@ export class Blockchain { _.each(tokenRegistryTokens, (t: ZeroExToken) => { // HACK: For now we have a hard-coded list of iconUrls for the dummyTokens // TODO: Refactor this out and pull the iconUrl directly from the TokenRegistry - const iconUrl = configs.ICON_URL_BY_SYMBOL[t.symbol]; + const iconUrl = utils.getTokenIconUrl(t.symbol); const token: Token = { iconUrl, address: t.address, @@ -798,8 +803,30 @@ export class Blockchain { this._updateProviderName(injectedWeb3IfExists); const shouldPollUserAddress = true; const shouldUseLedgerProvider = false; + this._startWatchingGasPrice(); await this._resetOrInitializeAsync(this.networkId, shouldPollUserAddress, shouldUseLedgerProvider); } + private _startWatchingGasPrice(): void { + if (!_.isUndefined(this._watchGasPriceIntervalId)) { + return; // we are already watching + } + const oneMinuteInMs = 60000; + // tslint:disable-next-line:no-floating-promises + this._updateDefaultGasPriceAsync(); + this._watchGasPriceIntervalId = intervalUtils.setAsyncExcludingInterval( + this._updateDefaultGasPriceAsync.bind(this), + oneMinuteInMs, + (err: Error) => { + logUtils.log(`Watching gas price failed: ${err.stack}`); + this._stopWatchingGasPrice(); + }, + ); + } + private _stopWatchingGasPrice(): void { + if (!_.isUndefined(this._watchGasPriceIntervalId)) { + intervalUtils.clearAsyncExcludingInterval(this._watchGasPriceIntervalId); + } + } private async _resetOrInitializeAsync( networkId: number, shouldPollUserAddress: boolean = false, @@ -895,7 +922,7 @@ export class Blockchain { private async _updateDefaultGasPriceAsync(): Promise<void> { try { const gasInfo = await backendClient.getGasInfoAsync(); - const gasPriceInGwei = new BigNumber(gasInfo.average / 10); + const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); const gasPriceInWei = gasPriceInGwei.mul(1000000000); this._defaultGasPrice = gasPriceInWei; } catch (err) { diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index 38e4732a4..d2f373d67 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -29,7 +29,7 @@ interface LedgerConfigDialogProps { toggleDialogFn: (isOpen: boolean) => void; dispatcher: Dispatcher; blockchain: Blockchain; - networkId: number; + networkId?: number; providerType: ProviderType; } @@ -44,6 +44,9 @@ interface LedgerConfigDialogState { } export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, LedgerConfigDialogState> { + public static defaultProps = { + networkId: 1, + }; constructor(props: LedgerConfigDialogProps) { super(props); const derivationPathIfExists = props.blockchain.getLedgerDerivationPathIfExists(); diff --git a/packages/website/ts/components/eth_wrappers.tsx b/packages/website/ts/components/eth_wrappers.tsx index 20b446155..0b282b2a1 100644 --- a/packages/website/ts/components/eth_wrappers.tsx +++ b/packages/website/ts/components/eth_wrappers.tsx @@ -20,6 +20,7 @@ import { } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; +import { utils } from 'ts/utils/utils'; const DATE_FORMAT = 'D/M/YY'; const ICON_DIMENSION = 40; @@ -95,7 +96,11 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt this.props.networkId, EtherscanLinkSuffixes.Address, ); - const tokenLabel = this._renderToken('Wrapped Ether', etherToken.address, configs.ICON_URL_BY_SYMBOL.WETH); + const tokenLabel = this._renderToken( + 'Wrapped Ether', + etherToken.address, + utils.getTokenIconUrl(etherToken.symbol), + ); const userEtherBalanceInEth = !_.isUndefined(this.props.userEtherBalanceInWei) ? Web3Wrapper.toUnitAmount(this.props.userEtherBalanceInWei, constants.DECIMAL_PLACES_ETH) : undefined; diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 3d53a9e7d..5eada37b6 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -3,6 +3,8 @@ import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import * as moment from 'moment'; import * as React from 'react'; +import firstBy = require('thenby'); + import { Blockchain } from 'ts/blockchain'; import { NewTokenForm } from 'ts/components/generate_order/new_token_form'; import { TrackTokenConfirmation } from 'ts/components/track_token_confirmation'; @@ -87,10 +89,10 @@ export class AssetPicker extends React.Component<AssetPickerProps, AssetPickerSt return ( <Dialog title={dialogConfigs.title} - titleStyle={{ fontWeight: 100 }} modal={dialogConfigs.isModal} open={this.props.isOpen} actions={dialogConfigs.actions} + autoScrollBodyContent={true} onRequestClose={this._onCloseDialog.bind(this)} > {this.state.assetView === AssetViews.ASSET_PICKER && this._renderAssetPicker()} @@ -121,9 +123,8 @@ export class AssetPicker extends React.Component<AssetPickerProps, AssetPickerSt <div className="flex flex-wrap" style={{ - overflowY: 'auto', - maxWidth: 720, - maxHeight: 356, + maxWidth: 1000, + maxHeight: 600, marginBottom: 10, }} > @@ -134,15 +135,28 @@ export class AssetPicker extends React.Component<AssetPickerProps, AssetPickerSt private _renderGridTiles(): React.ReactNode { let isHovered; let tileStyles; - const gridTiles = _.map(this.props.tokenByAddress, (token: Token, address: string) => { - if ( - (this.props.tokenVisibility === TokenVisibility.TRACKED && !utils.isTokenTracked(token)) || - (this.props.tokenVisibility === TokenVisibility.UNTRACKED && utils.isTokenTracked(token)) || - token.symbol === constants.ZRX_TOKEN_SYMBOL || - token.symbol === constants.ETHER_TOKEN_SYMBOL - ) { - return null; // Skip - } + const allTokens = _.values(this.props.tokenByAddress); + // filter tokens based on visibility specified in props, do not show ZRX or ETHER as tracked or untracked + const filteredTokens = + this.props.tokenVisibility === TokenVisibility.ALL + ? allTokens + : _.filter(allTokens, token => { + return ( + token.symbol !== constants.ZRX_TOKEN_SYMBOL && + token.symbol !== constants.ETHER_TOKEN_SYMBOL && + ((this.props.tokenVisibility === TokenVisibility.TRACKED && utils.isTokenTracked(token)) || + (this.props.tokenVisibility === TokenVisibility.UNTRACKED && + !utils.isTokenTracked(token))) + ); + }); + // if we are showing tracked tokens, sort by date added, otherwise sort by symbol + const sortKey = this.props.tokenVisibility === TokenVisibility.TRACKED ? 'trackedTimestamp' : 'symbol'; + const sortedTokens = filteredTokens.sort(firstBy(sortKey)); + if (_.isEmpty(sortedTokens)) { + return <div className="mx-auto p4 h2">No tokens to remove.</div>; + } + const gridTiles = _.map(sortedTokens, token => { + const address = token.address; isHovered = this.state.hoveredAddress === address; tileStyles = { cursor: 'pointer', diff --git a/packages/website/ts/components/onboarding/add_eth_onboarding_step.tsx b/packages/website/ts/components/onboarding/add_eth_onboarding_step.tsx index bccdc0c18..ca71fcd50 100644 --- a/packages/website/ts/components/onboarding/add_eth_onboarding_step.tsx +++ b/packages/website/ts/components/onboarding/add_eth_onboarding_step.tsx @@ -1,10 +1,10 @@ import { BigNumber } from '@0xproject/utils'; import * as React from 'react'; +import { Balance } from 'ts/components/ui/balance'; import { Container } from 'ts/components/ui/container'; import { Image } from 'ts/components/ui/image'; import { Text } from 'ts/components/ui/text'; import { constants } from 'ts/utils/constants'; -import { utils } from 'ts/utils/utils'; export interface AddEthOnboardingStepProps { userEthBalanceInWei: BigNumber; @@ -15,13 +15,11 @@ export const AddEthOnboardingStep: React.StatelessComponent<AddEthOnboardingStep <div className="flex items-center flex-column"> <Text> Great! Looks like you already have{' '} - <b> - {utils.getFormattedAmount( - props.userEthBalanceInWei, - constants.DECIMAL_PLACES_ETH, - constants.ETHER_SYMBOL, - )}{' '} - </b> + <Balance + amount={props.userEthBalanceInWei} + decimals={constants.DECIMAL_PLACES_ETH} + symbol={constants.ETHER_SYMBOL} + />{' '} in your wallet. </Text> <Container marginTop="15px" marginBottom="15px"> diff --git a/packages/website/ts/components/onboarding/onboarding_card.tsx b/packages/website/ts/components/onboarding/onboarding_card.tsx index ba5b3d6ea..e1b0f304b 100644 --- a/packages/website/ts/components/onboarding/onboarding_card.tsx +++ b/packages/website/ts/components/onboarding/onboarding_card.tsx @@ -12,6 +12,7 @@ export type ContinueButtonDisplay = 'enabled' | 'disabled'; export interface OnboardingCardProps { title?: string; + shouldCenterTitle?: boolean; content: React.ReactNode; isLastStep: boolean; onClose: () => void; @@ -23,10 +24,13 @@ export interface OnboardingCardProps { shouldHideNextButton?: boolean; continueButtonText?: string; borderRadius?: string; + // Used for super-custom content. + shouldRemoveExtraSpacing?: boolean; } export const OnboardingCard: React.StatelessComponent<OnboardingCardProps> = ({ title, + shouldCenterTitle, content, continueButtonDisplay, continueButtonText, @@ -37,55 +41,75 @@ export const OnboardingCard: React.StatelessComponent<OnboardingCardProps> = ({ shouldHideBackButton, shouldHideNextButton, borderRadius, -}) => ( - <Island borderRadius={borderRadius}> - <Container paddingRight="30px" paddingLeft="30px" paddingTop="15px" paddingBottom="15px"> - <div className="flex flex-column"> - <div className="flex justify-between"> - <Title>{title}</Title> - <Container position="relative" bottom="20px" left="15px"> - <IconButton color={colors.grey} iconName="zmdi-close" onClick={onClose}> - Close - </IconButton> + shouldRemoveExtraSpacing, +}) => { + const padding = shouldRemoveExtraSpacing + ? {} + : { + paddingRight: '30px', + paddingLeft: '30px', + paddingTop: '15px', + paddingBottom: '15px', + }; + const closeIconPositioning = shouldRemoveExtraSpacing + ? { right: '15px', bottom: '3px' } + : { bottom: '20px', left: '15px' }; + return ( + <Island borderRadius={borderRadius}> + <Container {...padding}> + <div className="flex flex-column"> + <Container className="flex justify-between"> + <Container width="100%"> + <Title center={shouldCenterTitle}>{title}</Title> + </Container> + <Container position="relative" {...closeIconPositioning}> + <IconButton color={colors.grey} iconName="zmdi-close" onClick={onClose}> + Close + </IconButton> + </Container> </Container> + <Container marginBottom={shouldRemoveExtraSpacing ? undefined : '15px'}> + <Text>{content}</Text> + </Container> + {continueButtonDisplay && ( + <Button + isDisabled={continueButtonDisplay === 'disabled'} + onClick={!_.isUndefined(onContinueButtonClick) ? onContinueButtonClick : onClickNext} + fontColor={colors.white} + fontSize="15px" + backgroundColor={colors.mediumBlue} + > + {continueButtonText} + </Button> + )} + {!(shouldHideBackButton && shouldHideNextButton) && ( + <Container className="clearfix" marginTop="15px"> + <div className="left"> + {!shouldHideBackButton && ( + <Text fontColor={colors.grey} onClick={onClickBack}> + Back + </Text> + )} + </div> + <div className="right"> + {!shouldHideNextButton && ( + <Text fontColor={colors.grey} onClick={onClickNext}> + Skip + </Text> + )} + </div> + </Container> + )} </div> - <Container marginBottom="15px"> - <Text>{content}</Text> - </Container> - {continueButtonDisplay && ( - <Button - isDisabled={continueButtonDisplay === 'disabled'} - onClick={!_.isUndefined(onContinueButtonClick) ? onContinueButtonClick : onClickNext} - fontColor={colors.white} - fontSize="15px" - backgroundColor={colors.mediumBlue} - > - {continueButtonText} - </Button> - )} - <Container className="clearfix" marginTop="15px"> - <div className="left"> - {!shouldHideBackButton && ( - <Text fontColor={colors.grey} onClick={onClickBack}> - Back - </Text> - )} - </div> - <div className="right"> - {!shouldHideNextButton && ( - <Text fontColor={colors.grey} onClick={onClickNext}> - Skip - </Text> - )} - </div> - </Container> - </div> - </Container> - </Island> -); + </Container> + </Island> + ); +}; OnboardingCard.defaultProps = { continueButtonText: 'Continue', + shouldCenterTitle: false, + shouldRemoveExtraSpacing: false, }; OnboardingCard.displayName = 'OnboardingCard'; diff --git a/packages/website/ts/components/onboarding/onboarding_flow.tsx b/packages/website/ts/components/onboarding/onboarding_flow.tsx index c2b4a4ca7..91d5f2476 100644 --- a/packages/website/ts/components/onboarding/onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/onboarding_flow.tsx @@ -2,11 +2,14 @@ import * as React from 'react'; import { Placement, Popper, PopperChildrenProps } from 'react-popper'; import { OnboardingCard } from 'ts/components/onboarding/onboarding_card'; -import { ContinueButtonDisplay, OnboardingTooltip } from 'ts/components/onboarding/onboarding_tooltip'; +import { + ContinueButtonDisplay, + OnboardingTooltip, + TooltipPointerDisplay, +} from 'ts/components/onboarding/onboarding_tooltip'; import { Animation } from 'ts/components/ui/animation'; import { Container } from 'ts/components/ui/container'; import { Overlay } from 'ts/components/ui/overlay'; -import { PointerDirection } from 'ts/components/ui/pointer'; import { zIndex } from 'ts/style/z_index'; export interface FixedPositionSettings { @@ -15,7 +18,7 @@ export interface FixedPositionSettings { bottom?: string; left?: string; right?: string; - pointerDirection?: PointerDirection; + tooltipPointerDisplay?: TooltipPointerDisplay; } export interface TargetPositionSettings { @@ -28,12 +31,15 @@ export interface Step { // Provide either a CSS selector, or fixed position settings. Only applies to desktop. position: TargetPositionSettings | FixedPositionSettings; title?: string; + shouldCenterTitle?: boolean; content: React.ReactNode; shouldHideBackButton?: boolean; shouldHideNextButton?: boolean; continueButtonDisplay?: ContinueButtonDisplay; continueButtonText?: string; onContinueButtonClick?: () => void; + // Only used for very custom steps. + shouldRemoveExtraSpacing?: boolean; } export interface OnboardingFlowProps { @@ -44,12 +50,14 @@ export interface OnboardingFlowProps { updateOnboardingStep: (stepIndex: number) => void; disableOverlay?: boolean; isMobile: boolean; + disableCloseOnClickOutside?: boolean; } export class OnboardingFlow extends React.Component<OnboardingFlowProps> { public static defaultProps = { disableOverlay: false, isMobile: false, + disableCloseOnClickOutside: false, }; public render(): React.ReactNode { if (!this.props.isRunning) { @@ -67,7 +75,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { </Popper> ); } else if (currentStep.position.type === 'fixed') { - const { top, right, bottom, left, pointerDirection } = currentStep.position; + const { top, right, bottom, left, tooltipPointerDisplay } = currentStep.position; onboardingElement = ( <Container position="fixed" @@ -77,7 +85,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { bottom={bottom} left={left} > - {this._renderToolTip(pointerDirection)} + {this._renderToolTip(tooltipPointerDisplay)} </Container> ); } @@ -86,7 +94,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { } return ( <div> - <Overlay onClick={this.props.onClose} /> + <Overlay onClick={this.props.disableCloseOnClickOutside ? undefined : this.props.onClose} /> {onboardingElement} </div> ); @@ -101,7 +109,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { </div> ); } - private _renderToolTip(pointerDirection?: PointerDirection): React.ReactNode { + private _renderToolTip(tooltipPointerDisplay?: TooltipPointerDisplay): React.ReactNode { const { steps, stepIndex } = this.props; const step = steps[stepIndex]; const isLastStep = steps.length - 1 === stepIndex; @@ -109,6 +117,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { <Container marginLeft="30px" width="400px"> <OnboardingTooltip title={step.title} + shouldCenterTitle={step.shouldCenterTitle} content={step.content} isLastStep={isLastStep} shouldHideBackButton={step.shouldHideBackButton} @@ -119,7 +128,8 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { continueButtonDisplay={step.continueButtonDisplay} continueButtonText={step.continueButtonText} onContinueButtonClick={step.onContinueButtonClick} - pointerDirection={pointerDirection} + pointerDisplay={tooltipPointerDisplay} + shouldRemoveExtraSpacing={step.shouldRemoveExtraSpacing} /> </Container> ); @@ -133,6 +143,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { <Container position="relative" zIndex={1}> <OnboardingCard title={step.title} + shouldCenterTitle={step.shouldCenterTitle} content={step.content} isLastStep={isLastStep} shouldHideBackButton={step.shouldHideBackButton} @@ -144,6 +155,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> { continueButtonText={step.continueButtonText} onContinueButtonClick={step.onContinueButtonClick} borderRadius="10px 10px 0px 0px" + shouldRemoveExtraSpacing={step.shouldRemoveExtraSpacing} /> </Container> ); diff --git a/packages/website/ts/components/onboarding/onboarding_tooltip.tsx b/packages/website/ts/components/onboarding/onboarding_tooltip.tsx index d8065625d..15d47908d 100644 --- a/packages/website/ts/components/onboarding/onboarding_tooltip.tsx +++ b/packages/website/ts/components/onboarding/onboarding_tooltip.tsx @@ -4,22 +4,27 @@ import { OnboardingCard, OnboardingCardProps } from 'ts/components/onboarding/on import { Pointer, PointerDirection } from 'ts/components/ui/pointer'; export type ContinueButtonDisplay = 'enabled' | 'disabled'; +export type TooltipPointerDisplay = PointerDirection | 'none'; export interface OnboardingTooltipProps extends OnboardingCardProps { className?: string; - pointerDirection?: PointerDirection; + pointerDisplay?: TooltipPointerDisplay; } export const OnboardingTooltip: React.StatelessComponent<OnboardingTooltipProps> = props => { - const { pointerDirection, className, ...cardProps } = props; + const { pointerDisplay, className, ...cardProps } = props; + const card = <OnboardingCard {...cardProps} />; + if (pointerDisplay === 'none') { + return card; + } return ( - <Pointer className={className} direction={pointerDirection}> + <Pointer className={className} direction={pointerDisplay}> <OnboardingCard {...cardProps} /> </Pointer> ); }; OnboardingTooltip.defaultProps = { - pointerDirection: 'left', + pointerDisplay: 'left', }; OnboardingTooltip.displayName = 'OnboardingTooltip'; diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 1c2c92fd1..20a8f0a32 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -23,7 +23,7 @@ import { WrapEthOnboardingStep3, } from 'ts/components/onboarding/wrap_eth_onboarding_step'; import { AllowanceToggle } from 'ts/containers/inputs/allowance_toggle'; -import { ProviderType, ScreenWidths, Token, TokenByAddress, TokenStateByAddress } from 'ts/types'; +import { BrowserType, ProviderType, ScreenWidths, Token, TokenByAddress, TokenStateByAddress } from 'ts/types'; import { analytics } from 'ts/utils/analytics'; import { utils } from 'ts/utils/utils'; @@ -68,6 +68,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp } } public render(): React.ReactNode { + const browserType = utils.getBrowserType(); return ( <OnboardingFlow steps={this._getSteps()} @@ -77,6 +78,8 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp updateOnboardingStep={this._updateOnboardingStep.bind(this)} disableOverlay={this.props.screenWidth === ScreenWidths.Sm} isMobile={this.props.screenWidth === ScreenWidths.Sm} + // This is necessary to ensure onboarding stays open once the user unlocks metamask and clicks away + disableCloseOnClickOutside={browserType === BrowserType.Firefox || browserType === BrowserType.Opera} /> ); } @@ -88,9 +91,9 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp }; const underMetamaskExtension: FixedPositionSettings = { type: 'fixed', - top: '30px', + top: '10px', right: '10px', - pointerDirection: 'top', + tooltipPointerDisplay: 'none', }; const steps: Step[] = [ { @@ -102,10 +105,12 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp }, { position: underMetamaskExtension, - title: '0x Ecosystem Setup', + title: 'Please Unlock Metamask...', content: <UnlockWalletOnboardingStep />, shouldHideBackButton: true, shouldHideNextButton: true, + shouldCenterTitle: true, + shouldRemoveExtraSpacing: true, }, { position: nextToWalletPosition, @@ -137,13 +142,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp { position: nextToWalletPosition, title: 'Step 2: Wrap ETH', - content: ( - <WrapEthOnboardingStep3 - formattedWethBalanceIfExists={ - this._userHasVisibleWeth() ? this._getFormattedWethBalance() : undefined - } - /> - ), + content: <WrapEthOnboardingStep3 wethAmount={this._getWethBalance()} />, continueButtonDisplay: this._userHasVisibleWeth() ? 'enabled' : 'disabled', }, { @@ -184,11 +183,6 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp const ethTokenState = this.props.trackedTokenStateByAddress[ethToken.address]; return ethTokenState.balance; } - private _getFormattedWethBalance(): string { - const ethToken = utils.getEthToken(this.props.tokenByAddress); - const ethTokenState = this.props.trackedTokenStateByAddress[ethToken.address]; - return utils.getFormattedAmountFromToken(ethToken, ethTokenState); - } private _userHasVisibleWeth(): boolean { return this._getWethBalance() > new BigNumber(0); } diff --git a/packages/website/ts/components/onboarding/unlock_wallet_onboarding_step.tsx b/packages/website/ts/components/onboarding/unlock_wallet_onboarding_step.tsx index 4ed7137d4..358141520 100644 --- a/packages/website/ts/components/onboarding/unlock_wallet_onboarding_step.tsx +++ b/packages/website/ts/components/onboarding/unlock_wallet_onboarding_step.tsx @@ -1,16 +1,8 @@ import * as React from 'react'; -import { Container } from 'ts/components/ui/container'; -import { Text } from 'ts/components/ui/text'; +import { Image } from 'ts/components/ui/image'; export interface UnlockWalletOnboardingStepProps {} export const UnlockWalletOnboardingStep: React.StatelessComponent<UnlockWalletOnboardingStepProps> = () => ( - <div className="flex items-center flex-column"> - <div className="flex items-center flex-column"> - <Container marginTop="15px" marginBottom="15px"> - <img src="/images/metamask_icon.png" height="50px" width="50px" /> - </Container> - <Text center={true}>Unlock your MetaMask extension to get started.</Text> - </div> - </div> + <Image src="/images/unlock-mm.png" /> ); diff --git a/packages/website/ts/components/onboarding/wrap_eth_onboarding_step.tsx b/packages/website/ts/components/onboarding/wrap_eth_onboarding_step.tsx index 4d336c80f..e4332de75 100644 --- a/packages/website/ts/components/onboarding/wrap_eth_onboarding_step.tsx +++ b/packages/website/ts/components/onboarding/wrap_eth_onboarding_step.tsx @@ -1,8 +1,11 @@ import { colors } from '@0xproject/react-shared'; +import { BigNumber } from '@0xproject/utils'; import * as React from 'react'; +import { Balance } from 'ts/components/ui/balance'; import { Container } from 'ts/components/ui/container'; import { IconButton } from 'ts/components/ui/icon_button'; import { Text } from 'ts/components/ui/text'; +import { constants } from 'ts/utils/constants'; export interface WrapEthOnboardingStep1Props {} @@ -51,16 +54,20 @@ export const WrapEthOnboardingStep2: React.StatelessComponent<WrapEthOnboardingS ); export interface WrapEthOnboardingStep3Props { - formattedWethBalanceIfExists?: string; + wethAmount: BigNumber; } -export const WrapEthOnboardingStep3: React.StatelessComponent<WrapEthOnboardingStep3Props> = ({ - formattedWethBalanceIfExists, -}) => ( +export const WrapEthOnboardingStep3: React.StatelessComponent<WrapEthOnboardingStep3Props> = ({ wethAmount }) => ( <div className="flex items-center flex-column"> <Text> - You have <b>{formattedWethBalanceIfExists || '0 WETH'}</b> in your wallet. - {formattedWethBalanceIfExists && ' Great!'} + You have{' '} + <Balance + amount={wethAmount} + decimals={constants.DECIMAL_PLACES_ETH} + symbol={constants.ETHER_TOKEN_SYMBOL} + />{' '} + in your wallet. + {wethAmount.gt(0) && ' Great!'} </Text> <Container width="100%" marginTop="25px" marginBottom="15px" className="flex justify-center"> <div className="flex flex-column items-center"> diff --git a/packages/website/ts/components/ui/balance.tsx b/packages/website/ts/components/ui/balance.tsx new file mode 100644 index 000000000..9e5a256b6 --- /dev/null +++ b/packages/website/ts/components/ui/balance.tsx @@ -0,0 +1,27 @@ +import { BigNumber } from '@0xproject/utils'; +import * as React from 'react'; +import { Container } from 'ts/components/ui/container'; +import { Text } from 'ts/components/ui/text'; +import { utils } from 'ts/utils/utils'; + +export interface BalanceProps { + amount: BigNumber; + decimals: number; + symbol: string; +} + +export const Balance: React.StatelessComponent<BalanceProps> = ({ amount, decimals, symbol }) => { + const formattedAmout = utils.getFormattedAmount(amount, decimals); + return ( + <span> + <Text Tag="span" fontSize="16px" fontWeight="700" lineHeight="1em"> + {formattedAmout} + </Text> + <Container marginLeft="0.3em" Tag="span"> + <Text Tag="span" fontSize="12px" fontWeight="700" lineHeight="1em"> + {symbol} + </Text> + </Container> + </span> + ); +}; diff --git a/packages/website/ts/components/ui/container.tsx b/packages/website/ts/components/ui/container.tsx index edbf8814b..427cc6cc7 100644 --- a/packages/website/ts/components/ui/container.tsx +++ b/packages/website/ts/components/ui/container.tsx @@ -2,6 +2,8 @@ import * as React from 'react'; type StringOrNum = string | number; +export type ContainerTag = 'div' | 'span'; + export interface ContainerProps { marginTop?: StringOrNum; marginBottom?: StringOrNum; @@ -28,15 +30,21 @@ export interface ContainerProps { right?: string; bottom?: string; zIndex?: number; + Tag?: ContainerTag; } -export const Container: React.StatelessComponent<ContainerProps> = ({ children, className, isHidden, ...style }) => { +export const Container: React.StatelessComponent<ContainerProps> = props => { + const { children, className, Tag, isHidden, ...style } = props; const visibility = isHidden ? 'hidden' : undefined; return ( - <div style={{ ...style, visibility }} className={className}> + <Tag style={{ ...style, visibility }} className={className}> {children} - </div> + </Tag> ); }; +Container.defaultProps = { + Tag: 'div', +}; + Container.displayName = 'Container'; diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index de3b91ad0..6c1c495d7 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -8,6 +8,7 @@ import firstBy = require('thenby'); import { Blockchain } from 'ts/blockchain'; import { AccountConnection } from 'ts/components/ui/account_connection'; +import { Balance } from 'ts/components/ui/balance'; import { Container } from 'ts/components/ui/container'; import { DropDown, DropdownMouseEvent } from 'ts/components/ui/drop_down'; import { IconButton } from 'ts/components/ui/icon_button'; @@ -269,8 +270,8 @@ export class Wallet extends React.Component<WalletProps, WalletState> { position: 'relative', overflowY: this.state.isHoveringSidebar ? 'scroll' : 'hidden', marginRight: this.state.isHoveringSidebar ? 0 : 4, - // TODO: make this completely responsive - maxHeight: this.props.screenWidth !== ScreenWidths.Sm ? 475 : undefined, + minHeight: '250px', + maxHeight: !utils.isMobileWidth(this.props.screenWidth) ? 'calc(90vh - 300px)' : undefined, }; } private _onSidebarHover(_event: React.FormEvent<HTMLInputElement>): void { @@ -436,12 +437,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { </PlaceHolder> ); } else { - const result = utils.getFormattedAmount(amount, decimals, symbol); - return ( - <Text fontSize="16px" fontWeight="bold" lineHeight="1em"> - {result} - </Text> - ); + return <Balance amount={amount} decimals={decimals} symbol={symbol} />; } } private _renderValue( diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index f7324e87a..e8dc694f6 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -243,8 +243,8 @@ export enum BlockchainCallErrs { } export enum Environments { - DEVELOPMENT, - PRODUCTION, + DEVELOPMENT = 'DEVELOPMENT', + PRODUCTION = 'PRODUCTION', } export type ContractInstance = any; // TODO: add type definition for Contract @@ -552,7 +552,10 @@ export interface WebsiteBackendTokenInfo { } export interface WebsiteBackendGasInfo { + safeSlow: number; average: number; + fast: number; + fastest: number; } export interface WebsiteBackendJobInfo { diff --git a/packages/website/ts/utils/configs.ts b/packages/website/ts/utils/configs.ts index e8a486c35..97aabd13d 100644 --- a/packages/website/ts/utils/configs.ts +++ b/packages/website/ts/utils/configs.ts @@ -22,50 +22,9 @@ export const configs = { DOMAIN_DEVELOPMENT: '0xproject.localhost:3572', DOMAIN_PRODUCTION: '0xproject.com', ENVIRONMENT: isDevelopment ? Environments.DEVELOPMENT : Environments.PRODUCTION, - ICON_URL_BY_SYMBOL: { - REP: '/images/token_icons/augur.png', - DGD: '/images/token_icons/digixdao.png', - WETH: '/images/token_icons/ether_erc20.png', - MLN: '/images/token_icons/melon.png', - GNT: '/images/token_icons/golem.png', - MKR: '/images/token_icons/makerdao.png', - ZRX: '/images/token_icons/zero_ex.png', - ANT: '/images/token_icons/aragon.png', - BNT: '/images/token_icons/bancor.png', - BAT: '/images/token_icons/basicattentiontoken.png', - CVC: '/images/token_icons/civic.png', - EOS: '/images/token_icons/eos.png', - FUN: '/images/token_icons/funfair.png', - GNO: '/images/token_icons/gnosis.png', - ICN: '/images/token_icons/iconomi.png', - OMG: '/images/token_icons/omisego.png', - SNT: '/images/token_icons/status.png', - STORJ: '/images/token_icons/storjcoinx.png', - PAY: '/images/token_icons/tenx.png', - QTUM: '/images/token_icons/qtum.png', - DNT: '/images/token_icons/district0x.png', - SNGLS: '/images/token_icons/singularity.png', - EDG: '/images/token_icons/edgeless.png', - '1ST': '/images/token_icons/firstblood.jpg', - WINGS: '/images/token_icons/wings.png', - BQX: '/images/token_icons/bitquence.png', - LUN: '/images/token_icons/lunyr.png', - RLC: '/images/token_icons/iexec.png', - MCO: '/images/token_icons/monaco.png', - ADT: '/images/token_icons/adtoken.png', - CFI: '/images/token_icons/cofound-it.png', - ROL: '/images/token_icons/etheroll.png', - WGNT: '/images/token_icons/golem.png', - MTL: '/images/token_icons/metal.png', - NMR: '/images/token_icons/numeraire.png', - SAN: '/images/token_icons/santiment.png', - TAAS: '/images/token_icons/taas.png', - TKN: '/images/token_icons/tokencard.png', - TRST: '/images/token_icons/trust.png', - } as { [symbol: string]: string }, GOOGLE_ANALYTICS_ID: 'UA-98720122-1', LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE: '2017-11-22', - LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2018-6-25', + LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2018-7-5', OUTDATED_WRAPPED_ETHERS: [ { 42: { diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 623819fc9..8c76a7592 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -359,7 +359,9 @@ export const utils = { }, isDogfood, shouldShowPortalV2(): boolean { - return this.isDevelopment() || this.isStaging() || this.isDogfood(); + // return this.isDevelopment() || this.isStaging() || this.isDogfood(); + // TODO: Remove this method entirely after launch. + return true; }, shouldShowJobsPage(): boolean { return this.isDevelopment() || this.isStaging() || this.isDogfood(); @@ -381,9 +383,9 @@ export const utils = { return trackedTokens; }, getFormattedAmountFromToken(token: Token, tokenState: TokenState): string { - return utils.getFormattedAmount(tokenState.balance, token.decimals, token.symbol); + return utils.getFormattedAmount(tokenState.balance, token.decimals); }, - getFormattedAmount(amount: BigNumber, decimals: number, symbol: string): string { + getFormattedAmount(amount: BigNumber, decimals: number): string { const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals); // if the unit amount is less than 1, show the natural number of decimal places with a max of 4 // if the unit amount is greater than or equal to 1, show only 2 decimal places @@ -392,7 +394,7 @@ export const utils = { : 2; const format = `0,0.${_.repeat('0', precision)}`; const formattedAmount = numeral(unitAmount).format(format); - return `${formattedAmount} ${symbol}`; + return formattedAmount; }, getUsdValueFormattedAmount(amount: BigNumber, decimals: number, price: BigNumber): string { const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals); @@ -474,4 +476,8 @@ export const utils = { } return [downloadLink, isOnMobile]; }, + getTokenIconUrl(symbol: string): string { + const result = `/images/token_icons/${symbol}.png`; + return result; + }, }; @@ -6,7 +6,17 @@ version "0.3.9" resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59" -"@0xproject/assert@0.2.12", "@0xproject/assert@^0.2.12": +"@0xproject/assert@0.2.13", "@0xproject/assert@^0.2.13": + version "0.2.13" + resolved "https://registry.yarnpkg.com/@0xproject/assert/-/assert-0.2.13.tgz#8eb0e16cd6d802eae1b0ab86d344360ea0038331" + dependencies: + "@0xproject/json-schemas" "^0.8.2" + "@0xproject/typescript-typings" "^0.4.2" + "@0xproject/utils" "^0.7.2" + lodash "4.17.10" + valid-url "1.0.9" + +"@0xproject/assert@^0.2.12": version "0.2.12" resolved "https://registry.yarnpkg.com/@0xproject/assert/-/assert-0.2.12.tgz#0e53de4eb598ecc6138aec82d4609c0e46f433b3" dependencies: @@ -49,7 +59,29 @@ ethers "3.0.22" lodash "4.17.10" -"@0xproject/json-schemas@0.8.1", "@0xproject/json-schemas@^0.8.1": +"@0xproject/fill-scenarios@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@0xproject/fill-scenarios/-/fill-scenarios-0.0.5.tgz#a62a240ae40423b9b73ecc0b1fc2abb58b76621c" + dependencies: + "@0xproject/base-contract" "^0.3.5" + "@0xproject/order-utils" "^0.0.8" + "@0xproject/types" "^0.8.2" + "@0xproject/typescript-typings" "^0.4.2" + "@0xproject/utils" "^0.7.2" + "@0xproject/web3-wrapper" "^0.7.2" + ethers "3.0.22" + lodash "4.17.10" + +"@0xproject/json-schemas@0.8.2", "@0xproject/json-schemas@^0.8.2": + version "0.8.2" + resolved "https://registry.yarnpkg.com/@0xproject/json-schemas/-/json-schemas-0.8.2.tgz#9d3f446e546ce0c959cf7beb45d41ac60476a78c" + dependencies: + "@0xproject/typescript-typings" "^0.4.2" + "@types/node" "9.6.0" + jsonschema "1.2.2" + lodash.values "4.3.0" + +"@0xproject/json-schemas@^0.8.1": version "0.8.1" resolved "https://registry.yarnpkg.com/@0xproject/json-schemas/-/json-schemas-0.8.1.tgz#2613fd9405728bc65f2eb78e86258d44b4925ab0" dependencies: @@ -74,22 +106,20 @@ ethereumjs-util "5.1.5" lodash "4.17.10" -"@0xproject/order-watcher@^0.0.6": - version "0.0.6" - resolved "https://registry.yarnpkg.com/@0xproject/order-watcher/-/order-watcher-0.0.6.tgz#85a8fb21e5755bb555f427b12d64d10b89b332e6" - dependencies: - "@0xproject/assert" "^0.2.12" - "@0xproject/base-contract" "^0.3.4" - "@0xproject/contract-wrappers" "^0.0.5" - "@0xproject/fill-scenarios" "^0.0.4" - "@0xproject/json-schemas" "^0.8.1" - "@0xproject/order-utils" "^0.0.7" - "@0xproject/types" "^0.8.1" - "@0xproject/typescript-typings" "^0.4.1" - "@0xproject/utils" "^0.7.1" - "@0xproject/web3-wrapper" "^0.7.1" - bintrees "1.0.2" - ethers "3.0.22" +"@0xproject/order-utils@^0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@0xproject/order-utils/-/order-utils-0.0.8.tgz#72077749a22cae5f0c748a6af90d1d77f5ebf8c9" + dependencies: + "@0xproject/assert" "^0.2.13" + "@0xproject/json-schemas" "^0.8.2" + "@0xproject/types" "^0.8.2" + "@0xproject/typescript-typings" "^0.4.2" + "@0xproject/utils" "^0.7.2" + "@0xproject/web3-wrapper" "^0.7.2" + "@types/node" "9.6.0" + bn.js "4.11.7" + ethereumjs-abi "0.6.5" + ethereumjs-util "5.1.5" lodash "4.17.10" "@0xproject/types@^0.5.0": @@ -105,6 +135,13 @@ "@types/node" "9.6.0" bignumber.js "~4.1.0" +"@0xproject/types@^0.8.2": + version "0.8.2" + resolved "https://registry.yarnpkg.com/@0xproject/types/-/types-0.8.2.tgz#6f936b73bfb6f017b5102002d97da0881da92d1b" + dependencies: + "@types/node" "9.6.0" + bignumber.js "~4.1.0" + "@0xproject/typescript-typings@^0.0.3": version "0.0.3" resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-0.0.3.tgz#3272080bde00ade0a970b0d236686b483b08a1d0" @@ -229,7 +266,7 @@ "@types/express-serve-static-core" "*" "@types/serve-static" "*" -"@types/fetch-mock@^5.12.1": +"@types/fetch-mock@^5.12.2": version "5.12.2" resolved "https://registry.yarnpkg.com/@types/fetch-mock/-/fetch-mock-5.12.2.tgz#8c96517ff74303031c65c5da2d99858e34c844d2" @@ -249,7 +286,7 @@ dependencies: "@types/node" "*" -"@types/glob@*", "@types/glob@^5.0.33": +"@types/glob@*", "@types/glob@5.0.35", "@types/glob@^5.0.33": version "5.0.35" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.35.tgz#1ae151c802cece940443b5ac246925c85189f32a" dependencies: @@ -1796,7 +1833,7 @@ bindings@^1.2.1, bindings@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" -bintrees@1.0.2, bintrees@^1.0.2: +bintrees@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/bintrees/-/bintrees-1.0.2.tgz#49f896d6e858a4a499df85c38fb399b9aff840f8" |