diff --git a/contracts/asset-proxy/CHANGELOG.json b/contracts/asset-proxy/CHANGELOG.json index de7e90d662..e4a573f18e 100644 --- a/contracts/asset-proxy/CHANGELOG.json +++ b/contracts/asset-proxy/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/asset-proxy/CHANGELOG.md b/contracts/asset-proxy/CHANGELOG.md index fcf5202c65..d1fc0c74c2 100644 --- a/contracts/asset-proxy/CHANGELOG.md +++ b/contracts/asset-proxy/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json index def8eead7b..067fa9d6a6 100644 --- a/contracts/asset-proxy/package.json +++ b/contracts/asset-proxy/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-asset-proxy", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,10 +46,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -66,16 +66,16 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-erc20": "1.0.2", "@0x/contracts-erc721": "1.0.2", - "@0x/contracts-test-utils": "^3.0.3", + "@0x/contracts-test-utils": "^3.0.4", "@0x/contracts-utils": "2.0.1", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/erc20/CHANGELOG.json b/contracts/erc20/CHANGELOG.json index 972de20389..e3962e8fc5 100644 --- a/contracts/erc20/CHANGELOG.json +++ b/contracts/erc20/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/erc20/CHANGELOG.md b/contracts/erc20/CHANGELOG.md index 6583096724..87cfc418ae 100644 --- a/contracts/erc20/CHANGELOG.md +++ b/contracts/erc20/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/erc20/package.json b/contracts/erc20/package.json index 45272f157e..dff121ae35 100644 --- a/contracts/erc20/package.json +++ b/contracts/erc20/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-erc20", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -67,13 +67,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-exchange-libs": "1.0.2", "@0x/contracts-utils": "2.0.1", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/erc721/CHANGELOG.json b/contracts/erc721/CHANGELOG.json index 5f3e08dd35..cae644730d 100644 --- a/contracts/erc721/CHANGELOG.json +++ b/contracts/erc721/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/erc721/CHANGELOG.md b/contracts/erc721/CHANGELOG.md index 5886f10b8c..4bc5404084 100644 --- a/contracts/erc721/CHANGELOG.md +++ b/contracts/erc721/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/erc721/package.json b/contracts/erc721/package.json index 830ea5d737..58eb068c35 100644 --- a/contracts/erc721/package.json +++ b/contracts/erc721/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-erc721", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -67,12 +67,12 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-utils": "2.0.1", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/exchange-forwarder/CHANGELOG.json b/contracts/exchange-forwarder/CHANGELOG.json index 338adde3d1..b06678f2cf 100644 --- a/contracts/exchange-forwarder/CHANGELOG.json +++ b/contracts/exchange-forwarder/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/exchange-forwarder/CHANGELOG.md b/contracts/exchange-forwarder/CHANGELOG.md index 24bb6da5be..aacc015dc5 100644 --- a/contracts/exchange-forwarder/CHANGELOG.md +++ b/contracts/exchange-forwarder/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json index 875d60ae68..3af027f6df 100644 --- a/contracts/exchange-forwarder/package.json +++ b/contracts/exchange-forwarder/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-exchange-forwarder", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,12 +46,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contract-wrappers": "^7.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contract-wrappers": "^7.1.0", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -68,18 +68,18 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-asset-proxy": "1.0.2", "@0x/contracts-erc20": "1.0.2", "@0x/contracts-erc721": "1.0.2", "@0x/contracts-exchange": "1.0.2", "@0x/contracts-exchange-libs": "1.0.2", "@0x/contracts-utils": "2.0.1", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/exchange-libs/CHANGELOG.json b/contracts/exchange-libs/CHANGELOG.json index 5de06a7140..9d2abeeb11 100644 --- a/contracts/exchange-libs/CHANGELOG.json +++ b/contracts/exchange-libs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/exchange-libs/CHANGELOG.md b/contracts/exchange-libs/CHANGELOG.md index 46e970e6f5..27723a7b5d 100644 --- a/contracts/exchange-libs/CHANGELOG.md +++ b/contracts/exchange-libs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/exchange-libs/package.json b/contracts/exchange-libs/package.json index 8ffd5e81db..640458041c 100644 --- a/contracts/exchange-libs/package.json +++ b/contracts/exchange-libs/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-exchange-libs", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -67,13 +67,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-utils": "2.0.1", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/exchange/CHANGELOG.json b/contracts/exchange/CHANGELOG.json index 02c614b1a6..50ea203fce 100644 --- a/contracts/exchange/CHANGELOG.json +++ b/contracts/exchange/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.4", "changes": [ diff --git a/contracts/exchange/CHANGELOG.md b/contracts/exchange/CHANGELOG.md index f265cd96fe..2e48cdbb83 100644 --- a/contracts/exchange/CHANGELOG.md +++ b/contracts/exchange/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.4 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/exchange/package.json b/contracts/exchange/package.json index b167850879..af29482ef4 100644 --- a/contracts/exchange/package.json +++ b/contracts/exchange/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-exchange", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -67,17 +67,17 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-asset-proxy": "1.0.2", "@0x/contracts-erc20": "1.0.2", "@0x/contracts-erc721": "1.0.2", "@0x/contracts-exchange-libs": "1.0.2", "@0x/contracts-utils": "2.0.1", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.11" diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json index 8a1335c518..5e9395b2bd 100644 --- a/contracts/extensions/CHANGELOG.json +++ b/contracts/extensions/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/contracts/extensions/CHANGELOG.md b/contracts/extensions/CHANGELOG.md index 34137efdbc..dc5cd5fe3d 100644 --- a/contracts/extensions/CHANGELOG.md +++ b/contracts/extensions/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 831a3398a8..deeed7b9cf 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-extensions", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -46,12 +46,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contract-wrappers": "^7.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contract-wrappers": "^7.1.0", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -68,18 +68,18 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-asset-proxy": "1.0.2", "@0x/contracts-erc20": "1.0.2", "@0x/contracts-erc721": "1.0.2", "@0x/contracts-exchange": "1.0.2", "@0x/contracts-exchange-libs": "1.0.2", "@0x/contracts-utils": "2.0.1", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json index 0c1b52f2f3..e5d1a3a55e 100644 --- a/contracts/multisig/CHANGELOG.json +++ b/contracts/multisig/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/contracts/multisig/CHANGELOG.md b/contracts/multisig/CHANGELOG.md index 7c7b0ae4ae..636c1da6f2 100644 --- a/contracts/multisig/CHANGELOG.md +++ b/contracts/multisig/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json index f3774c4092..4df55e5953 100644 --- a/contracts/multisig/package.json +++ b/contracts/multisig/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-multisig", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/node": "*", @@ -67,13 +67,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", + "@0x/base-contract": "^4.0.3", "@0x/contracts-asset-proxy": "1.0.2", "@0x/contracts-erc20": "1.0.2", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json index 812bff732a..0393512716 100644 --- a/contracts/test-utils/CHANGELOG.json +++ b/contracts/test-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.3", "changes": [ diff --git a/contracts/test-utils/CHANGELOG.md b/contracts/test-utils/CHANGELOG.md index b3fc98ab6b..3568f5ba30 100644 --- a/contracts/test-utils/CHANGELOG.md +++ b/contracts/test-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json index b379f470a8..0e42bee0af 100644 --- a/contracts/test-utils/package.json +++ b/contracts/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-test-utils", - "version": "3.0.3", + "version": "3.0.4", "engines": { "node": ">=6.12" }, @@ -40,19 +40,19 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/dev-utils": "^2.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/sol-compiler": "^3.0.2", - "@0x/sol-coverage": "^2.0.2", - "@0x/sol-profiler": "^2.0.3", - "@0x/sol-trace": "^2.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/dev-utils": "^2.1.0", + "@0x/order-utils": "^6.1.0", + "@0x/sol-compiler": "^3.0.3", + "@0x/sol-coverage": "^2.0.3", + "@0x/sol-profiler": "^2.0.4", + "@0x/sol-trace": "^2.0.4", + "@0x/subproviders": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/bn.js": "^4.11.0", "@types/js-combinatorics": "^0.5.29", "@types/lodash": "4.14.104", diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json index bc887914b2..664d00746d 100644 --- a/contracts/utils/CHANGELOG.json +++ b/contracts/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/contracts/utils/CHANGELOG.md b/contracts/utils/CHANGELOG.md index dd0b91a61f..91cb0f2ea8 100644 --- a/contracts/utils/CHANGELOG.md +++ b/contracts/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/contracts/utils/package.json b/contracts/utils/package.json index 91abc8043e..13a3bc80bf 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-utils", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", - "@0x/contracts-gen": "^1.0.1", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/abi-gen": "^2.0.3", + "@0x/contracts-gen": "^1.0.2", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -68,12 +68,12 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/base-contract": "^4.0.2", - "@0x/order-utils": "^6.0.1", + "@0x/base-contract": "^4.0.3", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "bn.js": "^4.11.8", "ethereum-types": "^2.0.0", "ethereumjs-util": "^5.1.1", diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 69381d7a00..4167cdaef5 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "5.0.0", + "changes": [ + { + "note": "Export `transactionHashUtils`, `DecodedCalldata`, `ZeroExTransaction`, and `SignedZeroExTransaction`", + "pr": 1569 + } + ], + "timestamp": 1549733923 + }, { "version": "4.0.3", "changes": [ diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 7c14fb5863..d4b8da4460 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 +## v5.0.0 - _February 9, 2019_ + + * Export `transactionHashUtils`, `DecodedCalldata`, `ZeroExTransaction`, and `SignedZeroExTransaction` (#1569) + ## v4.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index b021768116..639bbf3510 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "4.0.3", + "version": "5.0.0", "engines": { "node": ">=6.12" }, @@ -42,10 +42,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", "@0x/contract-addresses": "^2.2.1", - "@0x/dev-utils": "^2.0.2", - "@0x/migrations": "^3.0.3", + "@0x/dev-utils": "^2.1.0", + "@0x/migrations": "^3.0.4", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -72,16 +72,16 @@ "webpack": "^4.20.2" }, "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/base-contract": "^4.0.2", - "@0x/contract-wrappers": "^7.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/order-watcher": "^3.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/assert": "^2.0.3", + "@0x/base-contract": "^4.0.3", + "@0x/contract-wrappers": "^7.1.0", + "@0x/order-utils": "^6.1.0", + "@0x/order-watcher": "^3.0.4", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/web3-provider-engine": "^14.0.0", "ethereum-types": "^2.0.0", "ethers": "~4.0.4", diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 006e4cf29a..082b097277 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,6 +1,12 @@ export { ContractAddresses } from '@0x/contract-addresses'; -export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0x/order-utils'; +export { + assetDataUtils, + signatureUtils, + generatePseudoRandomSalt, + orderHashUtils, + transactionHashUtils, +} from '@0x/order-utils'; export { ContractWrappers, @@ -68,7 +74,7 @@ export { MetamaskSubprovider, } from '@0x/subproviders'; -export { AbiDecoder } from '@0x/utils'; +export { AbiDecoder, DecodedCalldata } from '@0x/utils'; export { BigNumber } from '@0x/utils'; @@ -92,6 +98,8 @@ export { OrderRelevantState, Stats, DutchAuctionDetails, + ZeroExTransaction, + SignedZeroExTransaction, } from '@0x/types'; export { diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index a7793c5d5a..cd5ff0cadf 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.2", "changes": [ diff --git a/packages/abi-gen-wrappers/CHANGELOG.md b/packages/abi-gen-wrappers/CHANGELOG.md index 93e11736c4..17ed224e5b 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.md +++ b/packages/abi-gen-wrappers/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json index c9682e28fc..ff65f7e030 100644 --- a/packages/abi-gen-wrappers/package.json +++ b/packages/abi-gen-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0x/abi-gen-wrappers", - "version": "3.0.2", + "version": "3.0.3", "engines": { "node": ">=6.12" }, @@ -30,19 +30,19 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md", "devDependencies": { - "@0x/abi-gen": "^2.0.2", + "@0x/abi-gen": "^2.0.3", "@0x/abi-gen-templates": "^2.0.0", "@0x/tslint-config": "^3.0.0", "@0x/types": "^2.0.2", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "ethers": "~4.0.4", "lodash": "^4.17.11", "shx": "^0.2.2" }, "dependencies": { - "@0x/base-contract": "^4.0.2" + "@0x/base-contract": "^4.0.3" }, "publishConfig": { "access": "public" diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index d7770c06df..ff3ba53d85 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.2", "changes": [ diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 65c914cc9c..bd3c0add32 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 +## v2.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index d07e0a5809..29433a68b3 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0x/abi-gen", - "version": "2.0.2", + "version": "2.0.3", "engines": { "node": ">=6.12" }, @@ -32,7 +32,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "chalk": "^2.3.0", "ethereum-types": "^2.0.0", "glob": "^7.1.2", diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index e2231a6769..a53339d3db 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.2", "changes": [ diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index 6821154976..f865b86c19 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/assert/package.json b/packages/assert/package.json index 551414de33..04061683c0 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0x/assert", - "version": "2.0.2", + "version": "2.0.3", "engines": { "node": ">=6.12" }, @@ -44,9 +44,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/json-schemas": "^3.0.2", + "@0x/json-schemas": "^3.0.3", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "lodash": "^4.17.11", "valid-url": "^1.0.9" }, diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index 80b02f2c6d..82e072dde2 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "5.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "5.0.3", "changes": [ diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md index c5977e3e49..6f268f8835 100644 --- a/packages/asset-buyer/CHANGELOG.md +++ b/packages/asset-buyer/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v5.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v5.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index 391a5d6881..a7e17441c7 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -1,6 +1,6 @@ { "name": "@0x/asset-buyer", - "version": "5.0.3", + "version": "5.0.4", "engines": { "node": ">=6.12" }, @@ -36,16 +36,16 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md", "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/connect": "^4.0.3", - "@0x/contract-wrappers": "^7.0.2", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/subproviders": "^3.0.2", + "@0x/assert": "^2.0.3", + "@0x/connect": "^4.0.4", + "@0x/contract-wrappers": "^7.1.0", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" }, diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index d3cf766964..e3a3992c15 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "4.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "4.0.2", "changes": [ diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index 68de790bc2..ffc1f670bd 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 +## v4.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v4.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index d9970b7f42..a1b9a08374 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0x/base-contract", - "version": "4.0.2", + "version": "4.0.3", "engines": { "node": ">=6.12" }, @@ -41,8 +41,8 @@ }, "dependencies": { "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "ethers": "~4.0.4", "lodash": "^4.17.11" diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index d7e557146e..aca42a092e 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "4.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "4.0.3", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 3094d22516..3fdd9ac025 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v4.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v4.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/connect/package.json b/packages/connect/package.json index a9648594c6..62a49c072f 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0x/connect", - "version": "4.0.3", + "version": "4.0.4", "engines": { "node": ">=6.12" }, @@ -44,12 +44,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", + "@0x/assert": "^2.0.3", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "lodash": "^4.17.11", "query-string": "^6.0.0", "sinon": "^4.0.0", diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 73c8e60709..1554f30f84 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "7.1.0", + "changes": [ + { + "note": "Added calldata decoding to ContractWrappers", + "pr": 1569 + } + ], + "timestamp": 1549733923 + }, { "version": "7.0.2", "changes": [ diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 2e174e7673..c2ccbec49b 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 +## v7.1.0 - _February 9, 2019_ + + * Added calldata decoding to ContractWrappers (#1569) + ## v7.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 7ea270eb55..b3fa98e41a 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contract-wrappers", - "version": "7.0.2", + "version": "7.1.0", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -37,9 +37,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0x/dev-utils": "^2.0.2", - "@0x/migrations": "^3.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/dev-utils": "^2.1.0", + "@0x/migrations": "^3.0.4", + "@0x/subproviders": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -65,18 +65,18 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", - "@0x/assert": "^2.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", + "@0x/assert": "^2.0.3", "@0x/contract-addresses": "^2.2.1", "@0x/contract-artifacts": "^1.3.0", - "@0x/contracts-test-utils": "^3.0.3", - "@0x/fill-scenarios": "^2.0.3", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", + "@0x/contracts-test-utils": "^3.0.4", + "@0x/fill-scenarios": "^2.0.4", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "ethereumjs-abi": "0.6.5", "ethereumjs-blockstream": "6.0.0", diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 4e594593e5..f43dc5d265 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -1,4 +1,5 @@ import { + DutchAuction, ERC20Proxy, ERC20Token, ERC721Proxy, @@ -8,6 +9,7 @@ import { OrderValidator, WETH9, } from '@0x/contract-artifacts'; +import { AbiDecoder } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; @@ -87,6 +89,7 @@ export class ContractWrappers { }; this._web3Wrapper = new Web3Wrapper(provider, txDefaults); const artifactsArray = [ + DutchAuction, ERC20Proxy, ERC20Token, ERC721Proxy, @@ -97,7 +100,7 @@ export class ContractWrappers { WETH9, ]; _.forEach(artifactsArray, artifact => { - this._web3Wrapper.abiDecoder.addABI(artifact.compilerOutput.abi); + this._web3Wrapper.abiDecoder.addABI(artifact.compilerOutput.abi, artifact.contractName); }); const blockPollingIntervalMs = _.isUndefined(config.blockPollingIntervalMs) ? constants.DEFAULT_BLOCK_POLLING_INTERVAL @@ -168,4 +171,11 @@ export class ContractWrappers { public getProvider(): Provider { return this._web3Wrapper.getProvider(); } + /** + * Get the abi decoder instance currently used by contract-wrappers + * @return AbiDecoder instance + */ + public getAbiDecoder(): AbiDecoder { + return this._web3Wrapper.abiDecoder; + } } diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 69bbe3c91b..5fc400edf6 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -38,6 +38,8 @@ export { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper'; export { TransactionEncoder } from './utils/transaction_encoder'; +export { AbiDecoder, DecodedCalldata } from '@0x/utils'; + export { ContractWrappersError, ForwarderWrapperError, @@ -83,6 +85,11 @@ export { JSONRPCResponseError, AbiDefinition, LogWithDecodedArgs, + LogEntry, + DecodedLogEntry, + DecodedLogEntryEvent, + LogEntryEvent, + RawLog, FunctionAbi, EventAbi, EventParameter, diff --git a/packages/contract-wrappers/src/utils/transaction_encoder.ts b/packages/contract-wrappers/src/utils/transaction_encoder.ts index 307487a9be..0832ee73a9 100644 --- a/packages/contract-wrappers/src/utils/transaction_encoder.ts +++ b/packages/contract-wrappers/src/utils/transaction_encoder.ts @@ -241,6 +241,23 @@ export class TransactionEncoder { ); return abiEncodedData; } + /** + * Encodes a matchOrders transaction. + * @param leftOrder First order to match. + * @param rightOrder Second order to match. + * @return Hex encoded abi of the function call. + */ + public matchOrdersTx(leftOrder: SignedOrder, rightOrder: SignedOrder): string { + assert.doesConformToSchema('leftOrder', leftOrder, schemas.orderSchema); + assert.doesConformToSchema('rightOrder', rightOrder, schemas.orderSchema); + const abiEncodedData = this._getExchangeContract().matchOrders.getABIEncodedTransactionData( + leftOrder, + rightOrder, + leftOrder.signature, + rightOrder.signature, + ); + return abiEncodedData; + } /** * Encodes a preSign transaction. * @param hash Hash to pre-sign diff --git a/packages/contract-wrappers/test/calldata_decoder_test.ts b/packages/contract-wrappers/test/calldata_decoder_test.ts new file mode 100644 index 0000000000..ba1539ef55 --- /dev/null +++ b/packages/contract-wrappers/test/calldata_decoder_test.ts @@ -0,0 +1,127 @@ +import { constants, OrderFactory } from '@0x/contracts-test-utils'; +import { BlockchainLifecycle } from '@0x/dev-utils'; +import { assetDataUtils } from '@0x/order-utils'; +import { SignedOrder } from '@0x/types'; +import { addressUtils, BigNumber } from '@0x/utils'; +import * as chai from 'chai'; +import * as _ from 'lodash'; +import 'mocha'; + +import { ContractAddresses, ContractWrappers } from '../src'; + +import { chaiSetup } from './utils/chai_setup'; +import { migrateOnceAsync } from './utils/migrate'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; + +chaiSetup.configure(); +const expect = chai.expect; + +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe('ABI Decoding Calldata', () => { + const defaultERC20MakerAssetAddress = addressUtils.generatePseudoRandomAddress(); + const matchOrdersSignature = + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'; + let signedOrderLeft: SignedOrder; + let signedOrderRight: SignedOrder; + let orderLeft = {}; + let orderRight = {}; + let matchOrdersTxData: string; + let contractAddresses: ContractAddresses; + let contractWrappers: ContractWrappers; + + before(async () => { + // Create accounts + const accounts = await web3Wrapper.getAvailableAddressesAsync(); + const [makerAddressLeft, makerAddressRight] = accounts; + const [privateKeyLeft, privateKeyRight] = constants.TESTRPC_PRIVATE_KEYS; + const exchangeAddress = addressUtils.generatePseudoRandomAddress(); + const feeRecipientAddress = addressUtils.generatePseudoRandomAddress(); + // Create orders to match. + // Values are arbitrary, with the exception of maker addresses (generated above). + orderLeft = { + makerAddress: makerAddressLeft, + makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress), + makerAssetAmount: new BigNumber(10), + takerAddress: '0x0000000000000000000000000000000000000000', + takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress), + takerAssetAmount: new BigNumber(1), + feeRecipientAddress, + makerFee: new BigNumber(0), + takerFee: new BigNumber(0), + senderAddress: '0x0000000000000000000000000000000000000000', + expirationTimeSeconds: new BigNumber(1549498915), + salt: new BigNumber(217), + }; + orderRight = { + makerAddress: makerAddressRight, + makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress), + makerAssetAmount: new BigNumber(1), + takerAddress: '0x0000000000000000000000000000000000000000', + takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress), + takerAssetAmount: new BigNumber(8), + feeRecipientAddress, + makerFee: new BigNumber(0), + takerFee: new BigNumber(0), + senderAddress: '0x0000000000000000000000000000000000000000', + expirationTimeSeconds: new BigNumber(1549498915), + salt: new BigNumber(50010), + }; + const orderFactoryLeft = new OrderFactory(privateKeyLeft, orderLeft); + signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({ exchangeAddress }); + const orderFactoryRight = new OrderFactory(privateKeyRight, orderRight); + signedOrderRight = await orderFactoryRight.newSignedOrderAsync({ exchangeAddress }); + // Encode match orders transaction + contractAddresses = await migrateOnceAsync(); + await blockchainLifecycle.startAsync(); + const config = { + networkId: constants.TESTRPC_NETWORK_ID, + contractAddresses, + blockPollingIntervalMs: 10, + }; + contractWrappers = new ContractWrappers(provider, config); + const transactionEncoder = await contractWrappers.exchange.transactionEncoderAsync(); + matchOrdersTxData = transactionEncoder.matchOrdersTx(signedOrderLeft, signedOrderRight); + }); + + describe('decode', () => { + it('should successfully decode DutchAuction.matchOrders calldata', async () => { + const contractName = 'DutchAuction'; + const decodedTxData = contractWrappers + .getAbiDecoder() + .decodeCalldataOrThrow(matchOrdersTxData, contractName); + const expectedFunctionName = 'matchOrders'; + const expectedFunctionArguments = { + buyOrder: orderLeft, + sellOrder: orderRight, + buySignature: signedOrderLeft.signature, + sellSignature: signedOrderRight.signature, + }; + expect(decodedTxData.functionName).to.be.equal(expectedFunctionName); + expect(decodedTxData.functionSignature).to.be.equal(matchOrdersSignature); + expect(decodedTxData.functionArguments).to.be.deep.equal(expectedFunctionArguments); + }); + it('should successfully decode Exchange.matchOrders calldata (and distinguish from DutchAuction.matchOrders)', async () => { + const contractName = 'Exchange'; + const decodedTxData = contractWrappers + .getAbiDecoder() + .decodeCalldataOrThrow(matchOrdersTxData, contractName); + const expectedFunctionName = 'matchOrders'; + const expectedFunctionArguments = { + leftOrder: orderLeft, + rightOrder: orderRight, + leftSignature: signedOrderLeft.signature, + rightSignature: signedOrderRight.signature, + }; + expect(decodedTxData.functionName).to.be.equal(expectedFunctionName); + expect(decodedTxData.functionSignature).to.be.equal(matchOrdersSignature); + expect(decodedTxData.functionArguments).to.be.deep.equal(expectedFunctionArguments); + }); + it('should throw if cannot decode calldata', async () => { + const badTxData = '0x01020304'; + expect(() => { + contractWrappers.getAbiDecoder().decodeCalldataOrThrow(badTxData); + }).to.throw("No functions registered for selector '0x01020304'"); + }); + }); +}); diff --git a/packages/contracts-gen/CHANGELOG.json b/packages/contracts-gen/CHANGELOG.json index f1a523c304..3c1a26b5d8 100644 --- a/packages/contracts-gen/CHANGELOG.json +++ b/packages/contracts-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.1", "changes": [ diff --git a/packages/contracts-gen/CHANGELOG.md b/packages/contracts-gen/CHANGELOG.md index e046c6a0a9..54cc2a6b96 100644 --- a/packages/contracts-gen/CHANGELOG.md +++ b/packages/contracts-gen/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.2 - _February 9, 2019_ + + * Dependencies updated + ## v1.0.1 - _February 7, 2019_ * Dependencies updated diff --git a/packages/contracts-gen/package.json b/packages/contracts-gen/package.json index fdf22ab454..67d29083d5 100644 --- a/packages/contracts-gen/package.json +++ b/packages/contracts-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-gen", - "version": "1.0.1", + "version": "1.0.2", "engines": { "node": ">=6.12" }, @@ -29,7 +29,7 @@ "@0x/sol-resolver": "^2.0.2", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11", "prettier": "^1.16.3", diff --git a/packages/dev-tools-pages/package.json b/packages/dev-tools-pages/package.json index 80ff16a441..17a0a1d77e 100644 --- a/packages/dev-tools-pages/package.json +++ b/packages/dev-tools-pages/package.json @@ -1,6 +1,6 @@ { "name": "@0x/dev-tools-pages", - "version": "0.0.18", + "version": "0.0.19", "engines": { "node": ">=6.12" }, @@ -26,7 +26,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@0x/react-shared": "^2.0.3", + "@0x/react-shared": "^2.0.4", "basscss": "^8.0.3", "bowser": "^1.9.3", "highlight.js": "^9.13.1", diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index ce6cfede53..4684fa9155 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "2.1.0", + "changes": [ + { + "note": "Allow using the Web3Factory in-process Ganache provider with existing DB snapshot", + "pr": 1602 + } + ], + "timestamp": 1549733923 + }, { "version": "2.0.2", "changes": [ diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 41e2ca88a3..084c336cc4 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 +## v2.1.0 - _February 9, 2019_ + + * Allow using the Web3Factory in-process Ganache provider with existing DB snapshot (#1602) + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 89298f4dbf..ceae090350 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/dev-utils", - "version": "2.0.2", + "version": "2.1.0", "engines": { "node": ">=6.12" }, @@ -41,11 +41,11 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/subproviders": "^3.0.2", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/web3-provider-engine": "^14.0.0", "chai": "^4.0.1", "ethereum-types": "^2.0.0", diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 5f8981a467..3fa3c19f70 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -47,8 +47,11 @@ export const web3Factory = { _.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) || config.shouldThrowErrorsOnGanacheRPCResponse; if (!_.isUndefined(config.ganacheDatabasePath)) { - // Saving the snapshot to a local db. Ganache requires this directory to exist - fs.mkdirSync(config.ganacheDatabasePath); + const doesDatabaseAlreadyExist = fs.existsSync(config.ganacheDatabasePath); + if (!doesDatabaseAlreadyExist) { + // Working with local DB snapshot. Ganache requires this directory to exist + fs.mkdirSync(config.ganacheDatabasePath); + } } provider.addProvider( new GanacheSubprovider({ diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 8615d137b7..87503eba01 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index e87652e7da..1e95eb171d 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 +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 523bc07c12..fb468deb73 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "name": "@0x/fill-scenarios", - "version": "2.0.3", + "version": "2.0.4", "description": "0x order fill scenario generator", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -28,14 +28,14 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", - "@0x/base-contract": "^4.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", + "@0x/base-contract": "^4.0.3", "@0x/contract-artifacts": "^1.3.0", - "@0x/order-utils": "^6.0.1", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "ethereum-types": "^2.0.0", "ethers": "~4.0.4", "lodash": "^4.17.11" diff --git a/packages/instant/package.json b/packages/instant/package.json index 0fe45e9632..81fc61ec58 100644 --- a/packages/instant/package.json +++ b/packages/instant/package.json @@ -1,6 +1,6 @@ { "name": "@0x/instant", - "version": "1.0.12", + "version": "1.0.13", "engines": { "node": ">=6.12" }, @@ -42,15 +42,15 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md", "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/asset-buyer": "^5.0.3", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/subproviders": "^3.0.2", + "@0x/assert": "^2.0.3", + "@0x/asset-buyer": "^5.0.4", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "babel-runtime": "^6.26.0", "bowser": "^1.9.4", "copy-to-clipboard": "^3.0.8", diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index 0acf3f2ad1..243bb569b8 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -17,6 +17,7 @@ import { ZeroExInstantOverlay, ZeroExInstantOverlayProps } from './index'; import { Network, OrderSource } from './types'; import { analytics } from './util/analytics'; import { assert } from './util/assert'; +import { orderCoercionUtil } from './util/order_coercion'; import { providerFactory } from './util/provider_factory'; import { util } from './util/util'; @@ -93,16 +94,24 @@ export interface ZeroExInstantConfig extends ZeroExInstantOverlayProps { } export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => { - validateInstantRenderConfig(config, selector); - if (config.shouldDisablePushToHistory) { + // Coerces BigNumber provided in config to version utilized by 0x packages + const coercedConfig = _.assign({}, config, { + orderSource: _.isArray(config.orderSource) + ? orderCoercionUtil.coerceOrderArrayFieldsToBigNumber(config.orderSource) + : config.orderSource, + }); + + validateInstantRenderConfig(coercedConfig, selector); + + if (coercedConfig.shouldDisablePushToHistory) { if (!isInstantRendered()) { - renderInstant(config, selector); + renderInstant(coercedConfig, selector); } return; } // Before we render, push to history saying that instant is showing for this part of the history. window.history.pushState({ zeroExInstantShowing: true }, '0x Instant'); - let removeInstant = renderInstant(config, selector); + let removeInstant = renderInstant(coercedConfig, selector); // If the integrator defined a popstate handler, save it to __zeroExInstantIntegratorsPopStateHandler // unless we have already done so on a previous render. const anyWindow = window as any; @@ -116,7 +125,7 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z if (newState && newState.zeroExInstantShowing) { // We have returned to a history state that expects instant to be rendered. if (!isInstantRendered()) { - removeInstant = renderInstant(config, selector); + removeInstant = renderInstant(coercedConfig, selector); } } else { // History has changed to a different state. diff --git a/packages/instant/src/util/maybe_big_number.ts b/packages/instant/src/util/maybe_big_number.ts index f48473389d..95fbd86952 100644 --- a/packages/instant/src/util/maybe_big_number.ts +++ b/packages/instant/src/util/maybe_big_number.ts @@ -22,4 +22,15 @@ export const maybeBigNumberUtil = { } return _.isUndefined(val1) && _.isUndefined(val2); }, + // converts a BigNumber or String to the BigNumber used by 0x libraries + toMaybeBigNumber: (value: any): Maybe => { + if (_.isString(value)) { + return maybeBigNumberUtil.stringToMaybeBigNumber(value); + } + // checks for pre v8 bignumber with member variable + if (BigNumber.isBigNumber(value) || value.isBigNumber) { + return new BigNumber(value.toString()); + } + return undefined; + }, }; diff --git a/packages/instant/src/util/order_coercion.ts b/packages/instant/src/util/order_coercion.ts new file mode 100644 index 0000000000..a1b468bafc --- /dev/null +++ b/packages/instant/src/util/order_coercion.ts @@ -0,0 +1,42 @@ +import { BigNumber } from '@0x/utils'; +import * as _ from 'lodash'; + +import { maybeBigNumberUtil } from './maybe_big_number'; + +const coerceBigNumberOrString = (value: any): BigNumber => { + const bn = maybeBigNumberUtil.toMaybeBigNumber(value); + return !!bn ? bn : value; +}; + +// function implies that the signed order already has been validated +export const orderCoercionUtil = { + // coerces order big number values to the BigNumber version utilized by 0x + coerceFieldsToBigNumbers(obj: any, fields: string[]): any { + const result = _.assign({}, obj); + _.each(fields, field => { + _.update(result, field, (value: string) => { + if (_.isUndefined(value)) { + throw new Error(`Could not find field '${field}' while converting fields to BigNumber.`); + } + return coerceBigNumberOrString(value); + }); + }); + return result; + }, + + coerceOrderFieldsToBigNumber: (order: any): any => { + return orderCoercionUtil.coerceFieldsToBigNumbers(order, [ + 'makerFee', + 'takerFee', + 'makerAssetAmount', + 'takerAssetAmount', + 'salt', + 'expirationTimeSeconds', + ]); + }, + coerceOrderArrayFieldsToBigNumber: (orders: any[]): any[] => { + return _.map(orders, (value: any) => { + return orderCoercionUtil.coerceOrderFieldsToBigNumber(value); + }); + }, +}; diff --git a/packages/instant/test/util/maybe_big_number.test.ts b/packages/instant/test/util/maybe_big_number.test.ts new file mode 100644 index 0000000000..508e8aaf06 --- /dev/null +++ b/packages/instant/test/util/maybe_big_number.test.ts @@ -0,0 +1,65 @@ +import { BigNumber } from '@0x/utils'; + +import { maybeBigNumberUtil } from '../../src/util/maybe_big_number'; + +const BIG_NUMBER_1 = new BigNumber('10.1'); +const BIG_NUMBER_2 = new BigNumber('10.1'); +const BIG_NUMBER_3 = new BigNumber('11.1'); + +describe('maybeBigNumberUtil', () => { + describe('stringToMaybeBigNumber', () => { + it('should return undefined if stringValue is NaN', () => { + expect(maybeBigNumberUtil.stringToMaybeBigNumber('NaN')).toEqual(undefined); + }); + it('should return bignumber constructed with stringValue', () => { + const bn = maybeBigNumberUtil.stringToMaybeBigNumber('10.1'); + if (!!bn) { + expect(bn.toString()).toEqual('10.1'); + } + }); + it('should return undefined if stringValue is not valid (i.e not numeric)', () => { + expect(maybeBigNumberUtil.stringToMaybeBigNumber('test')).toEqual(undefined); + }); + }); + + describe('areMaybeBigNumbersEqual', () => { + it('should return true if val1 and val2 are equivalent BigNumber values', () => { + expect(maybeBigNumberUtil.areMaybeBigNumbersEqual(BIG_NUMBER_1, BIG_NUMBER_2)).toEqual(true); + }); + it('should return true if val1 and val2 are both undefined', () => { + expect(maybeBigNumberUtil.areMaybeBigNumbersEqual(undefined, undefined)).toEqual(true); + }); + it('should return false if either one val1 or val2 is undefined', () => { + expect(maybeBigNumberUtil.areMaybeBigNumbersEqual(BIG_NUMBER_1, undefined)).toEqual(false); + }); + it('should return false if val1 and val2 are equivalent values BigNumber', () => { + expect(maybeBigNumberUtil.areMaybeBigNumbersEqual(BIG_NUMBER_1, BIG_NUMBER_3)).toEqual(false); + }); + }); + + // this doesn't test coercing a pre v8.0.0 version of big number to desired version + describe('toMaybeBigNumber', () => { + it('should return BigNumber (>=v8.0.0) constructed with value if type is string', () => { + const bn = maybeBigNumberUtil.toMaybeBigNumber('10.1'); + if (!!bn) { + expect(bn.toString()).toEqual('10.1'); + } + }); + it('should return undefined if value is NaN', () => { + expect(maybeBigNumberUtil.toMaybeBigNumber('NaN')).toEqual(undefined); + }); + it('should return undefined if value as string is not valid (i.e not numeric)', () => { + expect(maybeBigNumberUtil.toMaybeBigNumber('test')).toEqual(undefined); + }); + it('should return undefined if value as string is not valid (i.e not numeric)', () => { + expect(maybeBigNumberUtil.toMaybeBigNumber('test')).toEqual(undefined); + }); + it('should return BigNumber (>=v8.0.0) when passed a value as BigNumber (>=v8.0.0)', () => { + const bn = maybeBigNumberUtil.toMaybeBigNumber(BIG_NUMBER_1); + expect(BigNumber.isBigNumber(bn)).toEqual(true); + }); + it('should return undefined if value is not BigNumber or string', () => { + expect(maybeBigNumberUtil.toMaybeBigNumber(true)).toEqual(undefined); + }); + }); +}); diff --git a/packages/instant/test/util/order_coercion.test.ts b/packages/instant/test/util/order_coercion.test.ts new file mode 100644 index 0000000000..f7a958c9d3 --- /dev/null +++ b/packages/instant/test/util/order_coercion.test.ts @@ -0,0 +1,103 @@ +import { BigNumber } from '@0x/utils'; + +import { orderCoercionUtil } from '../../src/util/order_coercion'; + +const ORDER = { + senderAddress: '0x0000000000000000000000000000000000000000', + makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e', + takerAddress: '0x0000000000000000000000000000000000000000', + makerFee: new BigNumber('0'), + takerFee: new BigNumber('0'), + makerAssetAmount: new BigNumber('200000000000000000000'), + takerAssetAmount: new BigNumber('10000000000000000000'), + makerAssetData: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c', + takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c', + expirationTimeSeconds: new BigNumber('1601535600'), + feeRecipientAddress: '0x0000000000000000000000000000000000000000', + salt: new BigNumber('3101985707338942582579795423923841749956600670712030922928319824580764688653'), + signature: + '0x1bd4d5686fea801fe33c68c4944356085e7e6cb553eb7073160abd815609f714e85fb47f44b7ffd0a2a1321ac40d72d55163869d0a50fdb5a402132150fe33a08403', + exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2', +}; + +const STRING_ORDER = { + senderAddress: '0x0000000000000000000000000000000000000000', + makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e', + takerAddress: '0x0000000000000000000000000000000000000000', + makerFee: '0', + takerFee: '0', + makerAssetAmount: '300000000000000000000', + takerAssetAmount: '31000000000000000000', + makerAssetData: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa', + takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c', + expirationTimeSeconds: '2524636800', + feeRecipientAddress: '0x0000000000000000000000000000000000000000', + salt: '64592004666704945574675477805199411288137454783320798602050822322450089238268', + signature: + '0x1c13cacddca8d7d8248e91f412377e68f8f1f9891a59a6c1b2eea9f7b33558c30c4fb86a448e08ab7def40a28fb3a3062dcb33bb3c45302447fce5c4288b7c7f5b03', + exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2', +}; + +const ORDERS = [ORDER, STRING_ORDER]; + +describe('orderCoercionUtil', () => { + describe('coerceFieldsToBigNumbers', () => { + it('should coerce all fields specified to a big number', () => { + const coercedOrder = orderCoercionUtil.coerceFieldsToBigNumbers(STRING_ORDER, ['makerFee', 'takerFee']); + expect(coercedOrder.makerFee.toString()).toEqual('0'); + expect(coercedOrder.takerFee.toString()).toEqual('0'); + }); + it("should throw if a field can't be found", () => { + expect(() => { + orderCoercionUtil.coerceFieldsToBigNumbers(ORDER, ['salty']); + }).toThrow("Could not find field 'salty' while converting fields to BigNumber."); + }); + it('should not change value if not numeric string or big number', () => { + const obj = { number: 'number' }; + const coercedObj = orderCoercionUtil.coerceFieldsToBigNumbers(obj, ['number']); + expect(coercedObj).toEqual({ + number: 'number', + }); + }); + }); + // Note: this doesn't test coercing pre v8.0.0 BigNumber versions to specified one used by 0x + describe('coerceOrderFieldsToBigNumber', () => { + it('should convert string values in order to big number', () => { + const coercedOrder = orderCoercionUtil.coerceOrderFieldsToBigNumber(STRING_ORDER); + expect(coercedOrder.makerFee.toString()).toEqual(STRING_ORDER.makerFee); + expect(coercedOrder.takerFee.toString()).toEqual(STRING_ORDER.takerFee); + expect(coercedOrder.takerAssetAmount.toString()).toEqual(STRING_ORDER.takerAssetAmount); + expect(coercedOrder.makerAssetAmount.toString()).toEqual(STRING_ORDER.makerAssetAmount); + expect(coercedOrder.salt.toString()).toEqual(STRING_ORDER.salt); + expect(coercedOrder.expirationTimeSeconds.toString()).toEqual(STRING_ORDER.expirationTimeSeconds); + }); + it('should convert big number values in order to big number', () => { + const coercedOrder = orderCoercionUtil.coerceOrderFieldsToBigNumber(ORDER); + expect(coercedOrder.makerFee).toEqual(ORDER.makerFee); + expect(coercedOrder.takerFee).toEqual(ORDER.takerFee); + expect(coercedOrder.takerAssetAmount).toEqual(ORDER.takerAssetAmount); + expect(coercedOrder.makerAssetAmount).toEqual(ORDER.makerAssetAmount); + expect(coercedOrder.salt).toEqual(ORDER.salt); + expect(coercedOrder.expirationTimeSeconds).toEqual(ORDER.expirationTimeSeconds); + }); + }); + // Note: this doesn't test coercing pre v8.0.0 BigNumber versions to specified one used by 0x + describe('coerceOrderArrayFieldsToBigNumber', () => { + it('should convert string values and big numbers in orders to big number', () => { + const coercedOrders = orderCoercionUtil.coerceOrderArrayFieldsToBigNumber(ORDERS); + expect(coercedOrders[0].makerFee).toEqual(ORDER.makerFee); + expect(coercedOrders[0].takerFee).toEqual(ORDER.takerFee); + expect(coercedOrders[0].takerAssetAmount).toEqual(ORDER.takerAssetAmount); + expect(coercedOrders[0].makerAssetAmount).toEqual(ORDER.makerAssetAmount); + expect(coercedOrders[0].salt).toEqual(ORDER.salt); + expect(coercedOrders[0].expirationTimeSeconds).toEqual(ORDER.expirationTimeSeconds); + + expect(coercedOrders[1].makerFee.toString()).toEqual(STRING_ORDER.makerFee); + expect(coercedOrders[1].takerFee.toString()).toEqual(STRING_ORDER.takerFee); + expect(coercedOrders[1].takerAssetAmount.toString()).toEqual(STRING_ORDER.takerAssetAmount); + expect(coercedOrders[1].makerAssetAmount.toString()).toEqual(STRING_ORDER.makerAssetAmount); + expect(coercedOrders[1].salt.toString()).toEqual(STRING_ORDER.salt); + expect(coercedOrders[1].expirationTimeSeconds.toString()).toEqual(STRING_ORDER.expirationTimeSeconds); + }); + }); +}); diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index a6ae0160f4..2be8ed069e 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.2", "changes": [ diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 91426a6870..682a9c5fb5 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 +## v3.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 0c101aa285..189b06e749 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0x/json-schemas", - "version": "3.0.2", + "version": "3.0.3", "engines": { "node": ">=6.12" }, @@ -46,7 +46,7 @@ }, "devDependencies": { "@0x/tslint-config": "^3.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "@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 3afe8eb8c8..83c3821e0f 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0x/metacoin", - "version": "0.0.39", + "version": "0.0.40", "engines": { "node": ">=6.12" }, @@ -30,18 +30,18 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0x/abi-gen": "^2.0.2", + "@0x/abi-gen": "^2.0.3", "@0x/abi-gen-templates": "^2.0.0", - "@0x/base-contract": "^4.0.2", - "@0x/sol-coverage": "^2.0.2", - "@0x/sol-profiler": "^2.0.3", - "@0x/sol-trace": "^2.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/base-contract": "^4.0.3", + "@0x/sol-coverage": "^2.0.3", + "@0x/sol-profiler": "^2.0.4", + "@0x/sol-trace": "^2.0.4", + "@0x/subproviders": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/mocha": "^2.2.42", "copyfiles": "^2.0.0", "ethereum-types": "^2.0.0", @@ -50,8 +50,8 @@ "run-s": "^0.0.0" }, "devDependencies": { - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^3.0.0", diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 9d7c22b7c8..af1064d819 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.3", "changes": [ diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index b39732ef4a..7183eba692 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 91476d322d..727db9096b 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0x/migrations", - "version": "3.0.3", + "version": "3.0.4", "engines": { "node": ">=6.12" }, @@ -35,7 +35,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0x/dev-utils": "^2.0.2", + "@0x/dev-utils": "^2.1.0", "@0x/tslint-config": "^3.0.0", "@0x/types": "^2.0.2", "@types/yargs": "^11.0.0", @@ -48,16 +48,16 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", - "@0x/base-contract": "^4.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", + "@0x/base-contract": "^4.0.3", "@0x/contract-addresses": "^2.2.1", "@0x/contract-artifacts": "^1.3.0", - "@0x/order-utils": "^6.0.1", - "@0x/sol-compiler": "^3.0.2", - "@0x/subproviders": "^3.0.2", + "@0x/order-utils": "^6.1.0", + "@0x/sol-compiler": "^3.0.3", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^2.0.0", "ethers": "~4.0.4", diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 3e9a972c22..ee7f5968be 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0x/monorepo-scripts", - "version": "1.0.23", + "version": "1.0.24", "engines": { "node": ">=6.12" }, @@ -48,7 +48,7 @@ }, "dependencies": { "@0x/types": "^2.0.2", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "@lerna/batch-packages": "^3.0.0-beta.18", "@types/depcheck": "^0.6.0", "async-child-process": "^1.1.1", diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 0028ea0c76..26636d231f 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "6.1.0", + "changes": [ + { + "note": "Updated implementation of `generatePseudoRandomSalt` to use generator from @0x/utils", + "pr": 1569 + } + ], + "timestamp": 1549733923 + }, { "version": "6.0.1", "changes": [ diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 06e6a28391..a661c0e1ff 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 +## v6.1.0 - _February 9, 2019_ + + * Updated implementation of `generatePseudoRandomSalt` to use generator from @0x/utils (#1569) + ## v6.0.1 - _February 7, 2019_ * Dependencies updated diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index e2d0bcc980..df0e7a38f4 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/order-utils", - "version": "6.0.1", + "version": "6.1.0", "engines": { "node": ">=6.12" }, @@ -35,7 +35,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0x/dev-utils": "^2.0.2", + "@0x/dev-utils": "^2.1.0", "@0x/tslint-config": "^3.0.0", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -53,16 +53,16 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", - "@0x/assert": "^2.0.2", - "@0x/base-contract": "^4.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", + "@0x/assert": "^2.0.3", + "@0x/base-contract": "^4.0.3", "@0x/contract-addresses": "^2.2.1", "@0x/contract-artifacts": "^1.3.0", - "@0x/json-schemas": "^3.0.2", + "@0x/json-schemas": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/node": "*", "bn.js": "^4.11.8", "ethereum-types": "^2.0.0", diff --git a/packages/order-utils/src/salt.ts b/packages/order-utils/src/salt.ts index 95df66c995..a7cc4aea05 100644 --- a/packages/order-utils/src/salt.ts +++ b/packages/order-utils/src/salt.ts @@ -1,6 +1,4 @@ -import { BigNumber } from '@0x/utils'; - -const MAX_DIGITS_IN_UNSIGNED_256_INT = 78; +import { BigNumber, generatePseudoRandom256BitNumber } from '@0x/utils'; /** * Generates a pseudo-random 256-bit salt. @@ -9,10 +7,6 @@ const MAX_DIGITS_IN_UNSIGNED_256_INT = 78; * @return A pseudo-random 256-bit number that can be used as a salt. */ export function generatePseudoRandomSalt(): BigNumber { - // BigNumber.random returns a pseudo-random number between 0 & 1 with a passed in number of decimal places. - // Source: https://mikemcl.github.io/bignumber.js/#random - const randomNumber = BigNumber.random(MAX_DIGITS_IN_UNSIGNED_256_INT); - const factor = new BigNumber(10).pow(MAX_DIGITS_IN_UNSIGNED_256_INT - 1); - const salt = randomNumber.times(factor).integerValue(); + const salt = generatePseudoRandom256BitNumber(); return salt; } diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 69bcc8d03e..31faf46385 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.3", "changes": [ diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index 7a3ede421d..313ca96c7f 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 209c9bdc5f..368bb879db 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0x/order-watcher", - "version": "3.0.3", + "version": "3.0.4", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -38,9 +38,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0x/dev-utils": "^2.0.2", - "@0x/migrations": "^3.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/dev-utils": "^2.1.0", + "@0x/migrations": "^3.0.4", + "@0x/subproviders": "^3.0.3", "@0x/tslint-config": "^3.0.0", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", @@ -63,19 +63,19 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen-wrappers": "^3.0.2", - "@0x/assert": "^2.0.2", - "@0x/base-contract": "^4.0.2", + "@0x/abi-gen-wrappers": "^3.0.3", + "@0x/assert": "^2.0.3", + "@0x/base-contract": "^4.0.3", "@0x/contract-addresses": "^2.2.1", "@0x/contract-artifacts": "^1.3.0", - "@0x/contract-wrappers": "^7.0.2", - "@0x/fill-scenarios": "^2.0.3", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", + "@0x/contract-wrappers": "^7.1.0", + "@0x/fill-scenarios": "^2.0.4", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "bintrees": "^1.0.2", "ethereum-types": "^2.0.0", "ethereumjs-blockstream": "6.0.0", diff --git a/packages/pipeline/migrations/1549479172800-AddTxHashToExchangeEventPrimaryKey.ts b/packages/pipeline/migrations/1549479172800-AddTxHashToExchangeEventPrimaryKey.ts new file mode 100644 index 0000000000..d6ea6c47b7 --- /dev/null +++ b/packages/pipeline/migrations/1549479172800-AddTxHashToExchangeEventPrimaryKey.ts @@ -0,0 +1,35 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +const tableNames = ['exchange_cancel_events', 'exchange_cancel_up_to_events', 'exchange_fill_events']; + +const oldPrimaryColumns = ['contract_address', 'log_index', 'block_number']; + +const newPrimaryColumns = ['transaction_hash']; + +async function updatePrimaryKeysAsync(queryRunner: QueryRunner, columnNames: string[]): Promise { + for (const tableName of tableNames) { + const table = await queryRunner.getTable(`raw.${tableName}`); + if (table === undefined) { + throw new Error(`Couldn't get table 'raw.${tableName}'`); + } + const columns = []; + for (const columnName of columnNames) { + const column = table.findColumnByName(columnName); + if (column === undefined) { + throw new Error(`Couldn't get column '${columnName}' from table 'raw.${tableName}'`); + } + columns.push(column); + } + await queryRunner.updatePrimaryKeys(table, columns); + } +} + +export class AddTxHashToExchangeEventPrimaryKey1549479172800 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns.concat(newPrimaryColumns)); + } + + public async down(queryRunner: QueryRunner): Promise { + await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns); + } +} diff --git a/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts b/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts new file mode 100644 index 0000000000..874713e670 --- /dev/null +++ b/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts @@ -0,0 +1,31 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +const oldPrimaryColumns = ['token_address', 'log_index', 'block_number']; + +const newPrimaryColumns = ['transaction_hash']; + +async function updatePrimaryKeysAsync(queryRunner: QueryRunner, columnNames: string[]): Promise { + const table = await queryRunner.getTable(`raw.erc20_approval_events`); + if (table === undefined) { + throw new Error(`Couldn't get table 'raw.erc20_approval_events'`); + } + const columns = []; + for (const columnName of columnNames) { + const column = table.findColumnByName(columnName); + if (column === undefined) { + throw new Error(`Couldn't get column '${columnName}' from table 'raw.erc20_approval_events'`); + } + columns.push(column); + } + await queryRunner.updatePrimaryKeys(table, columns); +} + +export class AddTxHashToERC20ApprovalEventPrimaryKey1549499426238 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns.concat(newPrimaryColumns)); + } + + public async down(queryRunner: QueryRunner): Promise { + await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns); + } +} diff --git a/packages/pipeline/package.json b/packages/pipeline/package.json index b2ad39a5f2..56d5ef10d9 100644 --- a/packages/pipeline/package.json +++ b/packages/pipeline/package.json @@ -1,6 +1,6 @@ { "name": "@0x/pipeline", - "version": "1.0.9", + "version": "1.0.10", "private": true, "description": "Data pipeline for offline analysis", "scripts": { @@ -39,16 +39,16 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/connect": "^4.0.3", + "@0x/connect": "^4.0.4", "@0x/contract-addresses": "^2.2.1", "@0x/contract-artifacts": "^1.3.0", - "@0x/contract-wrappers": "^7.0.2", - "@0x/dev-utils": "^2.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/subproviders": "^3.0.2", + "@0x/contract-wrappers": "^7.1.0", + "@0x/dev-utils": "^2.1.0", + "@0x/order-utils": "^6.1.0", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/dockerode": "^2.5.9", "@types/p-limit": "^2.0.0", "async-parallel": "^1.2.3", diff --git a/packages/pipeline/src/entities/erc20_approval_event.ts b/packages/pipeline/src/entities/erc20_approval_event.ts index 69cdfcb0b6..ee5e621d23 100644 --- a/packages/pipeline/src/entities/erc20_approval_event.ts +++ b/packages/pipeline/src/entities/erc20_approval_event.ts @@ -15,7 +15,7 @@ export class ERC20ApprovalEvent { @Column({ name: 'raw_data' }) public rawData!: string; - @Column({ name: 'transaction_hash' }) + @PrimaryColumn({ name: 'transaction_hash' }) public transactionHash!: string; @Column({ name: 'owner_address' }) public ownerAddress!: string; diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts index 38f99c9033..a861949201 100644 --- a/packages/pipeline/src/entities/exchange_cancel_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_event.ts @@ -15,7 +15,7 @@ export class ExchangeCancelEvent { @Column({ name: 'raw_data' }) public rawData!: string; - @Column({ name: 'transaction_hash' }) + @PrimaryColumn({ name: 'transaction_hash' }) public transactionHash!: string; @Column({ name: 'maker_address' }) public makerAddress!: string; diff --git a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts index 27580305e9..f24aea23ad 100644 --- a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts +++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts @@ -15,7 +15,7 @@ export class ExchangeCancelUpToEvent { @Column({ name: 'raw_data' }) public rawData!: string; - @Column({ name: 'transaction_hash' }) + @PrimaryColumn({ name: 'transaction_hash' }) public transactionHash!: string; @Column({ name: 'maker_address' }) public makerAddress!: string; diff --git a/packages/pipeline/src/entities/exchange_fill_event.ts b/packages/pipeline/src/entities/exchange_fill_event.ts index 9b7727615a..52111711eb 100644 --- a/packages/pipeline/src/entities/exchange_fill_event.ts +++ b/packages/pipeline/src/entities/exchange_fill_event.ts @@ -16,7 +16,7 @@ export class ExchangeFillEvent { @Column({ name: 'raw_data' }) public rawData!: string; - @Column({ name: 'transaction_hash' }) + @PrimaryColumn({ name: 'transaction_hash' }) public transactionHash!: string; @Column({ name: 'maker_address' }) public makerAddress!: string; diff --git a/packages/pipeline/src/scripts/pull_exchange_events.ts b/packages/pipeline/src/scripts/pull_exchange_events.ts index f8ce4038de..c2c56da6b0 100644 --- a/packages/pipeline/src/scripts/pull_exchange_events.ts +++ b/packages/pipeline/src/scripts/pull_exchange_events.ts @@ -112,15 +112,20 @@ async function saveIndividuallyWithFallbackAsync( events: T[], ): Promise { // Note(albrow): This is a temporary hack because `save` is not working as - // documented and is causing a foreign key constraint violation. Hopefully + // documented and is causing a primary key constraint violation. Hopefully // can remove later because this "poor man's upsert" implementation operates // on one event at a time and is therefore much slower. for (const event of events) { try { // First try an insert. await repository.insert(event); - } catch { - // If it fails, assume it was a foreign key constraint error and try + } catch (err) { + if (err.message.includes('duplicate key value violates unique constraint')) { + logUtils.log("Ignore the preceeding INSERT failure; it's not unexpected"); + } else { + throw err; + } + // If it fails, assume it was a primary key constraint error and try // doing an update instead. // Note(albrow): Unfortunately the `as any` hack here seems // required. I can't figure out how to convince the type-checker @@ -132,6 +137,7 @@ async function saveIndividuallyWithFallbackAsync( contractAddress: event.contractAddress, blockNumber: event.blockNumber, logIndex: event.logIndex, + transactionHash: event.transactionHash, } as any, event as any, ); diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 82e1622725..a14816bb8d 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index fa8f387c2c..ef3b50a9b9 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 +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 5a91220e01..e3da83909c 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0x/react-docs", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -24,7 +24,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0x/dev-utils": "^2.0.2", + "@0x/dev-utils": "^2.1.0", "@0x/tslint-config": "^3.0.0", "@types/compare-versions": "^3.0.0", "@types/styled-components": "4.0.0", @@ -34,9 +34,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/react-shared": "^2.0.3", + "@0x/react-shared": "^2.0.4", "@0x/types": "^2.0.2", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "@types/lodash": "4.14.104", "@types/material-ui": "^0.20.0", "@types/node": "*", diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 9a7284c2a0..97a9fc0d28 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index e1de4a7658..4b987be9f8 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 +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index d93eb14367..141f3c1956 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0x/react-shared", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -25,7 +25,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0x/dev-utils": "^2.0.2", + "@0x/dev-utils": "^2.1.0", "@0x/tslint-config": "^3.0.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 ed9c45245f..66c533696c 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.2", "changes": [ diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 0165090286..f054773eff 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 +## v3.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.2 - _February 7, 2019_ * Fix a bug when smart recompilation wasn't working because of remappings (#1575) diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 3344c0b381..6629c02e91 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-compiler", - "version": "3.0.2", + "version": "3.0.3", "engines": { "node": ">=6.12" }, @@ -42,7 +42,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0x/dev-utils": "^2.0.2", + "@0x/dev-utils": "^2.1.0", "@0x/tslint-config": "^3.0.0", "@types/chokidar": "^1.7.5", "@types/mkdirp": "^0.5.2", @@ -67,13 +67,13 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/json-schemas": "^3.0.2", + "@0x/assert": "^2.0.3", + "@0x/json-schemas": "^3.0.3", "@0x/sol-resolver": "^2.0.2", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/yargs": "^11.0.0", "chalk": "^2.3.0", "chokidar": "^2.0.4", diff --git a/packages/sol-coverage/CHANGELOG.json b/packages/sol-coverage/CHANGELOG.json index dc5ae1a53a..60ea58be75 100644 --- a/packages/sol-coverage/CHANGELOG.json +++ b/packages/sol-coverage/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.2", "changes": [ diff --git a/packages/sol-coverage/CHANGELOG.md b/packages/sol-coverage/CHANGELOG.md index 1af9b9f26e..90d45a88b1 100644 --- a/packages/sol-coverage/CHANGELOG.md +++ b/packages/sol-coverage/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sol-coverage/package.json b/packages/sol-coverage/package.json index 6724a03dfc..8bc91f63c2 100644 --- a/packages/sol-coverage/package.json +++ b/packages/sol-coverage/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-coverage", - "version": "2.0.2", + "version": "2.0.3", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-coverage/README.md", "dependencies": { - "@0x/sol-tracing-utils": "^6.0.2", - "@0x/subproviders": "^3.0.2", + "@0x/sol-tracing-utils": "^6.0.3", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json index d9d0ddfa28..790977248f 100644 --- a/packages/sol-doc/CHANGELOG.json +++ b/packages/sol-doc/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.2", "changes": [ diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md index 06ea1d7b42..da53808c14 100644 --- a/packages/sol-doc/CHANGELOG.md +++ b/packages/sol-doc/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index c413e248f3..0a1d21685c 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-doc", - "version": "2.0.2", + "version": "2.0.3", "description": "Solidity documentation generator", "main": "lib/src/index.js", "types": "lib/src/index.d.js", @@ -25,9 +25,9 @@ "author": "F. Eugene Aumson", "license": "Apache-2.0", "dependencies": { - "@0x/sol-compiler": "^3.0.2", + "@0x/sol-compiler": "^3.0.3", "@0x/types": "^2.0.2", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "ethereum-types": "^2.0.0", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.11", diff --git a/packages/sol-profiler/CHANGELOG.json b/packages/sol-profiler/CHANGELOG.json index 89f3f71719..f9306fc663 100644 --- a/packages/sol-profiler/CHANGELOG.json +++ b/packages/sol-profiler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/sol-profiler/CHANGELOG.md b/packages/sol-profiler/CHANGELOG.md index bf9e59e54f..49dcdb4f38 100644 --- a/packages/sol-profiler/CHANGELOG.md +++ b/packages/sol-profiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sol-profiler/package.json b/packages/sol-profiler/package.json index cce49e22ea..c28d3207a9 100644 --- a/packages/sol-profiler/package.json +++ b/packages/sol-profiler/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-profiler", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-profiler/README.md", "dependencies": { - "@0x/sol-tracing-utils": "^6.0.2", - "@0x/subproviders": "^3.0.2", + "@0x/sol-tracing-utils": "^6.0.3", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", "ethereum-types": "^2.0.0", "lodash": "^4.17.11" diff --git a/packages/sol-trace/CHANGELOG.json b/packages/sol-trace/CHANGELOG.json index c786a56a3b..c2e70a2cef 100644 --- a/packages/sol-trace/CHANGELOG.json +++ b/packages/sol-trace/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/sol-trace/CHANGELOG.md b/packages/sol-trace/CHANGELOG.md index bcb75c423a..b413385847 100644 --- a/packages/sol-trace/CHANGELOG.md +++ b/packages/sol-trace/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sol-trace/package.json b/packages/sol-trace/package.json index b65a8b002d..6dc3a230ed 100644 --- a/packages/sol-trace/package.json +++ b/packages/sol-trace/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-trace", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -29,8 +29,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-trace/README.md", "dependencies": { - "@0x/sol-tracing-utils": "^6.0.2", - "@0x/subproviders": "^3.0.2", + "@0x/sol-tracing-utils": "^6.0.3", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", "chalk": "^2.3.0", "ethereum-types": "^2.0.0", diff --git a/packages/sol-tracing-utils/CHANGELOG.json b/packages/sol-tracing-utils/CHANGELOG.json index 911cf6c1ff..cbc1b41d5c 100644 --- a/packages/sol-tracing-utils/CHANGELOG.json +++ b/packages/sol-tracing-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "6.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "6.0.2", "changes": [ diff --git a/packages/sol-tracing-utils/CHANGELOG.md b/packages/sol-tracing-utils/CHANGELOG.md index 6f9fa5615a..a9eadc1918 100644 --- a/packages/sol-tracing-utils/CHANGELOG.md +++ b/packages/sol-tracing-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v6.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v6.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sol-tracing-utils/package.json b/packages/sol-tracing-utils/package.json index 8bccb237d7..4d22107f32 100644 --- a/packages/sol-tracing-utils/package.json +++ b/packages/sol-tracing-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sol-tracing-utils", - "version": "6.0.2", + "version": "6.0.3", "engines": { "node": ">=6.12" }, @@ -42,13 +42,13 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-tracing-utils/README.md", "dependencies": { - "@0x/dev-utils": "^2.0.2", - "@0x/sol-compiler": "^3.0.2", + "@0x/dev-utils": "^2.1.0", + "@0x/sol-compiler": "^3.0.3", "@0x/sol-resolver": "^2.0.2", - "@0x/subproviders": "^3.0.2", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@types/solidity-parser-antlr": "^0.2.0", "chalk": "^2.3.0", "ethereum-types": "^2.0.0", diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json index 05ea492439..417e2a5a24 100644 --- a/packages/sra-spec/CHANGELOG.json +++ b/packages/sra-spec/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "2.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.2", "changes": [ diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md index ce7a097081..85fe23b490 100644 --- a/packages/sra-spec/CHANGELOG.md +++ b/packages/sra-spec/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v2.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 28cf159380..b685432d4c 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -1,6 +1,6 @@ { "name": "@0x/sra-spec", - "version": "2.0.2", + "version": "2.0.3", "engines": { "node": ">=6.12" }, @@ -35,7 +35,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md", "dependencies": { - "@0x/json-schemas": "^3.0.2", + "@0x/json-schemas": "^3.0.3", "@loopback/openapi-v3-types": "^0.8.2" }, "devDependencies": { diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 3d5bade1f4..1ca3ef9134 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1549733923, + "version": "3.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.2", "changes": [ diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index b3dfa757ad..60dbaeafc7 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.3 - _February 9, 2019_ + + * Dependencies updated + ## v3.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index a783bb5a22..66a09000c1 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0x/subproviders", - "version": "3.0.2", + "version": "3.0.3", "engines": { "node": ">=6.12" }, @@ -29,11 +29,11 @@ } }, "dependencies": { - "@0x/assert": "^2.0.2", + "@0x/assert": "^2.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "4.24.0", "@types/eth-lightwallet": "^3.0.0", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index c529d4975a..31bfc6e1d6 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0x/testnet-faucets", - "version": "1.0.68", + "version": "1.0.69", "engines": { "node": ">=6.12" }, @@ -18,11 +18,11 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^4.0.3", - "@0x/subproviders": "^3.0.2", + "0x.js": "^5.0.0", + "@0x/subproviders": "^3.0.3", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "body-parser": "^1.17.1", "ethereum-types": "^2.0.0", "ethereumjs-tx": "^1.3.5", diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index 007591d181..2ff0d81038 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,23 @@ [ + { + "version": "4.1.0", + "changes": [ + { + "note": "Added method decoding to AbiDecoder", + "pr": 1569 + } + ], + "timestamp": 1549733923 + }, + { + "version": "4.0.4", + "changes": [ + { + "note": "Cleaner signature parsing", + "pr": 1592 + } + ] + }, { "version": "4.0.3", "changes": [ diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 4772bbb865..772b6e5821 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v4.1.0 - _February 9, 2019_ + + * Added method decoding to AbiDecoder (#1569) + +## v4.0.4 - _Invalid date_ + + * Cleaner signature parsing (#1592) + ## v4.0.3 - _February 7, 2019_ * Dependencies updated diff --git a/packages/utils/package.json b/packages/utils/package.json index 86fecbc7c4..48b98173d2 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/utils", - "version": "4.0.3", + "version": "4.1.0", "engines": { "node": ">=6.12" }, @@ -14,7 +14,7 @@ "lint": "tslint --format stylish --project .", "test": "yarn run_mocha", "test:circleci": "yarn test:coverage", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*_test.js' 'lib/test/*_test.js' --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info" }, diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 28b6418d88..b764e45b87 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -6,28 +6,49 @@ import { EventParameter, LogEntry, LogWithDecodedArgs, + MethodAbi, RawLog, SolidityTypes, } from 'ethereum-types'; import * as ethers from 'ethers'; import * as _ from 'lodash'; +import { AbiEncoder } from '.'; import { addressUtils } from './address_utils'; import { BigNumber } from './configured_bignumber'; +import { DecodedCalldata, SelectorToFunctionInfo } from './types'; /** * AbiDecoder allows you to decode event logs given a set of supplied contract ABI's. It takes the contract's event * signature from the ABI and attempts to decode the logs using it. */ export class AbiDecoder { - private readonly _methodIds: { [signatureHash: string]: { [numIndexedArgs: number]: EventAbi } } = {}; + private readonly _eventIds: { [signatureHash: string]: { [numIndexedArgs: number]: EventAbi } } = {}; + private readonly _selectorToFunctionInfo: SelectorToFunctionInfo = {}; + /** + * Retrieves the function selector from calldata. + * @param calldata hex-encoded calldata. + * @return hex-encoded function selector. + */ + private static _getFunctionSelector(calldata: string): string { + const functionSelectorLength = 10; + if (!calldata.startsWith('0x') || calldata.length < functionSelectorLength) { + throw new Error( + `Malformed calldata. Must include a hex prefix '0x' and 4-byte function selector. Got '${calldata}'`, + ); + } + const functionSelector = calldata.substr(0, functionSelectorLength); + return functionSelector; + } /** * Instantiate an AbiDecoder * @param abiArrays An array of contract ABI's * @return AbiDecoder instance */ constructor(abiArrays: AbiDefinition[][]) { - _.forEach(abiArrays, this.addABI.bind(this)); + _.each(abiArrays, abi => { + this.addABI(abi); + }); } /** * Attempt to decode a log given the ABI's the AbiDecoder knows about. @@ -35,12 +56,12 @@ export class AbiDecoder { * @return The decoded log if the requisite ABI was available. Otherwise the log unaltered. */ public tryToDecodeLogOrNoop(log: LogEntry): LogWithDecodedArgs | RawLog { - const methodId = log.topics[0]; + const eventId = log.topics[0]; const numIndexedArgs = log.topics.length - 1; - if (_.isUndefined(this._methodIds[methodId]) || _.isUndefined(this._methodIds[methodId][numIndexedArgs])) { + if (_.isUndefined(this._eventIds[eventId]) || _.isUndefined(this._eventIds[eventId][numIndexedArgs])) { return log; } - const event = this._methodIds[methodId][numIndexedArgs]; + const event = this._eventIds[eventId][numIndexedArgs]; const ethersInterface = new ethers.utils.Interface([event]); const decodedParams: DecodedLogArgs = {}; let topicsIndex = 1; @@ -89,25 +110,94 @@ export class AbiDecoder { } } /** - * Add additional ABI definitions to the AbiDecoder - * @param abiArray An array of ABI definitions to add to the AbiDecoder + * Decodes calldata for a known ABI. + * @param calldata hex-encoded calldata. + * @param contractName used to disambiguate similar ABI's (optional). + * @return Decoded calldata. Includes: function name and signature, along with the decoded arguments. */ - public addABI(abiArray: AbiDefinition[]): void { + public decodeCalldataOrThrow(calldata: string, contractName?: string): DecodedCalldata { + const functionSelector = AbiDecoder._getFunctionSelector(calldata); + const candidateFunctionInfos = this._selectorToFunctionInfo[functionSelector]; + if (_.isUndefined(candidateFunctionInfos)) { + throw new Error(`No functions registered for selector '${functionSelector}'`); + } + const functionInfo = _.find(candidateFunctionInfos, candidateFunctionInfo => { + return ( + _.isUndefined(contractName) || _.toLower(contractName) === _.toLower(candidateFunctionInfo.contractName) + ); + }); + if (_.isUndefined(functionInfo)) { + throw new Error( + `No function registered with selector ${functionSelector} and contract name ${contractName}.`, + ); + } else if (_.isUndefined(functionInfo.abiEncoder)) { + throw new Error( + `Function ABI Encoder is not defined, for function registered with selector ${functionSelector} and contract name ${contractName}.`, + ); + } + const functionName = functionInfo.abiEncoder.getDataItem().name; + const functionSignature = functionInfo.abiEncoder.getSignatureType(); + const functionArguments = functionInfo.abiEncoder.decode(calldata); + const decodedCalldata = { + functionName, + functionSignature, + functionArguments, + }; + return decodedCalldata; + } + /** + * Adds a set of ABI definitions, after which calldata and logs targeting these ABI's can be decoded. + * Additional properties can be included to disambiguate similar ABI's. For example, if two functions + * have the same signature but different parameter names, then their ABI definitions can be disambiguated + * by specifying a contract name. + * @param abiDefinitions ABI definitions for a given contract. + * @param contractName Name of contract that encapsulates the ABI definitions (optional). + * This can be used when decoding calldata to disambiguate methods with + * the same signature but different parameter names. + */ + public addABI(abiArray: AbiDefinition[], contractName?: string): void { if (_.isUndefined(abiArray)) { return; } const ethersInterface = new ethers.utils.Interface(abiArray); _.map(abiArray, (abi: AbiDefinition) => { - if (abi.type === AbiType.Event) { - // tslint:disable-next-line:no-unnecessary-type-assertion - const eventAbi = abi as EventAbi; - const topic = ethersInterface.events[eventAbi.name].topic; - const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); - this._methodIds[topic] = { - ...this._methodIds[topic], - [numIndexedArgs]: eventAbi, - }; + switch (abi.type) { + case AbiType.Event: + // tslint:disable-next-line:no-unnecessary-type-assertion + this._addEventABI(abi as EventAbi, ethersInterface); + break; + + case AbiType.Function: + // tslint:disable-next-line:no-unnecessary-type-assertion + this._addMethodABI(abi as MethodAbi, contractName); + break; + + default: + // ignore other types + break; } }); } + private _addEventABI(eventAbi: EventAbi, ethersInterface: ethers.utils.Interface): void { + const topic = ethersInterface.events[eventAbi.name].topic; + const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); + this._eventIds[topic] = { + ...this._eventIds[topic], + [numIndexedArgs]: eventAbi, + }; + } + private _addMethodABI(methodAbi: MethodAbi, contractName?: string): void { + const abiEncoder = new AbiEncoder.Method(methodAbi); + const functionSelector = abiEncoder.getSelector(); + if (!(functionSelector in this._selectorToFunctionInfo)) { + this._selectorToFunctionInfo[functionSelector] = []; + } + // Recored a copy of this ABI for each deployment + const functionSignature = abiEncoder.getSignature(); + this._selectorToFunctionInfo[functionSelector].push({ + functionSignature, + abiEncoder, + contractName, + }); + } } diff --git a/packages/utils/src/abi_encoder/evm_data_type_factory.ts b/packages/utils/src/abi_encoder/evm_data_type_factory.ts index 2686491487..8e477f8569 100644 --- a/packages/utils/src/abi_encoder/evm_data_type_factory.ts +++ b/packages/utils/src/abi_encoder/evm_data_type_factory.ts @@ -2,7 +2,7 @@ import { DataItem, MethodAbi } from 'ethereum-types'; import * as _ from 'lodash'; -import { generateDataItemsFromSignature } from './utils/signature_parser'; +import { generateDataItemFromSignature } from './utils/signature_parser'; import { DataType } from './abstract_data_types/data_type'; import { DataTypeFactory } from './abstract_data_types/interfaces'; @@ -134,32 +134,87 @@ export class EvmDataTypeFactory implements DataTypeFactory { /** * Convenience function for creating a DataType from different inputs. - * @param input A single or set of DataItem or a DataType signature. - * A signature in the form of '' is interpreted as a `DataItem` - * For example, 'string' is interpreted as {type: 'string'} - * A signature in the form '(, , ..., )' is interpreted as `DataItem[]` - * For eaxmple, '(string, uint256)' is interpreted as [{type: 'string'}, {type: 'uint256'}] + * @param input A single or set of DataItem or a signature for an EVM data type. * @return DataType corresponding to input. */ export function create(input: DataItem | DataItem[] | string): DataType { - // Handle different types of input - const isSignature = typeof input === 'string'; - const isTupleSignature = isSignature && (input as string).startsWith('('); - const shouldParseAsTuple = isTupleSignature || _.isArray(input); - // Create input `dataItem` + const dataItem = consolidateDataItemsIntoSingle(input); + const dataType = EvmDataTypeFactory.getInstance().create(dataItem); + return dataType; +} + +/** + * Convenience function to aggregate a single input or a set of inputs into a single DataItem. + * An array of data items is grouped into a single tuple. + * @param input A single data item; a set of data items; a signature. + * @return A single data item corresponding to input. + */ +function consolidateDataItemsIntoSingle(input: DataItem | DataItem[] | string): DataItem { let dataItem: DataItem; - if (shouldParseAsTuple) { - const dataItems = isSignature ? generateDataItemsFromSignature(input as string) : (input as DataItem[]); + if (_.isArray(input)) { + const dataItems = input as DataItem[]; dataItem = { name: '', type: 'tuple', components: dataItems, }; } else { - dataItem = isSignature ? generateDataItemsFromSignature(input as string)[0] : (input as DataItem); + dataItem = _.isString(input) ? generateDataItemFromSignature(input) : (input as DataItem); } - // Create data type - const dataType = EvmDataTypeFactory.getInstance().create(dataItem); + return dataItem; +} + +/** + * Convenience function for creating a Method encoder from different inputs. + * @param methodName name of method. + * @param input A single data item; a set of data items; a signature; or an array of signatures (optional). + * @param output A single data item; a set of data items; a signature; or an array of signatures (optional). + * @return Method corresponding to input. + */ +export function createMethod( + methodName: string, + input?: DataItem | DataItem[] | string | string[], + output?: DataItem | DataItem[] | string | string[], +): Method { + const methodInput = _.isUndefined(input) ? [] : consolidateDataItemsIntoArray(input); + const methodOutput = _.isUndefined(output) ? [] : consolidateDataItemsIntoArray(output); + const methodAbi: MethodAbi = { + name: methodName, + inputs: methodInput, + outputs: methodOutput, + type: 'function', + // default fields not used by ABI + constant: false, + payable: false, + stateMutability: 'nonpayable', + }; + const dataType = new Method(methodAbi); return dataType; } + +/** + * Convenience function that aggregates a single input or a set of inputs into an array of DataItems. + * @param input A single data item; a set of data items; a signature; or an array of signatures. + * @return Array of data items corresponding to input. + */ +function consolidateDataItemsIntoArray(input: DataItem | DataItem[] | string | string[]): DataItem[] { + let dataItems: DataItem[]; + if (_.isArray(input) && _.isEmpty(input)) { + dataItems = []; + } else if (_.isArray(input) && _.isString(input[0])) { + dataItems = []; + _.each(input as string[], (signature: string) => { + const dataItem = generateDataItemFromSignature(signature); + dataItems.push(dataItem); + }); + } else if (_.isArray(input)) { + dataItems = input as DataItem[]; + } else if (typeof input === 'string') { + const dataItem = generateDataItemFromSignature(input); + dataItems = [dataItem]; + } else { + dataItems = [input as DataItem]; + } + return dataItems; +} /* tslint:enable no-construct */ diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts index c852a0fdfa..93746fa002 100644 --- a/packages/utils/src/abi_encoder/evm_data_types/method.ts +++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts @@ -65,6 +65,11 @@ export class MethodDataType extends AbstractSetDataType { return this._methodSelector; } + public getReturnValueDataItem(): DataItem { + const returnValueDataItem = this._returnDataType.getDataItem(); + return returnValueDataItem; + } + private _computeSignature(): string { const memberSignature = this._computeSignatureOfMembers(); const methodSignature = `${this.getDataItem().name}${memberSignature}`; diff --git a/packages/utils/src/abi_encoder/index.ts b/packages/utils/src/abi_encoder/index.ts index cfacfe075a..976bac8e6b 100644 --- a/packages/utils/src/abi_encoder/index.ts +++ b/packages/utils/src/abi_encoder/index.ts @@ -12,5 +12,6 @@ export { Tuple, UInt, create, + createMethod, } from './evm_data_type_factory'; export { DataType } from './abstract_data_types/data_type'; diff --git a/packages/utils/src/abi_encoder/utils/signature_parser.ts b/packages/utils/src/abi_encoder/utils/signature_parser.ts index 315784cead..d3996bf8e9 100644 --- a/packages/utils/src/abi_encoder/utils/signature_parser.ts +++ b/packages/utils/src/abi_encoder/utils/signature_parser.ts @@ -1,101 +1,88 @@ import { DataItem } from 'ethereum-types'; import * as _ from 'lodash'; -/** - * Returns an array of DataItem's corresponding to the input signature. - * A signature can be in two forms: '' or '(, , ...) - * An example of the first form would be 'address' or 'uint256' - * An example of the second form would be '(address, uint256)' - * Signatures can also include a name field, for example: 'foo address' or '(foo address, bar uint256)' - * @param signature of input DataItems - * @return DataItems derived from input signature - */ -export function generateDataItemsFromSignature(signature: string): DataItem[] { - let trimmedSignature = signature; - if (signature.startsWith('(')) { - if (!signature.endsWith(')')) { - throw new Error(`Failed to generate data item. Must end with ')'`); - } - trimmedSignature = signature.substr(1, signature.length - 2); +interface Node { + name: string; + value: string; + children: Node[]; + parent?: Node; +} + +function parseNode(node: Node): DataItem { + const components: DataItem[] = []; + _.each(node.children, (child: Node) => { + const component = parseNode(child); + components.push(component); + }); + const dataItem: DataItem = { + name: node.name, + type: node.value, + }; + if (!_.isEmpty(components)) { + dataItem.components = components; } - trimmedSignature += ','; - let isCurrTokenArray = false; - let currTokenArrayModifier = ''; - let isParsingArrayModifier = false; - let currToken = ''; - let parenCount = 0; - let currTokenName = ''; - const dataItems: DataItem[] = []; - for (const char of trimmedSignature) { - // Tokenize the type string while keeping track of parentheses. + return dataItem; +} + +/** + * Returns a DataItem corresponding to the input signature. + * A signature can be in two forms: `type` or `(type_1,type_2,...,type_n)` + * An example of the first form would be 'address' or 'uint256[]' or 'bytes[5][]' + * An example of the second form would be '(address,uint256)' or '(address,uint256)[]' + * @param signature of input DataItem. + * @return DataItem derived from input signature. + */ +export function generateDataItemFromSignature(signature: string): DataItem { + // No data item corresponds to an empty signature + if (_.isEmpty(signature)) { + throw new Error(`Cannot parse data item from empty signature, ''`); + } + // Create a parse tree for data item + let node: Node = { + name: '', + value: '', + children: [], + }; + for (const char of signature) { switch (char) { case '(': - parenCount += 1; - currToken += char; + const child = { + name: '', + value: '', + children: [], + parent: node, + }; + node.value = 'tuple'; + node.children.push(child); + node = child; break; + case ')': - parenCount -= 1; - currToken += char; - break; - case '[': - if (parenCount === 0) { - isParsingArrayModifier = true; - isCurrTokenArray = true; - currTokenArrayModifier += '['; - } else { - currToken += char; - } - break; - case ']': - if (parenCount === 0) { - isParsingArrayModifier = false; - currTokenArrayModifier += ']'; - } else { - currToken += char; - } - break; - case ' ': - if (parenCount === 0) { - currTokenName = currToken; - currToken = ''; - } else { - currToken += char; - } + node = node.parent as Node; break; + case ',': - if (parenCount === 0) { - // Generate new DataItem from token - const components = currToken.startsWith('(') ? generateDataItemsFromSignature(currToken) : []; - const isTuple = !_.isEmpty(components); - const dataItem: DataItem = { name: currTokenName, type: '' }; - if (isTuple) { - dataItem.type = 'tuple'; - dataItem.components = components; - } else { - dataItem.type = currToken; - } - if (isCurrTokenArray) { - dataItem.type += currTokenArrayModifier; - } - dataItems.push(dataItem); - // reset token state - currTokenName = ''; - currToken = ''; - isCurrTokenArray = false; - currTokenArrayModifier = ''; - break; - } else { - currToken += char; - break; - } + const sibling = { + name: '', + value: '', + children: [], + parent: node.parent, + }; + (node.parent as Node).children.push(sibling); + node = sibling; + break; + + case ' ': + node.name = node.value; + node.value = ''; + break; + default: - if (isParsingArrayModifier) { - currTokenArrayModifier += char; - } else { - currToken += char; - } + node.value += char; break; } } - return dataItems; + // Interpret data item from parse tree + const dataItem = parseNode(node); + return dataItem; } diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts index 1fc9604085..361e35cd81 100644 --- a/packages/utils/src/address_utils.ts +++ b/packages/utils/src/address_utils.ts @@ -1,7 +1,9 @@ -import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util'; +import { addHexPrefix, sha3, stripHexPrefix } from 'ethereumjs-util'; import * as jsSHA3 from 'js-sha3'; import * as _ from 'lodash'; +import { generatePseudoRandom256BitNumber } from './random'; + const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i; const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/; const ADDRESS_LENGTH = 40; @@ -43,4 +45,11 @@ export const addressUtils = { padZeros(address: string): string { return addHexPrefix(_.padStart(stripHexPrefix(address), ADDRESS_LENGTH, '0')); }, + generatePseudoRandomAddress(): string { + const randomBigNum = generatePseudoRandom256BitNumber(); + const randomBuff = sha3(randomBigNum.toString()); + const addressLengthInBytes = 20; + const randomAddress = `0x${randomBuff.slice(0, addressLengthInBytes).toString('hex')}`; + return randomAddress; + }, }; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 082aff6bbe..f9c2693fe0 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -11,3 +11,5 @@ export { errorUtils } from './error_utils'; export { fetchAsync } from './fetch_async'; export { signTypedDataUtils } from './sign_typed_data_utils'; export import AbiEncoder = require('./abi_encoder'); +export * from './types'; +export { generatePseudoRandom256BitNumber } from './random'; diff --git a/packages/utils/src/random.ts b/packages/utils/src/random.ts new file mode 100644 index 0000000000..69243bab84 --- /dev/null +++ b/packages/utils/src/random.ts @@ -0,0 +1,16 @@ +import { BigNumber } from './configured_bignumber'; + +const MAX_DIGITS_IN_UNSIGNED_256_INT = 78; + +/** + * Generates a pseudo-random 256-bit number. + * @return A pseudo-random 256-bit number. + */ +export function generatePseudoRandom256BitNumber(): BigNumber { + // BigNumber.random returns a pseudo-random number between 0 & 1 with a passed in number of decimal places. + // Source: https://mikemcl.github.io/bignumber.js/#random + const randomNumber = BigNumber.random(MAX_DIGITS_IN_UNSIGNED_256_INT); + const factor = new BigNumber(10).pow(MAX_DIGITS_IN_UNSIGNED_256_INT - 1); + const randomNumberScaledTo256Bits = randomNumber.times(factor).integerValue(); + return randomNumberScaledTo256Bits; +} diff --git a/packages/utils/src/types.ts b/packages/utils/src/types.ts new file mode 100644 index 0000000000..32e11efa22 --- /dev/null +++ b/packages/utils/src/types.ts @@ -0,0 +1,19 @@ +import { AbiEncoder } from '.'; + +export interface FunctionInfo { + functionSignature: string; + contractName?: string; + contractAddress?: string; + networkId?: number; + abiEncoder?: AbiEncoder.Method; +} + +export interface SelectorToFunctionInfo { + [index: string]: FunctionInfo[]; +} + +export interface DecodedCalldata { + functionName: string; + functionSignature: string; + functionArguments: any; +} diff --git a/packages/utils/test/abi_decoder_test.ts b/packages/utils/test/abi_decoder_test.ts new file mode 100644 index 0000000000..81fed1060e --- /dev/null +++ b/packages/utils/test/abi_decoder_test.ts @@ -0,0 +1,50 @@ +import * as chai from 'chai'; +import { MethodAbi } from 'ethereum-types'; +import 'mocha'; + +import { AbiDecoder, AbiEncoder } from '../src'; + +import { chaiSetup } from './utils/chai_setup'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('AbiDecoder', () => { + it('should successfully add a new ABI and decode calldata for it', async () => { + // Add new ABI + const abi: MethodAbi = { + name: 'foobar', + type: 'function', + inputs: [ + { + name: 'testAddress', + type: 'address', + }, + ], + outputs: [ + { + name: 'butter', + type: 'string', + }, + ], + constant: false, + payable: false, + stateMutability: 'pure', + }; + const contractName = 'newContract'; + const testAddress = '0x0001020304050607080900010203040506070809'; + const abiDecoder = new AbiDecoder([]); + abiDecoder.addABI([abi], contractName); + // Create some tx data + const foobarEncoder = new AbiEncoder.Method(abi); + const foobarSignature = foobarEncoder.getSignature(); + const foobarTxData = foobarEncoder.encode([testAddress]); + // Decode tx data using contract name + const decodedTxData = abiDecoder.decodeCalldataOrThrow(foobarTxData, contractName); + const expectedFunctionName = abi.name; + const expectedFunctionArguments = { testAddress }; + expect(decodedTxData.functionName).to.be.equal(expectedFunctionName); + expect(decodedTxData.functionSignature).to.be.equal(foobarSignature); + expect(decodedTxData.functionArguments).to.be.deep.equal(expectedFunctionArguments); + }); +}); diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts index c09c0d9294..c802902072 100644 --- a/packages/utils/test/abi_encoder/evm_data_types_test.ts +++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts @@ -28,7 +28,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => { const decodedArgs = dataType.decode(encodedArgs); expect(decodedArgs).to.be.deep.equal(args); // Validate signature - const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true)); + const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(false)); const argsEncodedFromSignature = dataTypeFromSignature.encode(args); expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs); }); diff --git a/packages/utils/test/abi_encoder/signature_test.ts b/packages/utils/test/abi_encoder/signature_test.ts new file mode 100644 index 0000000000..cee6fa5e57 --- /dev/null +++ b/packages/utils/test/abi_encoder/signature_test.ts @@ -0,0 +1,393 @@ +import * as chai from 'chai'; +import 'mocha'; + +import { AbiEncoder } from '../../src'; +import { chaiSetup } from '../utils/chai_setup'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('ABI Encoder: Signatures', () => { + describe('Single type', () => { + it('Elementary', async () => { + const signature = 'uint256'; + const dataType = AbiEncoder.create(signature); + const dataTypeId = dataType.getDataItem().type; + expect(dataTypeId).to.be.equal('uint256'); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Array', async () => { + const signature = 'string[]'; + const dataType = AbiEncoder.create(signature); + const dataItem = dataType.getDataItem(); + const expectedDataItem = { + name: '', + type: 'string[]', + }; + expect(dataItem).to.be.deep.equal(expectedDataItem); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Multidimensional Array', async () => { + // Decode return value + const signature = 'uint256[4][][5]'; + const dataType = AbiEncoder.create(signature); + const dataTypeId = dataType.getDataItem().type; + expect(dataTypeId).to.be.equal(signature); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Tuple with single element', async () => { + const signature = '(uint256)'; + const dataType = AbiEncoder.create(signature); + const dataItem = dataType.getDataItem(); + const expectedDataItem = { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'uint256', + }, + ], + }; + expect(dataItem).to.be.deep.equal(expectedDataItem); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Tuple with multiple elements', async () => { + const signature = '(uint256,string,bytes4)'; + const dataType = AbiEncoder.create(signature); + const dataItem = dataType.getDataItem(); + const expectedDataItem = { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'uint256', + }, + { + name: '', + type: 'string', + }, + { + name: '', + type: 'bytes4', + }, + ], + }; + expect(dataItem).to.be.deep.equal(expectedDataItem); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Tuple with nested array and nested tuple', async () => { + const signature = '(uint256[],(bytes),string[4],bytes4)'; + const dataType = AbiEncoder.create(signature); + const dataItem = dataType.getDataItem(); + const expectedDataItem = { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'uint256[]', + }, + { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'bytes', + }, + ], + }, + { + name: '', + type: 'string[4]', + }, + { + name: '', + type: 'bytes4', + }, + ], + }; + expect(dataItem).to.be.deep.equal(expectedDataItem); + expect(dataType.getSignature()).to.be.equal(signature); + }); + it('Array of complex tuples', async () => { + const signature = '(uint256[],(bytes),string[4],bytes4)[5][4][]'; + const dataType = AbiEncoder.create(signature); + const dataItem = dataType.getDataItem(); + const expectedDataItem = { + name: '', + type: 'tuple[5][4][]', + components: [ + { + name: '', + type: 'uint256[]', + }, + { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'bytes', + }, + ], + }, + { + name: '', + type: 'string[4]', + }, + { + name: '', + type: 'bytes4', + }, + ], + }; + expect(dataItem).to.be.deep.equal(expectedDataItem); + expect(dataType.getSignature()).to.be.equal(signature); + }); + }); + + describe('Function', () => { + it('No inputs and no outputs', async () => { + // create encoder + const functionName = 'foo'; + const dataType = AbiEncoder.createMethod(functionName); + // create expected values + const expectedSignature = 'foo()'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('No inputs and no outputs (empty arrays as input)', async () => { + // create encoder + const functionName = 'foo'; + const dataType = AbiEncoder.createMethod(functionName, [], []); + // create expected values + const expectedSignature = 'foo()'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('Single DataItem input and single DataItem output', async () => { + // create encoder + const functionName = 'foo'; + const inputDataItem = { + name: 'input', + type: 'uint256', + }; + const outputDataItem = { + name: 'output', + type: 'string', + }; + const dataType = AbiEncoder.createMethod(functionName, inputDataItem, outputDataItem); + // create expected values + const expectedSignature = 'foo(uint256)'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [inputDataItem], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [outputDataItem], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('Single signature input and single signature output', async () => { + // create encoder + const functionName = 'foo'; + const inputSignature = 'uint256'; + const outputSignature = 'string'; + const dataType = AbiEncoder.createMethod(functionName, inputSignature, outputSignature); + // create expected values + const expectedSignature = 'foo(uint256)'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [ + { + name: '', + type: 'uint256', + }, + ], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [ + { + name: '', + type: 'string', + }, + ], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('Single signature tuple input and single signature tuple output', async () => { + // create encoder + const functionName = 'foo'; + const inputSignature = '(uint256,bytes[][4])'; + const outputSignature = '(string,uint32)'; + const dataType = AbiEncoder.createMethod(functionName, inputSignature, outputSignature); + // create expected values + const expectedSignature = 'foo((uint256,bytes[][4]))'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [ + { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'uint256', + }, + { + name: '', + type: 'bytes[][4]', + }, + ], + }, + ], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [ + { + name: '', + type: 'tuple', + components: [ + { + name: '', + type: 'string', + }, + { + name: '', + type: 'uint32', + }, + ], + }, + ], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('Mutiple DataItem input and multiple DataItem output', async () => { + // create encoder + const functionName = 'foo'; + const inputDataItems = [ + { + name: '', + type: 'uint256', + }, + { + name: '', + type: 'bytes[][4]', + }, + ]; + const outputDataItems = [ + { + name: '', + type: 'string', + }, + { + name: '', + type: 'uint32', + }, + ]; + const dataType = AbiEncoder.createMethod(functionName, inputDataItems, outputDataItems); + // create expected values + const expectedSignature = 'foo(uint256,bytes[][4])'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: inputDataItems, + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: outputDataItems, + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + it('Multiple signature input and multiple signature output', async () => { + // create encoder + const functionName = 'foo'; + const inputSignatures = ['uint256', 'bytes[][4]']; + const outputSignatures = ['string', 'uint32']; + const dataType = AbiEncoder.createMethod(functionName, inputSignatures, outputSignatures); + // create expected values + const expectedSignature = 'foo(uint256,bytes[][4])'; + const expectedInputDataItem = { + name: 'foo', + type: 'method', + components: [ + { + name: '', + type: 'uint256', + }, + { + name: '', + type: 'bytes[][4]', + }, + ], + }; + const expectedOutputDataItem = { + name: 'foo', + type: 'tuple', + components: [ + { + name: '', + type: 'string', + }, + { + name: '', + type: 'uint32', + }, + ], + }; + // check expected values + expect(dataType.getSignature()).to.be.equal(expectedSignature); + expect(dataType.getDataItem()).to.be.deep.equal(expectedInputDataItem); + expect(dataType.getReturnValueDataItem()).to.be.deep.equal(expectedOutputDataItem); + }); + }); +}); diff --git a/packages/utils/test/abi_encoder/signature_tests.ts b/packages/utils/test/abi_encoder/signature_tests.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 49dbe5a64f..a65e40e956 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "5.0.0", + "changes": [ + { + "note": "Export `DecodedCalldata` from @0x/utils", + "pr": 1569 + } + ], + "timestamp": 1549733923 + }, { "version": "4.0.2", "changes": [ diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 461d55a262..bf0a98ca94 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 +## v5.0.0 - _February 9, 2019_ + + * Export `DecodedCalldata` from @0x/utils (#1569) + ## v4.0.2 - _February 7, 2019_ * Dependencies updated diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index d28a9894ff..d6f0bf90d0 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0x/web3-wrapper", - "version": "4.0.2", + "version": "5.0.0", "engines": { "node": ">=6.12" }, @@ -54,10 +54,10 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/assert": "^2.0.2", - "@0x/json-schemas": "^3.0.2", + "@0x/assert": "^2.0.3", + "@0x/json-schemas": "^3.0.3", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", + "@0x/utils": "^4.1.0", "ethereum-types": "^2.0.0", "ethereumjs-util": "^5.1.1", "ethers": "~4.0.4", diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 4d20ba9bed..a634084552 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,7 +1,7 @@ export { Web3Wrapper } from './web3_wrapper'; export { marshaller } from './marshaller'; -export { AbiDecoder } from '@0x/utils'; +export { AbiDecoder, DecodedCalldata } from '@0x/utils'; export { BlockParam, diff --git a/packages/website/package.json b/packages/website/package.json index 12f62c7d87..b1e1da115b 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0x/website", - "version": "0.0.71", + "version": "0.0.72", "engines": { "node": ">=6.12" }, @@ -20,18 +20,18 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "@0x/asset-buyer": "^5.0.3", + "@0x/asset-buyer": "^5.0.4", "@0x/contract-addresses": "^2.2.1", - "@0x/contract-wrappers": "^7.0.2", - "@0x/json-schemas": "^3.0.2", - "@0x/order-utils": "^6.0.1", - "@0x/react-docs": "^2.0.3", - "@0x/react-shared": "^2.0.3", - "@0x/subproviders": "^3.0.2", + "@0x/contract-wrappers": "^7.1.0", + "@0x/json-schemas": "^3.0.3", + "@0x/order-utils": "^6.1.0", + "@0x/react-docs": "^2.0.4", + "@0x/react-shared": "^2.0.4", + "@0x/subproviders": "^3.0.3", "@0x/types": "^2.0.2", "@0x/typescript-typings": "^4.0.0", - "@0x/utils": "^4.0.3", - "@0x/web3-wrapper": "^4.0.2", + "@0x/utils": "^4.1.0", + "@0x/web3-wrapper": "^5.0.0", "@reach/dialog": "^0.1.2", "@types/react-lazyload": "^2.3.1", "@types/react-loadable": "^5.4.2", diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index 3765a32ca4..e6a7904a81 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -62,6 +62,7 @@ const linkRows: LinkRows[] = [ { url: constants.URL_ZEROEX_CHAT, text: 'Discord Chat', shouldOpenInNewTab: true }, { url: constants.URL_FACEBOOK, text: 'Facebook', shouldOpenInNewTab: true }, { url: constants.URL_REDDIT, text: 'Reddit', shouldOpenInNewTab: true }, + { url: constants.URL_FORUM, text: 'Forum', shouldOpenInNewTab: true }, ], }, ]; diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index f30374da0d..58615685fb 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -26,6 +26,7 @@ import { Next0xInstant } from 'ts/pages/instant'; import { NextLanding } from 'ts/pages/landing'; import { NextLaunchKit } from 'ts/pages/launch_kit'; import { NextMarketMaker } from 'ts/pages/market_maker'; +import { VotePlaceholder } from 'ts/pages/vote_placeholder'; import { NextWhy } from 'ts/pages/why'; // Check if we've introduced an update that requires us to clear the tradeHistory local storage entries @@ -115,6 +116,7 @@ render( + ( + + +
+ + + Come back on February 18th to vote + + + 0x is conducting a vote on ZEIP-23, which adds the ability to trade bundles of ERC-20 and ERC-721 + tokens via the 0x protocol. Integrating ZEIP-23 requires a modification to the protocol’s smart + contract pipeline, which has access to live digital assets. All ZRX token holders have the right to + vote on this improvement proposal. + + + + + +
+
+); + +const LinkWrap = styled.div` + display: inline-flex; + margin-top: 60px; + + a + a { + margin-left: 60px; + } +`; diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index c3ef05cb20..12bfc1a003 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -384,6 +384,7 @@ export enum WebsitePaths { Migrations = '/docs/migrations', Careers = '/careers', Credits = '/credits', + Vote = '/vote', } export enum DocPackages { diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts index 03c1a0b83c..5b7668736b 100644 --- a/packages/website/ts/utils/constants.ts +++ b/packages/website/ts/utils/constants.ts @@ -78,6 +78,7 @@ export const constants = { URL_DISCOURSE_FORUM: 'https://forum.0x.org', URL_ECOSYSTEM_APPLY: 'https://0x.smapply.io/', URL_ECOSYSTEM_BLOG_POST: 'https://blog.0xproject.com/announcing-the-0x-ecosystem-acceleration-program-89d1cb89d565', + URL_VOTE_BLOG_POST: 'https://blog.0xproject.com/zeip-23-trade-bundles-of-assets-fe69eb3ed960', URL_FIREFOX_U2F_ADDON: 'https://addons.mozilla.org/en-US/firefox/addon/u2f-support-add-on/', URL_TESTNET_FAUCET: 'https://faucet.0x.org', URL_GITHUB_ORG: 'https://github.com/0xProject', diff --git a/yarn.lock b/yarn.lock index a3fbb4e96c..a0acb46eb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -587,6 +587,19 @@ ethers "~4.0.4" lodash "^4.17.11" +"@0x/web3-wrapper@^4.0.1": + version "4.0.2" + resolved "https://registry.npmjs.org/@0x/web3-wrapper/-/web3-wrapper-4.0.2.tgz#d4e0a4fa1217155e1aed4cd91086654fd99f2959" + dependencies: + "@0x/assert" "^2.0.2" + "@0x/json-schemas" "^3.0.2" + "@0x/typescript-typings" "^4.0.0" + "@0x/utils" "^4.0.3" + ethereum-types "^2.0.0" + ethereumjs-util "^5.1.1" + ethers "~4.0.4" + lodash "^4.17.11" + "@0xproject/npm-cli-login@^0.0.11": version "0.0.11" resolved "https://registry.yarnpkg.com/@0xproject/npm-cli-login/-/npm-cli-login-0.0.11.tgz#3f1ec06112ce62aad300ff0575358f68aeecde2e" @@ -13461,15 +13474,6 @@ react-dom@^16.3.2: object-assign "^4.1.1" prop-types "^15.6.0" -react-dom@^16.4.2: - version "16.8.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.1.tgz#ec860f98853d09d39bafd3a6f1e12389d283dbb4" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.13.1" - react-dom@^16.5.2: version "16.5.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.2.tgz#b69ee47aa20bab5327b2b9d7c1fe2a30f2cfa9d7" @@ -13773,15 +13777,6 @@ react@^16.3.2: object-assign "^4.1.1" prop-types "^15.6.0" -react@^16.4.2: - version "16.8.1" - resolved "https://registry.yarnpkg.com/react/-/react-16.8.1.tgz#ae11831f6cb2a05d58603a976afc8a558e852c4a" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.13.1" - react@^16.5.2: version "16.5.2" resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42" @@ -14653,13 +14648,6 @@ schedule@^0.5.0: dependencies: object-assign "^4.1.1" -scheduler@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.1.tgz#1a217df1bfaabaf4f1b92a9127d5d732d85a9591" - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - schema-utils@^0.4.4: version "0.4.7" resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"