From 82d1412d456ee28d80597208a241a2b62f561837 Mon Sep 17 00:00:00 2001 From: Remco Bloemen Date: Mon, 11 Jun 2018 09:19:52 +0200 Subject: Simplified handling of source < 32 edge case --- .../src/contracts/current/utils/LibMem/LibMem.sol | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol index 6afb9973a..97fb5fb0f 100644 --- a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol +++ b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol @@ -80,9 +80,6 @@ contract LibMem // if (source > dest) { assembly { - // Record the total number of full words to copy - let nWords := div(length, 32) - // We subtract 32 from `sEnd` and `dEnd` because it // is easier to compare with in the loop, and these // are also the addresses we need for copying the @@ -98,20 +95,19 @@ contract LibMem let last := mload(sEnd) // Copy whole words front to back - for {let i := 0} lt(i, nWords) {i := add(i, 1)} { + // Note: the first check is always true, + // this could have been a do-while loop. + for {} lt(source, sEnd) {} { mstore(dest, mload(source)) source := add(source, 32) dest := add(dest, 32) } - + // Write the last 32 bytes mstore(dEnd, last) } } else { assembly { - // Record the total number of full words to copy - let nWords := div(length, 32) - // We subtract 32 from `sEnd` and `dEnd` because those // are the starting points when copying a word at the end. length := sub(length, 32) @@ -125,12 +121,18 @@ contract LibMem let first := mload(source) // Copy whole words back to front - for {let i := 0} lt(i, nWords) {i := add(i, 1)} { + // We use a signed comparisson here to allow dEnd to become + // negative (happens when source and dest < 32). Valid + // addresses in local memory will never be larger than + // 2**255, so they can be safely re-interpreted as signed. + // Note: the first check is always true, + // this could have been a do-while loop. + for {} slt(dest, dEnd) {} { mstore(dEnd, mload(sEnd)) sEnd := sub(sEnd, 32) dEnd := sub(dEnd, 32) } - + // Write the first 32 bytes mstore(dest, first) } -- cgit v1.2.3 From 2c7d6a7711e44294e64858095971a2aebc6d1829 Mon Sep 17 00:00:00 2001 From: Remco Bloemen Date: Thu, 14 Jun 2018 10:54:54 +0200 Subject: Handle tokens that do not return bool --- .../current/protocol/AssetProxy/ERC20Proxy.sol | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol index ddcd78e93..eeddb9707 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol @@ -50,7 +50,35 @@ contract ERC20Proxy is address token = readAddress(assetData, 0); // Transfer tokens. - bool success = IERC20Token(token).transferFrom(from, to, amount); + // We do a raw call so we can check the success separate + // from the return data. + bool success = token.call(abi.encodeWithSelector( + IERC20Token(token).transferFrom.selector, + from, + to, + amount + )); + require( + success, + TRANSFER_FAILED + ); + + // Check return data. + // If there is no return data, we assume the token incorrectly + // does not return a bool. In this case we expect it to revert + // on failure, which was handled above. + // If the token does return data, we require that it is a single + // value that evaluates to true. + assembly { + if returndatasize { + success := 0 + if eq(returndatasize, 32) { + // First 64 bytes of memory are reserved scratch space + returndatacopy(0, 0, 32) + success := mload(0) + } + } + } require( success, TRANSFER_FAILED -- cgit v1.2.3 From 7ab921669bf52c1cb2d43350b2cccc8efe91bdbd Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 14 Jun 2018 13:58:28 -0700 Subject: Introduce subprovider for printing revert stack traces --- packages/contracts/package.json | 1 + packages/contracts/src/utils/revert_trace.ts | 21 ++++++++++++ packages/contracts/src/utils/web3_wrapper.ts | 51 ++++++++++++++++------------ 3 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 packages/contracts/src/utils/revert_trace.ts (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d6ca3727b..ad7cbf476 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -19,6 +19,7 @@ "rebuild_and_test": "run-s build test", "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html", + "test:trace": "SOLIDITY_REVERT_TRACE=true run-s run_mocha", "run_mocha": "mocha --require source-map-support/register 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile": "sol-compiler", "clean": "shx rm -rf lib src/generated_contract_wrappers", diff --git a/packages/contracts/src/utils/revert_trace.ts b/packages/contracts/src/utils/revert_trace.ts new file mode 100644 index 000000000..0bf8384bc --- /dev/null +++ b/packages/contracts/src/utils/revert_trace.ts @@ -0,0 +1,21 @@ +import { devConstants } from '@0xproject/dev-utils'; +import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov'; +import * as _ from 'lodash'; + +let revertTraceSubprovider: RevertTraceSubprovider; + +export const revertTrace = { + getRevertTraceSubproviderSingleton(): RevertTraceSubprovider { + if (_.isUndefined(revertTraceSubprovider)) { + revertTraceSubprovider = revertTrace._getRevertTraceSubprovider(); + } + return revertTraceSubprovider; + }, + _getRevertTraceSubprovider(): RevertTraceSubprovider { + const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS; + const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter(); + const isVerbose = true; + const subprovider = new RevertTraceSubprovider(solCompilerArtifactAdapter, defaultFromAddress, isVerbose); + return subprovider; + }, +}; diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index c475d96a9..b8e8ed8ce 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -5,6 +5,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { coverage } from './coverage'; import { profiler } from './profiler'; +import { revertTrace } from './revert_trace'; enum ProviderType { Ganache = 'ganache', @@ -48,28 +49,34 @@ const providerConfigs = testProvider === ProviderType.Ganache ? ganacheConfigs : export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler); -if (isCoverageEnabled && isProfilerEnabled) { - throw new Error( - `Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`, - ); -} -if (isCoverageEnabled) { - const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); - prependSubprovider(provider, coverageSubprovider); -} -if (isProfilerEnabled) { - if (testProvider === ProviderType.Ganache) { - logUtils.warn( - "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth", - ); - process.exit(1); - } - const profilerSubprovider = profiler.getProfilerSubproviderSingleton(); - logUtils.log( - "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards", - ); - profilerSubprovider.stop(); - prependSubprovider(provider, profilerSubprovider); +const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace); +// TODO(albrow): Include revertTrace checks in the warnings below. +// if (isCoverageEnabled && isProfilerEnabled) { +// throw new Error( +// `Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`, +// ); +// } +// if (isCoverageEnabled) { +// const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); +// prependSubprovider(provider, coverageSubprovider); +// } +// if (isProfilerEnabled) { +// if (testProvider === ProviderType.Ganache) { +// logUtils.warn( +// "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth", +// ); +// process.exit(1); +// } +// const profilerSubprovider = profiler.getProfilerSubproviderSingleton(); +// logUtils.log( +// "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards", +// ); +// profilerSubprovider.stop(); +// prependSubprovider(provider, profilerSubprovider); +// } +if (isRevertTraceEnabled) { + const revertTraceSubprovider = revertTrace.getRevertTraceSubproviderSingleton(); + prependSubprovider(provider, revertTraceSubprovider); } export const web3Wrapper = new Web3Wrapper(provider); -- cgit v1.2.3 From 263bfb1bdad8acdb9b534edf6e79024e8da35721 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 14 Jun 2018 15:46:59 -0700 Subject: Fix a bug in revert_trace.ts --- packages/contracts/src/utils/web3_wrapper.ts | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index b8e8ed8ce..f51ad435b 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -51,29 +51,29 @@ const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler); const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace); // TODO(albrow): Include revertTrace checks in the warnings below. -// if (isCoverageEnabled && isProfilerEnabled) { -// throw new Error( -// `Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`, -// ); -// } -// if (isCoverageEnabled) { -// const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); -// prependSubprovider(provider, coverageSubprovider); -// } -// if (isProfilerEnabled) { -// if (testProvider === ProviderType.Ganache) { -// logUtils.warn( -// "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth", -// ); -// process.exit(1); -// } -// const profilerSubprovider = profiler.getProfilerSubproviderSingleton(); -// logUtils.log( -// "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards", -// ); -// profilerSubprovider.stop(); -// prependSubprovider(provider, profilerSubprovider); -// } +if (isCoverageEnabled && isProfilerEnabled) { + throw new Error( + `Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`, + ); +} +if (isCoverageEnabled) { + const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); + prependSubprovider(provider, coverageSubprovider); +} +if (isProfilerEnabled) { + if (testProvider === ProviderType.Ganache) { + logUtils.warn( + "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth", + ); + process.exit(1); + } + const profilerSubprovider = profiler.getProfilerSubproviderSingleton(); + logUtils.log( + "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards", + ); + profilerSubprovider.stop(); + prependSubprovider(provider, profilerSubprovider); +} if (isRevertTraceEnabled) { const revertTraceSubprovider = revertTrace.getRevertTraceSubproviderSingleton(); prependSubprovider(provider, revertTraceSubprovider); -- cgit v1.2.3 From d9292a70bfa00715b6b007b0ecd696db02b1d042 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 14 Jun 2018 16:00:24 -0700 Subject: Remove unused variables and other small fixes --- packages/contracts/package.json | 2 +- packages/contracts/src/utils/web3_wrapper.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index ad7cbf476..2495795dc 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -19,7 +19,7 @@ "rebuild_and_test": "run-s build test", "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html", - "test:trace": "SOLIDITY_REVERT_TRACE=true run-s run_mocha", + "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha", "run_mocha": "mocha --require source-map-support/register 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile": "sol-compiler", "clean": "shx rm -rf lib src/generated_contract_wrappers", diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index f51ad435b..772e4c613 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -7,6 +7,8 @@ import { coverage } from './coverage'; import { profiler } from './profiler'; import { revertTrace } from './revert_trace'; +import * as _ from 'lodash'; + enum ProviderType { Ganache = 'ganache', Geth = 'geth', @@ -50,11 +52,10 @@ export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler); const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace); -// TODO(albrow): Include revertTrace checks in the warnings below. -if (isCoverageEnabled && isProfilerEnabled) { - throw new Error( - `Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`, - ); +const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity) + .length; +if (enabledSubproviderCount > 1) { + throw new Error(`Only one of coverage, profiler, and revert trace subproviders can be enabled at a time`); } if (isCoverageEnabled) { const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); -- cgit v1.2.3 From 5a8539a1228baeb085ed7851245337f27ee1d974 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 14 Jun 2018 16:04:08 -0700 Subject: Fix linter errors and remove coverage.json --- packages/contracts/src/utils/web3_wrapper.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 772e4c613..67b71cdeb 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -2,13 +2,12 @@ import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; import { prependSubprovider } from '@0xproject/subproviders'; import { logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as _ from 'lodash'; import { coverage } from './coverage'; import { profiler } from './profiler'; import { revertTrace } from './revert_trace'; -import * as _ from 'lodash'; - enum ProviderType { Ganache = 'ganache', Geth = 'geth', -- cgit v1.2.3 From 7032825e35e825e42196d4ccc23b1a1f7fb8038a Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 14 Jun 2018 16:53:48 -0700 Subject: Change wording of error message when you try to use more than one subprovider --- packages/contracts/src/utils/web3_wrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 67b71cdeb..c9d83a02d 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -54,7 +54,7 @@ const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace); const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity) .length; if (enabledSubproviderCount > 1) { - throw new Error(`Only one of coverage, profiler, and revert trace subproviders can be enabled at a time`); + throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`); } if (isCoverageEnabled) { const coverageSubprovider = coverage.getCoverageSubproviderSingleton(); -- cgit v1.2.3 From ff95da411b8f7bb791e2ecfc57d2ba03dc591a52 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 4 Jun 2018 13:54:56 -0700 Subject: Split transfer impl and AssetProxyMixin --- .../current/protocol/AssetProxy/ERC20Proxy.sol | 59 +--------------- .../current/protocol/AssetProxy/ERC721Proxy.sol | 42 +----------- .../protocol/AssetProxy/MixinERC20Transfer.sol | 71 +++++++++++++++++++ .../protocol/AssetProxy/MixinERC721Transfer.sol | 79 ++++++++++++++++++++++ 4 files changed, 156 insertions(+), 95 deletions(-) create mode 100644 packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol create mode 100644 packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol index eeddb9707..7ca823d1f 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol @@ -22,69 +22,16 @@ pragma experimental ABIEncoderV2; import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAssetProxy.sol"; import "./MixinAuthorizable.sol"; -import "../../tokens/ERC20Token/IERC20Token.sol"; +import "./MixinERC20Transfer.sol"; contract ERC20Proxy is - LibBytes, MixinAssetProxy, - MixinAuthorizable + MixinAuthorizable, + MixinERC20Transfer { - // Id of this proxy. uint8 constant PROXY_ID = 1; - /// @dev Internal version of `transferFrom`. - /// @param assetData Encoded byte array. - /// @param from Address to transfer asset from. - /// @param to Address to transfer asset to. - /// @param amount Amount of asset to transfer. - function transferFromInternal( - bytes memory assetData, - address from, - address to, - uint256 amount - ) - internal - { - // Decode asset data. - address token = readAddress(assetData, 0); - - // Transfer tokens. - // We do a raw call so we can check the success separate - // from the return data. - bool success = token.call(abi.encodeWithSelector( - IERC20Token(token).transferFrom.selector, - from, - to, - amount - )); - require( - success, - TRANSFER_FAILED - ); - - // Check return data. - // If there is no return data, we assume the token incorrectly - // does not return a bool. In this case we expect it to revert - // on failure, which was handled above. - // If the token does return data, we require that it is a single - // value that evaluates to true. - assembly { - if returndatasize { - success := 0 - if eq(returndatasize, 32) { - // First 64 bytes of memory are reserved scratch space - returndatacopy(0, 0, 32) - success := mload(0) - } - } - } - require( - success, - TRANSFER_FAILED - ); - } - /// @dev Gets the proxy id associated with the proxy address. /// @return Proxy id. function getProxyId() diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol index 861fac2c1..2b280add4 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol @@ -22,52 +22,16 @@ pragma experimental ABIEncoderV2; import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAssetProxy.sol"; import "./MixinAuthorizable.sol"; -import "../../tokens/ERC721Token/ERC721Token.sol"; +import "./MixinERC721Transfer.sol"; contract ERC721Proxy is - LibBytes, MixinAssetProxy, - MixinAuthorizable + MixinAuthorizable, + MixinERC721Transfer { - // Id of this proxy. uint8 constant PROXY_ID = 2; - /// @dev Internal version of `transferFrom`. - /// @param assetData Encoded byte array. - /// @param from Address to transfer asset from. - /// @param to Address to transfer asset to. - /// @param amount Amount of asset to transfer. - function transferFromInternal( - bytes memory assetData, - address from, - address to, - uint256 amount - ) - internal - { - // There exists only 1 of each token. - require( - amount == 1, - INVALID_AMOUNT - ); - - // Decode asset data. - ( - address token, - uint256 tokenId, - bytes memory receiverData - ) = decodeERC721AssetData(assetData); - - // Transfer token. Saves gas by calling safeTransferFrom only - // when there is receiverData present. Either succeeds or throws. - if (receiverData.length > 0) { - ERC721Token(token).safeTransferFrom(from, to, tokenId, receiverData); - } else { - ERC721Token(token).transferFrom(from, to, tokenId); - } - } - /// @dev Gets the proxy id associated with the proxy address. /// @return Proxy id. function getProxyId() diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol new file mode 100644 index 000000000..b0c32db59 --- /dev/null +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol @@ -0,0 +1,71 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.24; +pragma experimental ABIEncoderV2; + +import "../../utils/LibBytes/LibBytes.sol"; +import "../../tokens/ERC20Token/IERC20Token.sol"; + +contract MixinERC20Transfer is + LibBytes +{ + // Id of this proxy. + uint8 constant PROXY_ID = 1; + // Revert reasons + string constant INVALID_METADATA_LENGTH = "Metadata must have a length of 21."; + string constant TRANSFER_FAILED = "Transfer failed."; + string constant PROXY_ID_MISMATCH = "Proxy id in metadata does not match this proxy id."; + + /// @dev Internal version of `transferFrom`. + /// @param assetMetadata Encoded byte array. + /// @param from Address to transfer asset from. + /// @param to Address to transfer asset to. + /// @param amount Amount of asset to transfer. + function transferFromInternal( + bytes memory assetMetadata, + address from, + address to, + uint256 amount + ) + internal + { + // Data must be intended for this proxy. + uint256 length = assetMetadata.length; + + require( + length == 21, + INVALID_METADATA_LENGTH + ); + + require( + uint8(assetMetadata[length - 1]) == PROXY_ID, + PROXY_ID_MISMATCH + ); + + // Decode metadata. + address token = readAddress(assetMetadata, 0); + + // Transfer tokens. + bool success = IERC20Token(token).transferFrom(from, to, amount); + require( + success == true, + TRANSFER_FAILED + ); + } +} diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol new file mode 100644 index 000000000..bbb807956 --- /dev/null +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol @@ -0,0 +1,79 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.24; +pragma experimental ABIEncoderV2; + +import "../../utils/LibBytes/LibBytes.sol"; +import "../../tokens/ERC721Token/ERC721Token.sol"; + +contract MixinERC721Transfer is + LibBytes +{ + + // Id of this proxy. + uint8 constant PROXY_ID = 2; + + // Revert reasons + string constant INVALID_TRANSFER_AMOUNT = "Transfer amount must equal 1."; + string constant INVALID_METADATA_LENGTH = "Metadata must have a length of 53."; + string constant PROXY_ID_MISMATCH = "Proxy id in metadata does not match this proxy id."; + + /// @dev Internal version of `transferFrom`. + /// @param assetMetadata Encoded byte array. + /// @param from Address to transfer asset from. + /// @param to Address to transfer asset to. + /// @param amount Amount of asset to transfer. + function transferFromInternal( + bytes memory assetMetadata, + address from, + address to, + uint256 amount + ) + internal + { + // Data must be intended for this proxy. + uint256 length = assetMetadata.length; + + require( + length == 53, + INVALID_METADATA_LENGTH + ); + + require( + uint8(assetMetadata[length - 1]) == PROXY_ID, + PROXY_ID_MISMATCH + ); + + // There exists only 1 of each token. + require( + amount == 1, + INVALID_TRANSFER_AMOUNT + ); + + // Decode metadata + address token = readAddress(assetMetadata, 0); + uint256 tokenId = readUint256(assetMetadata, 20); + + // Transfer token. + // Either succeeds or throws. + // @TODO: Call safeTransferFrom if there is additional + // data stored in `assetMetadata`. + ERC721Token(token).transferFrom(from, to, tokenId); + } +} -- cgit v1.2.3 From 96c90e6295315802aaad1b80e5a31e4cef886675 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 18 Jun 2018 16:19:45 +1000 Subject: Rebase with latest removing PROXY_ID from transfer --- .../current/protocol/AssetProxy/ERC721Proxy.sol | 30 -------- .../protocol/AssetProxy/MixinERC20Transfer.sol | 62 +++++++++------- .../protocol/AssetProxy/MixinERC721Transfer.sol | 85 +++++++++++++--------- .../AssetProxy/libs/LibAssetProxyErrors.sol | 4 - .../protocol/AssetProxy/libs/LibTransferErrors.sol | 25 +++++++ 5 files changed, 111 insertions(+), 95 deletions(-) create mode 100644 packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibTransferErrors.sol (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol index 2b280add4..7ff25aea3 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol @@ -41,34 +41,4 @@ contract ERC721Proxy is { return PROXY_ID; } - - /// @dev Decodes ERC721 Asset data. - /// @param assetData Encoded byte array. - /// @return proxyId Intended ERC721 proxy id. - /// @return token ERC721 token address. - /// @return tokenId ERC721 token id. - /// @return receiverData Additional data with no specific format, which - /// is passed to the receiving contract's onERC721Received. - function decodeERC721AssetData(bytes memory assetData) - internal - pure - returns ( - address token, - uint256 tokenId, - bytes memory receiverData - ) - { - // Decode asset data. - token = readAddress(assetData, 0); - tokenId = readUint256(assetData, 20); - if (assetData.length > 52) { - receiverData = readBytes(assetData, 52); - } - - return ( - token, - tokenId, - receiverData - ); - } } diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol index b0c32db59..4af39a00b 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC20Transfer.sol @@ -21,50 +21,60 @@ pragma experimental ABIEncoderV2; import "../../utils/LibBytes/LibBytes.sol"; import "../../tokens/ERC20Token/IERC20Token.sol"; +import "./libs/LibTransferErrors.sol"; contract MixinERC20Transfer is - LibBytes + LibBytes, + LibTransferErrors { - // Id of this proxy. - uint8 constant PROXY_ID = 1; - // Revert reasons - string constant INVALID_METADATA_LENGTH = "Metadata must have a length of 21."; - string constant TRANSFER_FAILED = "Transfer failed."; - string constant PROXY_ID_MISMATCH = "Proxy id in metadata does not match this proxy id."; - /// @dev Internal version of `transferFrom`. - /// @param assetMetadata Encoded byte array. + /// @param assetData Encoded byte array. /// @param from Address to transfer asset from. /// @param to Address to transfer asset to. /// @param amount Amount of asset to transfer. function transferFromInternal( - bytes memory assetMetadata, + bytes memory assetData, address from, address to, uint256 amount ) internal { - // Data must be intended for this proxy. - uint256 length = assetMetadata.length; - - require( - length == 21, - INVALID_METADATA_LENGTH - ); + // Decode asset data. + address token = readAddress(assetData, 0); + // Transfer tokens. + // We do a raw call so we can check the success separate + // from the return data. + bool success = token.call(abi.encodeWithSelector( + IERC20Token(token).transferFrom.selector, + from, + to, + amount + )); require( - uint8(assetMetadata[length - 1]) == PROXY_ID, - PROXY_ID_MISMATCH + success, + TRANSFER_FAILED ); - - // Decode metadata. - address token = readAddress(assetMetadata, 0); - - // Transfer tokens. - bool success = IERC20Token(token).transferFrom(from, to, amount); + + // Check return data. + // If there is no return data, we assume the token incorrectly + // does not return a bool. In this case we expect it to revert + // on failure, which was handled above. + // If the token does return data, we require that it is a single + // value that evaluates to true. + assembly { + if returndatasize { + success := 0 + if eq(returndatasize, 32) { + // First 64 bytes of memory are reserved scratch space + returndatacopy(0, 0, 32) + success := mload(0) + } + } + } require( - success == true, + success, TRANSFER_FAILED ); } diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol index bbb807956..d09aba599 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinERC721Transfer.sol @@ -21,59 +21,74 @@ pragma experimental ABIEncoderV2; import "../../utils/LibBytes/LibBytes.sol"; import "../../tokens/ERC721Token/ERC721Token.sol"; +import "./libs/LibTransferErrors.sol"; contract MixinERC721Transfer is - LibBytes + LibBytes, + LibTransferErrors { - - // Id of this proxy. - uint8 constant PROXY_ID = 2; - - // Revert reasons - string constant INVALID_TRANSFER_AMOUNT = "Transfer amount must equal 1."; - string constant INVALID_METADATA_LENGTH = "Metadata must have a length of 53."; - string constant PROXY_ID_MISMATCH = "Proxy id in metadata does not match this proxy id."; - /// @dev Internal version of `transferFrom`. - /// @param assetMetadata Encoded byte array. + /// @param assetData Encoded byte array. /// @param from Address to transfer asset from. /// @param to Address to transfer asset to. /// @param amount Amount of asset to transfer. function transferFromInternal( - bytes memory assetMetadata, + bytes memory assetData, address from, address to, uint256 amount ) internal { - // Data must be intended for this proxy. - uint256 length = assetMetadata.length; - - require( - length == 53, - INVALID_METADATA_LENGTH - ); - - require( - uint8(assetMetadata[length - 1]) == PROXY_ID, - PROXY_ID_MISMATCH - ); - // There exists only 1 of each token. require( amount == 1, - INVALID_TRANSFER_AMOUNT + INVALID_AMOUNT ); + + // Decode asset data. + ( + address token, + uint256 tokenId, + bytes memory receiverData + ) = decodeERC721AssetData(assetData); + + // Transfer token. Saves gas by calling safeTransferFrom only + // when there is receiverData present. Either succeeds or throws. + if (receiverData.length > 0) { + ERC721Token(token).safeTransferFrom(from, to, tokenId, receiverData); + } else { + ERC721Token(token).transferFrom(from, to, tokenId); + } + } - // Decode metadata - address token = readAddress(assetMetadata, 0); - uint256 tokenId = readUint256(assetMetadata, 20); - - // Transfer token. - // Either succeeds or throws. - // @TODO: Call safeTransferFrom if there is additional - // data stored in `assetMetadata`. - ERC721Token(token).transferFrom(from, to, tokenId); + /// @dev Decodes ERC721 Asset data. + /// @param assetData Encoded byte array. + /// @return proxyId Intended ERC721 proxy id. + /// @return token ERC721 token address. + /// @return tokenId ERC721 token id. + /// @return receiverData Additional data with no specific format, which + /// is passed to the receiving contract's onERC721Received. + function decodeERC721AssetData(bytes memory assetData) + internal + pure + returns ( + address token, + uint256 tokenId, + bytes memory receiverData + ) + { + // Decode asset data. + token = readAddress(assetData, 0); + tokenId = readUint256(assetData, 20); + if (assetData.length > 52) { + receiverData = readBytes(assetData, 52); + } + + return ( + token, + tokenId, + receiverData + ); } } diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibAssetProxyErrors.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibAssetProxyErrors.sol index 65bdacdb7..dca4f400f 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibAssetProxyErrors.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibAssetProxyErrors.sol @@ -25,8 +25,4 @@ contract LibAssetProxyErrors { string constant TARGET_ALREADY_AUTHORIZED = "TARGET_ALREADY_AUTHORIZED"; // Target address must not already be authorized. string constant INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; // Specified array index is out of bounds. string constant AUTHORIZED_ADDRESS_MISMATCH = "AUTHORIZED_ADDRESS_MISMATCH"; // Address at index does not match given target address. - - /// AssetProxy errors /// - string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1. - string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed. } diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibTransferErrors.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibTransferErrors.sol new file mode 100644 index 000000000..ba784ab22 --- /dev/null +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/libs/LibTransferErrors.sol @@ -0,0 +1,25 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.24; + +contract LibTransferErrors { + /// Transfer errors /// + string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1. + string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed. +} -- cgit v1.2.3 From 8fd9aebcb944a46de37d278041e1d2aceeaf8427 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 16 Jun 2018 19:09:39 -0700 Subject: Make batchFill methods return FIllResults struct --- .../protocol/Exchange/MixinWrapperFunctions.sol | 21 ++++++++++++++++++--- .../Exchange/interfaces/IWrapperFunctions.sol | 17 ++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol index a7849f4cb..724f95518 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol @@ -263,40 +263,50 @@ contract MixinWrapperFunctions is /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. + /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets. function batchFillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public + returns (FillResults memory totalFillResults) { for (uint256 i = 0; i < orders.length; i++) { - fillOrder( + FillResults memory singleFillResults = fillOrder( orders[i], takerAssetFillAmounts[i], signatures[i] ); + addFillResults(totalFillResults, singleFillResults); } + return totalFillResults; } /// @dev Synchronously executes multiple calls of fillOrKill. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. + /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets. function batchFillOrKillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public + returns (FillResults memory totalFillResults) { for (uint256 i = 0; i < orders.length; i++) { - fillOrKillOrder( + FillResults memory singleFillResults = fillOrKillOrder( orders[i], takerAssetFillAmounts[i], signatures[i] ); + addFillResults(totalFillResults, singleFillResults); } + return totalFillResults; } /// @dev Fills an order with specified parameters and ECDSA signature. @@ -304,20 +314,25 @@ contract MixinWrapperFunctions is /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. + /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets. function batchFillOrdersNoThrow( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) public + returns (FillResults memory totalFillResults) { for (uint256 i = 0; i < orders.length; i++) { - fillOrderNoThrow( + FillResults memory singleFillResults = fillOrderNoThrow( orders[i], takerAssetFillAmounts[i], signatures[i] ); + addFillResults(totalFillResults, singleFillResults); } + return totalFillResults; } /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol index acd4f359c..84bb683bc 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWrapperFunctions.sol @@ -22,10 +22,7 @@ pragma experimental ABIEncoderV2; import "../libs/LibOrder.sol"; import "../libs/LibFillResults.sol"; -contract IWrapperFunctions is - LibOrder, - LibFillResults -{ +contract IWrapperFunctions { /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled. /// @param order LibOrder.Order struct containing order specifications. /// @param takerAssetFillAmount Desired amount of takerAsset to sell. @@ -56,35 +53,41 @@ contract IWrapperFunctions is /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. function batchFillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) - public; + public + returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrKill. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. function batchFillOrKillOrders( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) - public; + public + returns (LibFillResults.FillResults memory totalFillResults); /// @dev Fills an order with specified parameters and ECDSA signature. /// Returns false if the transaction would otherwise revert. /// @param orders Array of order specifications. /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders. /// @param signatures Proofs that orders have been created by makers. + /// @return Amounts filled and fees paid by makers and taker. function batchFillOrdersNoThrow( LibOrder.Order[] memory orders, uint256[] memory takerAssetFillAmounts, bytes[] memory signatures ) - public; + public + returns (LibFillResults.FillResults memory totalFillResults); /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. /// @param orders Array of order specifications. -- cgit v1.2.3 From 9e431df848ab16b830315ff3aa4ee05af2a23a7f Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 17 Jun 2018 13:35:45 -0700 Subject: Make isValidSignature public --- .../current/protocol/Exchange/MixinSignatureValidator.sol | 2 +- .../protocol/Exchange/interfaces/ISignatureValidator.sol | 14 ++++++++++++++ .../protocol/Exchange/mixins/MSignatureValidator.sol | 14 -------------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol index 1a556dfe2..8ad15aaff 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol @@ -82,7 +82,7 @@ contract MixinSignatureValidator is address signer, bytes memory signature ) - internal + public view returns (bool isValid) { diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISignatureValidator.sol index 26e360c91..02aa9776e 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISignatureValidator.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISignatureValidator.sol @@ -39,4 +39,18 @@ contract ISignatureValidator { bool approval ) external; + + /// @dev Verifies that a signature is valid. + /// @param hash Message hash that is signed. + /// @param signer Address of signer. + /// @param signature Proof of signing. + /// @return Validity of order signature. + function isValidSignature( + bytes32 hash, + address signer, + bytes memory signature + ) + public + view + returns (bool isValid); } diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSignatureValidator.sol index 7eed453ff..5e286e43a 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSignatureValidator.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/mixins/MSignatureValidator.sol @@ -35,18 +35,4 @@ contract MSignatureValidator is PreSigned, // 0x07 Trezor // 0x08 } - - /// @dev Verifies that a signature is valid. - /// @param hash Message hash that is signed. - /// @param signer Address of signer. - /// @param signature Proof of signing. - /// @return Validity of order signature. - function isValidSignature( - bytes32 hash, - address signer, - bytes memory signature - ) - internal - view - returns (bool isValid); } -- cgit v1.2.3 From f2e0f1b2f180a783c1676120218712f50f4f93d7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 19 Jun 2018 11:32:55 +0200 Subject: Update all package versions to match latest published to NPM --- packages/contracts/package.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 2495795dc..272bdcad9 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.29", + "version": "2.1.33", "engines": { "node": ">=6.12" }, @@ -46,11 +46,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^0.3.0", - "@0xproject/dev-utils": "^0.4.2", - "@0xproject/tslint-config": "^0.4.18", + "@0xproject/abi-gen": "^0.3.2", + "@0xproject/dev-utils": "^0.4.4", + "@0xproject/tslint-config": "^0.4.20", "@0xproject/subproviders": "^0.10.1", - "@0xproject/sol-cov": "^0.0.11", + "@0xproject/sol-cov": "^0.1.1", "@types/lodash": "4.14.104", "@types/bn.js": "^4.11.0", "@types/node": "^8.0.53", @@ -71,18 +71,18 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^0.3.2", + "@0xproject/base-contract": "^0.3.4", "@0xproject/order-utils": "^0.0.6", - "@0xproject/sol-compiler": "^0.5.0", + "@0xproject/sol-compiler": "^0.5.2", "@0xproject/types": "^1.0.0", - "@0xproject/typescript-typings": "^0.3.2", - "@0xproject/utils": "^0.6.2", - "@0xproject/web3-wrapper": "^0.6.4", + "@0xproject/typescript-typings": "^0.4.1", + "@0xproject/utils": "^0.7.1", + "@0xproject/web3-wrapper": "^0.7.1", "ethereum-types": "^0.0.1", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-util": "^5.1.1", - "ethers": "^3.0.15", + "ethers": "3.0.22", "lodash": "^4.17.4", "web3": "^0.20.0" } -- cgit v1.2.3 From a96abe24227b54b7a038278c432b7bf8a70c22a4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 19 Jun 2018 12:32:43 +0200 Subject: Fix additional versions and update yarn.lock --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/contracts') diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 272bdcad9..8807c727e 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -72,7 +72,7 @@ }, "dependencies": { "@0xproject/base-contract": "^0.3.4", - "@0xproject/order-utils": "^0.0.6", + "@0xproject/order-utils": "^1.0.0", "@0xproject/sol-compiler": "^0.5.2", "@0xproject/types": "^1.0.0", "@0xproject/typescript-typings": "^0.4.1", -- cgit v1.2.3