diff --git a/contracts/zero-ex/CHANGELOG.json b/contracts/zero-ex/CHANGELOG.json index 751721a50c..f38fbe5ac2 100644 --- a/contracts/zero-ex/CHANGELOG.json +++ b/contracts/zero-ex/CHANGELOG.json @@ -29,6 +29,18 @@ { "note": "Add `LogMetadataTransformer`", "pr": 2657 + }, + { + "note": "Add `IUniswapV2Feature`", + "pr": "TODO" + }, + { + "note": "Rename all feature contracts to have `Feature` suffix", + "pr": "TODO" + }, + { + "note": "Return `IZeroExContract` in `fullMigrateAsync()`", + "pr": "TODO" } ] }, diff --git a/contracts/zero-ex/contracts/src/IZeroEx.sol b/contracts/zero-ex/contracts/src/IZeroEx.sol index c1ccfb28e3..62a8f832f8 100644 --- a/contracts/zero-ex/contracts/src/IZeroEx.sol +++ b/contracts/zero-ex/contracts/src/IZeroEx.sol @@ -19,22 +19,22 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; -import "./features/IOwnable.sol"; -import "./features/ISimpleFunctionRegistry.sol"; -import "./features/ITokenSpender.sol"; -import "./features/ISignatureValidator.sol"; -import "./features/ITransformERC20.sol"; -import "./features/IMetaTransactions.sol"; +import "./features/IOwnableFeature.sol"; +import "./features/ISimpleFunctionRegistryFeature.sol"; +import "./features/ITokenSpenderFeature.sol"; +import "./features/ISignatureValidatorFeature.sol"; +import "./features/ITransformERC20Feature.sol"; +import "./features/IMetaTransactionsFeature.sol"; /// @dev Interface for a fully featured Exchange Proxy. interface IZeroEx is - IOwnable, - ISimpleFunctionRegistry, - ITokenSpender, - ISignatureValidator, - ITransformERC20, - IMetaTransactions + IOwnableFeature, + ISimpleFunctionRegistryFeature, + ITokenSpenderFeature, + ISignatureValidatorFeature, + ITransformERC20Feature, + IMetaTransactionsFeature { // solhint-disable state-visibility diff --git a/contracts/zero-ex/contracts/src/ZeroEx.sol b/contracts/zero-ex/contracts/src/ZeroEx.sol index 16a1b9fcd0..a18d762a93 100644 --- a/contracts/zero-ex/contracts/src/ZeroEx.sol +++ b/contracts/zero-ex/contracts/src/ZeroEx.sol @@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol"; import "./migrations/LibBootstrap.sol"; -import "./features/Bootstrap.sol"; +import "./features/BootstrapFeature.sol"; import "./storage/LibProxyStorage.sol"; import "./errors/LibProxyRichErrors.sol"; @@ -32,14 +32,14 @@ contract ZeroEx { // solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase using LibBytesV06 for bytes; - /// @dev Construct this contract and register the `Bootstrap` feature. + /// @dev Construct this contract and register the `BootstrapFeature` feature. /// After constructing this contract, `bootstrap()` should be called /// by `bootstrap()` to seed the initial feature set. /// @param bootstrapper Who can call `bootstrap()`. constructor(address bootstrapper) public { // Temporarily create and register the bootstrap feature. // It will deregister itself after `bootstrap()` has been called. - Bootstrap bootstrap = new Bootstrap(bootstrapper); + BootstrapFeature bootstrap = new BootstrapFeature(bootstrapper); LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] = address(bootstrap); } diff --git a/contracts/zero-ex/contracts/src/features/Bootstrap.sol b/contracts/zero-ex/contracts/src/features/BootstrapFeature.sol similarity index 95% rename from contracts/zero-ex/contracts/src/features/Bootstrap.sol rename to contracts/zero-ex/contracts/src/features/BootstrapFeature.sol index 14d2e9fe48..aa4d484e3e 100644 --- a/contracts/zero-ex/contracts/src/features/Bootstrap.sol +++ b/contracts/zero-ex/contracts/src/features/BootstrapFeature.sol @@ -22,12 +22,12 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol"; import "../migrations/LibBootstrap.sol"; import "../storage/LibProxyStorage.sol"; -import "./IBootstrap.sol"; +import "./IBootstrapFeature.sol"; /// @dev Detachable `bootstrap()` feature. -contract Bootstrap is - IBootstrap +contract BootstrapFeature is + IBootstrapFeature { // solhint-disable state-visibility,indent /// @dev The ZeroEx contract. @@ -69,7 +69,7 @@ contract Bootstrap is // Deregister. LibProxyStorage.getStorage().impls[this.bootstrap.selector] = address(0); // Self-destruct. - Bootstrap(_implementation).die(); + BootstrapFeature(_implementation).die(); // Call the bootstrapper. LibBootstrap.delegatecallBootstrapFunction(target, callData); } diff --git a/contracts/zero-ex/contracts/src/features/IBootstrap.sol b/contracts/zero-ex/contracts/src/features/IBootstrapFeature.sol similarity index 97% rename from contracts/zero-ex/contracts/src/features/IBootstrap.sol rename to contracts/zero-ex/contracts/src/features/IBootstrapFeature.sol index ba7e9724cc..f9a26116c5 100644 --- a/contracts/zero-ex/contracts/src/features/IBootstrap.sol +++ b/contracts/zero-ex/contracts/src/features/IBootstrapFeature.sol @@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2; /// @dev Detachable `bootstrap()` feature. -interface IBootstrap { +interface IBootstrapFeature { /// @dev Bootstrap the initial feature set of this contract by delegatecalling /// into `target`. Before exiting the `bootstrap()` function will diff --git a/contracts/zero-ex/contracts/src/features/IMetaTransactions.sol b/contracts/zero-ex/contracts/src/features/IMetaTransactionsFeature.sol similarity index 99% rename from contracts/zero-ex/contracts/src/features/IMetaTransactions.sol rename to contracts/zero-ex/contracts/src/features/IMetaTransactionsFeature.sol index 0c9f4e4b9a..ceb14e2d36 100644 --- a/contracts/zero-ex/contracts/src/features/IMetaTransactions.sol +++ b/contracts/zero-ex/contracts/src/features/IMetaTransactionsFeature.sol @@ -23,7 +23,7 @@ import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; /// @dev Meta-transactions feature. -interface IMetaTransactions { +interface IMetaTransactionsFeature { /// @dev Describes an exchange proxy meta transaction. struct MetaTransactionData { diff --git a/contracts/zero-ex/contracts/src/features/IOwnable.sol b/contracts/zero-ex/contracts/src/features/IOwnableFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/IOwnable.sol rename to contracts/zero-ex/contracts/src/features/IOwnableFeature.sol index a15dcf3625..f2cdc278af 100644 --- a/contracts/zero-ex/contracts/src/features/IOwnable.sol +++ b/contracts/zero-ex/contracts/src/features/IOwnableFeature.sol @@ -24,7 +24,7 @@ import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol"; // solhint-disable no-empty-blocks /// @dev Owner management and migration features. -interface IOwnable is +interface IOwnableFeature is IOwnableV06 { /// @dev Emitted when `migrate()` is called. diff --git a/contracts/zero-ex/contracts/src/features/ISignatureValidator.sol b/contracts/zero-ex/contracts/src/features/ISignatureValidatorFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/ISignatureValidator.sol rename to contracts/zero-ex/contracts/src/features/ISignatureValidatorFeature.sol index 121e27c033..528deb99b7 100644 --- a/contracts/zero-ex/contracts/src/features/ISignatureValidator.sol +++ b/contracts/zero-ex/contracts/src/features/ISignatureValidatorFeature.sol @@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2; /// @dev Feature for validating signatures. -interface ISignatureValidator { +interface ISignatureValidatorFeature { /// @dev Allowed signature types. enum SignatureType { diff --git a/contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistry.sol b/contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistryFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistry.sol rename to contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistryFeature.sol index 6aabc17889..1e5ef61c25 100644 --- a/contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistry.sol +++ b/contracts/zero-ex/contracts/src/features/ISimpleFunctionRegistryFeature.sol @@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2; /// @dev Basic registry management features. -interface ISimpleFunctionRegistry { +interface ISimpleFunctionRegistryFeature { /// @dev A function implementation was updated via `extend()` or `rollback()`. /// @param selector The function selector. diff --git a/contracts/zero-ex/contracts/src/features/ITokenSpender.sol b/contracts/zero-ex/contracts/src/features/ITokenSpenderFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/ITokenSpender.sol rename to contracts/zero-ex/contracts/src/features/ITokenSpenderFeature.sol index 8e6128cd5e..0c3fc44f1d 100644 --- a/contracts/zero-ex/contracts/src/features/ITokenSpender.sol +++ b/contracts/zero-ex/contracts/src/features/ITokenSpenderFeature.sol @@ -23,7 +23,7 @@ import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; /// @dev Feature that allows spending token allowances. -interface ITokenSpender { +interface ITokenSpenderFeature { /// @dev Transfers ERC20 tokens from `owner` to `to`. /// Only callable from within. diff --git a/contracts/zero-ex/contracts/src/features/ITransformERC20.sol b/contracts/zero-ex/contracts/src/features/ITransformERC20Feature.sol similarity index 99% rename from contracts/zero-ex/contracts/src/features/ITransformERC20.sol rename to contracts/zero-ex/contracts/src/features/ITransformERC20Feature.sol index b9a8894219..89a8f8e41f 100644 --- a/contracts/zero-ex/contracts/src/features/ITransformERC20.sol +++ b/contracts/zero-ex/contracts/src/features/ITransformERC20Feature.sol @@ -25,7 +25,7 @@ import "../external/IFlashWallet.sol"; /// @dev Feature to composably transform between ERC20 tokens. -interface ITransformERC20 { +interface ITransformERC20Feature { /// @dev Defines a transformation to run in `transformERC20()`. struct Transformation { diff --git a/contracts/zero-ex/contracts/src/features/IUniswapV2Feature.sol b/contracts/zero-ex/contracts/src/features/IUniswapV2Feature.sol new file mode 100644 index 0000000000..eaab9e3ed5 --- /dev/null +++ b/contracts/zero-ex/contracts/src/features/IUniswapV2Feature.sol @@ -0,0 +1,49 @@ +/* + + Copyright 2020 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.6.5; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; + + +/// @dev Feature for directly interacting with Uniswap V2 +interface IUniswapV2Feature { + + function sellToUniswapV2( + IERC20TokenV06 inputToken, + IERC20TokenV06 outputToken, + uint256 inputTokenAmount, + uint256 minOutputTokenAmount, + address recipient, + ) + external + payable + returns (uint256 outputTokenAmount); + + function buyFromUniswapV2( + IERC20TokenV06 inputToken, + IERC20TokenV06 outputToken, + uint256 maxInputTokenAmount, + uint256 outputTokenAmount, + address recipient, + ) + external + payable + returns (uint256 inputTokenAmount); +} diff --git a/contracts/zero-ex/contracts/src/features/MetaTransactions.sol b/contracts/zero-ex/contracts/src/features/MetaTransactionsFeature.sol similarity index 94% rename from contracts/zero-ex/contracts/src/features/MetaTransactions.sol rename to contracts/zero-ex/contracts/src/features/MetaTransactionsFeature.sol index c75e645255..bd6e40b1c5 100644 --- a/contracts/zero-ex/contracts/src/features/MetaTransactions.sol +++ b/contracts/zero-ex/contracts/src/features/MetaTransactionsFeature.sol @@ -29,17 +29,17 @@ import "../fixins/FixinEIP712.sol"; import "../migrations/LibMigrate.sol"; import "../storage/LibMetaTransactionsStorage.sol"; import "./libs/LibSignedCallData.sol"; -import "./IMetaTransactions.sol"; -import "./ITransformERC20.sol"; -import "./ISignatureValidator.sol"; -import "./ITokenSpender.sol"; +import "./IMetaTransactionsFeature.sol"; +import "./ITransformERC20Feature.sol"; +import "./ISignatureValidatorFeature.sol"; +import "./ITokenSpenderFeature.sol"; import "./IFeature.sol"; /// @dev MetaTransactions feature. -contract MetaTransactions is +contract MetaTransactionsFeature is IFeature, - IMetaTransactions, + IMetaTransactionsFeature, FixinCommon, FixinReentrancyGuard, FixinEIP712 @@ -72,7 +72,7 @@ contract MetaTransactions is IERC20TokenV06 outputToken; uint256 inputTokenAmount; uint256 minOutputTokenAmount; - ITransformERC20.Transformation[] transformations; + ITransformERC20Feature.Transformation[] transformations; } /// @dev Name of this feature. @@ -279,7 +279,7 @@ contract MetaTransactions is // Pay the fee to the sender. if (mtx.feeAmount > 0) { - ITokenSpender(address(this))._spendERC20Tokens( + ITokenSpenderFeature(address(this))._spendERC20Tokens( mtx.feeToken, mtx.signer, // From the signer. sender, // To the sender. @@ -289,7 +289,7 @@ contract MetaTransactions is // Execute the call based on the selector. state.selector = mtx.callData.readBytes4(0); - if (state.selector == ITransformERC20.transformERC20.selector) { + if (state.selector == ITransformERC20Feature.transformERC20.selector) { returnResult = _executeTransformERC20Call(state); } else { LibMetaTransactionsRichErrors @@ -349,7 +349,7 @@ contract MetaTransactions is } // Must be signed by signer. try - ISignatureValidator(address(this)) + ISignatureValidatorFeature(address(this)) .validateHashSignature(state.hash, state.mtx.signer, state.signature) {} catch (bytes memory err) { @@ -372,9 +372,9 @@ contract MetaTransactions is } } - /// @dev Execute a `ITransformERC20.transformERC20()` meta-transaction call + /// @dev Execute a `ITransformERC20Feature.transformERC20()` meta-transaction call /// by decoding the call args and translating the call to the internal - /// `ITransformERC20._transformERC20()` variant, where we can override + /// `ITransformERC20Feature._transformERC20()` variant, where we can override /// the taker address. function _executeTransformERC20Call(ExecuteState memory state) private @@ -426,19 +426,19 @@ contract MetaTransactions is toMem := add(encodedStructArgs, 64) } LibBytesV06.memCopy(toMem, fromMem, fromCallData.length - 4); - // Decode call args for `ITransformERC20.transformERC20()` as a struct. + // Decode call args for `ITransformERC20Feature.transformERC20()` as a struct. args = abi.decode(encodedStructArgs, (ExternalTransformERC20Args)); } // Parse the signature and hash out of the calldata so `_transformERC20()` // can authenticate it. (bytes32 callDataHash, bytes memory callDataSignature) = LibSignedCallData.parseCallData(state.mtx.callData); - // Call `ITransformERC20._transformERC20()` (internal variant). + // Call `ITransformERC20Feature._transformERC20()` (internal variant). return _callSelf( state.hash, abi.encodeWithSelector( - ITransformERC20._transformERC20.selector, - ITransformERC20.TransformERC20Args({ + ITransformERC20Feature._transformERC20.selector, + ITransformERC20Feature.TransformERC20Args({ taker: state.mtx.signer, // taker is mtx signer inputToken: args.inputToken, outputToken: args.outputToken, diff --git a/contracts/zero-ex/contracts/src/features/Ownable.sol b/contracts/zero-ex/contracts/src/features/OwnableFeature.sol similarity index 89% rename from contracts/zero-ex/contracts/src/features/Ownable.sol rename to contracts/zero-ex/contracts/src/features/OwnableFeature.sol index 2d75780b78..29502eeb8c 100644 --- a/contracts/zero-ex/contracts/src/features/Ownable.sol +++ b/contracts/zero-ex/contracts/src/features/OwnableFeature.sol @@ -26,14 +26,14 @@ import "../storage/LibOwnableStorage.sol"; import "../migrations/LibBootstrap.sol"; import "../migrations/LibMigrate.sol"; import "./IFeature.sol"; -import "./IOwnable.sol"; -import "./SimpleFunctionRegistry.sol"; +import "./IOwnableFeature.sol"; +import "./SimpleFunctionRegistryFeature.sol"; /// @dev Owner management features. -contract Ownable is +contract OwnableFeature is IFeature, - IOwnable, + IOwnableFeature, FixinCommon { @@ -54,9 +54,9 @@ contract Ownable is LibOwnableStorage.getStorage().owner = address(this); // Register feature functions. - SimpleFunctionRegistry(address(this))._extendSelf(this.transferOwnership.selector, _implementation); - SimpleFunctionRegistry(address(this))._extendSelf(this.owner.selector, _implementation); - SimpleFunctionRegistry(address(this))._extendSelf(this.migrate.selector, _implementation); + SimpleFunctionRegistryFeature(address(this))._extendSelf(this.transferOwnership.selector, _implementation); + SimpleFunctionRegistryFeature(address(this))._extendSelf(this.owner.selector, _implementation); + SimpleFunctionRegistryFeature(address(this))._extendSelf(this.migrate.selector, _implementation); return LibBootstrap.BOOTSTRAP_SUCCESS; } diff --git a/contracts/zero-ex/contracts/src/features/SignatureValidator.sol b/contracts/zero-ex/contracts/src/features/SignatureValidatorFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/SignatureValidator.sol rename to contracts/zero-ex/contracts/src/features/SignatureValidatorFeature.sol index 13636807de..cea91baacc 100644 --- a/contracts/zero-ex/contracts/src/features/SignatureValidator.sol +++ b/contracts/zero-ex/contracts/src/features/SignatureValidatorFeature.sol @@ -24,14 +24,14 @@ import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol"; import "../errors/LibSignatureRichErrors.sol"; import "../fixins/FixinCommon.sol"; import "../migrations/LibMigrate.sol"; -import "./ISignatureValidator.sol"; +import "./ISignatureValidatorFeature.sol"; import "./IFeature.sol"; /// @dev Feature for validating signatures. -contract SignatureValidator is +contract SignatureValidatorFeature is IFeature, - ISignatureValidator, + ISignatureValidatorFeature, FixinCommon { using LibBytesV06 for bytes; diff --git a/contracts/zero-ex/contracts/src/features/SimpleFunctionRegistry.sol b/contracts/zero-ex/contracts/src/features/SimpleFunctionRegistryFeature.sol similarity index 98% rename from contracts/zero-ex/contracts/src/features/SimpleFunctionRegistry.sol rename to contracts/zero-ex/contracts/src/features/SimpleFunctionRegistryFeature.sol index 5c73c8da7f..ac98b64dc7 100644 --- a/contracts/zero-ex/contracts/src/features/SimpleFunctionRegistry.sol +++ b/contracts/zero-ex/contracts/src/features/SimpleFunctionRegistryFeature.sol @@ -26,13 +26,13 @@ import "../storage/LibSimpleFunctionRegistryStorage.sol"; import "../errors/LibSimpleFunctionRegistryRichErrors.sol"; import "../migrations/LibBootstrap.sol"; import "./IFeature.sol"; -import "./ISimpleFunctionRegistry.sol"; +import "./ISimpleFunctionRegistryFeature.sol"; /// @dev Basic registry management features. -contract SimpleFunctionRegistry is +contract SimpleFunctionRegistryFeature is IFeature, - ISimpleFunctionRegistry, + ISimpleFunctionRegistryFeature, FixinCommon { /// @dev Name of this feature. diff --git a/contracts/zero-ex/contracts/src/features/TokenSpender.sol b/contracts/zero-ex/contracts/src/features/TokenSpenderFeature.sol similarity index 97% rename from contracts/zero-ex/contracts/src/features/TokenSpender.sol rename to contracts/zero-ex/contracts/src/features/TokenSpenderFeature.sol index 14a2509d03..1b12a45d46 100644 --- a/contracts/zero-ex/contracts/src/features/TokenSpender.sol +++ b/contracts/zero-ex/contracts/src/features/TokenSpenderFeature.sol @@ -28,15 +28,14 @@ import "../fixins/FixinCommon.sol"; import "../migrations/LibMigrate.sol"; import "../external/IAllowanceTarget.sol"; import "../storage/LibTokenSpenderStorage.sol"; -import "./ITokenSpender.sol"; +import "./ITokenSpenderFeature.sol"; import "./IFeature.sol"; -import "./ISimpleFunctionRegistry.sol"; /// @dev Feature that allows spending token allowances. -contract TokenSpender is +contract TokenSpenderFeature is IFeature, - ITokenSpender, + ITokenSpenderFeature, FixinCommon { // solhint-disable diff --git a/contracts/zero-ex/contracts/src/features/TransformERC20.sol b/contracts/zero-ex/contracts/src/features/TransformERC20Feature.sol similarity index 97% rename from contracts/zero-ex/contracts/src/features/TransformERC20.sol rename to contracts/zero-ex/contracts/src/features/TransformERC20Feature.sol index a1a2466d09..f203a59d3e 100644 --- a/contracts/zero-ex/contracts/src/features/TransformERC20.sol +++ b/contracts/zero-ex/contracts/src/features/TransformERC20Feature.sol @@ -32,17 +32,16 @@ import "../storage/LibTransformERC20Storage.sol"; import "../transformers/IERC20Transformer.sol"; import "../transformers/LibERC20Transformer.sol"; import "./libs/LibSignedCallData.sol"; -import "./ITransformERC20.sol"; -import "./ITokenSpender.sol"; +import "./ITransformERC20Feature.sol"; +import "./ITokenSpenderFeature.sol"; import "./IFeature.sol"; -import "./ISignatureValidator.sol"; -import "./ISimpleFunctionRegistry.sol"; +import "./ISignatureValidatorFeature.sol"; /// @dev Feature to composably transform between ERC20 tokens. -contract TransformERC20 is +contract TransformERC20Feature is IFeature, - ITransformERC20, + ITransformERC20Feature, FixinCommon { using LibSafeMathV06 for uint256; @@ -209,7 +208,7 @@ contract TransformERC20 is // If the input token amount is -1, transform the taker's entire // spendable balance. if (args.inputTokenAmount == uint256(-1)) { - args.inputTokenAmount = ITokenSpender(address(this)) + args.inputTokenAmount = ITokenSpenderFeature(address(this)) .getSpendableERC20BalanceOf(args.inputToken, args.taker); } @@ -313,7 +312,7 @@ contract TransformERC20 is // Transfer input tokens. if (!LibERC20Transformer.isTokenETH(inputToken)) { // Token is not ETH, so pull ERC20 tokens. - ITokenSpender(address(this))._spendERC20Tokens( + ITokenSpenderFeature(address(this))._spendERC20Tokens( inputToken, from, to, @@ -391,7 +390,7 @@ contract TransformERC20 is return bytes32(0); } - if (ISignatureValidator(address(this)).isValidHashSignature( + if (ISignatureValidatorFeature(address(this)).isValidHashSignature( callDataHash, getQuoteSigner(), signature diff --git a/contracts/zero-ex/contracts/src/fixins/FixinCommon.sol b/contracts/zero-ex/contracts/src/fixins/FixinCommon.sol index 46a0c0eaf0..37ef41d652 100644 --- a/contracts/zero-ex/contracts/src/fixins/FixinCommon.sol +++ b/contracts/zero-ex/contracts/src/fixins/FixinCommon.sol @@ -22,8 +22,8 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol"; import "../errors/LibCommonRichErrors.sol"; import "../errors/LibOwnableRichErrors.sol"; -import "../features/IOwnable.sol"; -import "../features/ISimpleFunctionRegistry.sol"; +import "../features/IOwnableFeature.sol"; +import "../features/ISimpleFunctionRegistryFeature.sol"; /// @dev Common feature utilities. @@ -45,7 +45,7 @@ abstract contract FixinCommon { /// @dev The caller of this function must be the owner. modifier onlyOwner() virtual { { - address owner = IOwnable(address(this)).owner(); + address owner = IOwnableFeature(address(this)).owner(); if (msg.sender != owner) { LibOwnableRichErrors.OnlyOwnerError( msg.sender, @@ -68,7 +68,7 @@ abstract contract FixinCommon { function _registerFeatureFunction(bytes4 selector) internal { - ISimpleFunctionRegistry(address(this)).extend(selector, _implementation); + ISimpleFunctionRegistryFeature(address(this)).extend(selector, _implementation); } /// @dev Encode a feature version as a `uint256`. diff --git a/contracts/zero-ex/contracts/src/fixins/FixinEIP712.sol b/contracts/zero-ex/contracts/src/fixins/FixinEIP712.sol index fac8231066..ea41cd47e1 100644 --- a/contracts/zero-ex/contracts/src/fixins/FixinEIP712.sol +++ b/contracts/zero-ex/contracts/src/fixins/FixinEIP712.sol @@ -22,7 +22,6 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol"; import "../errors/LibCommonRichErrors.sol"; import "../errors/LibOwnableRichErrors.sol"; -import "../features/IOwnable.sol"; /// @dev EIP712 helpers for features. diff --git a/contracts/zero-ex/contracts/src/migrations/FullMigration.sol b/contracts/zero-ex/contracts/src/migrations/FullMigration.sol index 5cefc83643..5127be284d 100644 --- a/contracts/zero-ex/contracts/src/migrations/FullMigration.sol +++ b/contracts/zero-ex/contracts/src/migrations/FullMigration.sol @@ -20,11 +20,11 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; import "../ZeroEx.sol"; -import "../features/IOwnable.sol"; -import "../features/TokenSpender.sol"; -import "../features/TransformERC20.sol"; -import "../features/SignatureValidator.sol"; -import "../features/MetaTransactions.sol"; +import "../features/IOwnableFeature.sol"; +import "../features/TokenSpenderFeature.sol"; +import "../features/TransformERC20Feature.sol"; +import "../features/SignatureValidatorFeature.sol"; +import "../features/MetaTransactionsFeature.sol"; import "../external/AllowanceTarget.sol"; import "./InitialMigration.sol"; @@ -36,12 +36,12 @@ contract FullMigration { /// @dev Features to add the the proxy contract. struct Features { - SimpleFunctionRegistry registry; - Ownable ownable; - TokenSpender tokenSpender; - TransformERC20 transformERC20; - SignatureValidator signatureValidator; - MetaTransactions metaTransactions; + SimpleFunctionRegistryFeature registry; + OwnableFeature ownable; + TokenSpenderFeature tokenSpender; + TransformERC20Feature transformERC20; + SignatureValidatorFeature signatureValidator; + MetaTransactionsFeature metaTransactions; } /// @dev Parameters needed to initialize features. @@ -109,7 +109,7 @@ contract FullMigration { _addFeatures(zeroEx, owner, features, migrateOpts); // Transfer ownership to the real owner. - IOwnable(address(zeroEx)).transferOwnership(owner); + IOwnableFeature(address(zeroEx)).transferOwnership(owner); // Self-destruct. this.die(owner); @@ -142,8 +142,8 @@ contract FullMigration { ) private { - IOwnable ownable = IOwnable(address(zeroEx)); - // TokenSpender + IOwnableFeature ownable = IOwnableFeature(address(zeroEx)); + // TokenSpenderFeature { // Create the allowance target. AllowanceTarget allowanceTarget = new AllowanceTarget(); @@ -155,42 +155,42 @@ contract FullMigration { ownable.migrate( address(features.tokenSpender), abi.encodeWithSelector( - TokenSpender.migrate.selector, + TokenSpenderFeature.migrate.selector, allowanceTarget ), address(this) ); } - // TransformERC20 + // TransformERC20Feature { // Register the feature. ownable.migrate( address(features.transformERC20), abi.encodeWithSelector( - TransformERC20.migrate.selector, + TransformERC20Feature.migrate.selector, migrateOpts.transformerDeployer ), address(this) ); } - // SignatureValidator + // SignatureValidatorFeature { // Register the feature. ownable.migrate( address(features.signatureValidator), abi.encodeWithSelector( - SignatureValidator.migrate.selector + SignatureValidatorFeature.migrate.selector ), address(this) ); } - // MetaTransactions + // MetaTransactionsFeature { // Register the feature. ownable.migrate( address(features.metaTransactions), abi.encodeWithSelector( - MetaTransactions.migrate.selector + MetaTransactionsFeature.migrate.selector ), address(this) ); diff --git a/contracts/zero-ex/contracts/src/migrations/InitialMigration.sol b/contracts/zero-ex/contracts/src/migrations/InitialMigration.sol index 8868a8a08c..7ccdfdb33f 100644 --- a/contracts/zero-ex/contracts/src/migrations/InitialMigration.sol +++ b/contracts/zero-ex/contracts/src/migrations/InitialMigration.sol @@ -20,9 +20,9 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; import "../ZeroEx.sol"; -import "../features/IBootstrap.sol"; -import "../features/SimpleFunctionRegistry.sol"; -import "../features/Ownable.sol"; +import "../features/IBootstrapFeature.sol"; +import "../features/SimpleFunctionRegistryFeature.sol"; +import "../features/OwnableFeature.sol"; import "./LibBootstrap.sol"; @@ -31,8 +31,8 @@ contract InitialMigration { /// @dev Features to bootstrap into the the proxy contract. struct BootstrapFeatures { - SimpleFunctionRegistry registry; - Ownable ownable; + SimpleFunctionRegistryFeature registry; + OwnableFeature ownable; } /// @dev The allowed caller of `initializeZeroEx()`. In production, this would be @@ -70,7 +70,7 @@ contract InitialMigration { require(msg.sender == initializeCaller, "InitialMigration/INVALID_SENDER"); // Bootstrap the initial feature set. - IBootstrap(address(zeroEx)).bootstrap( + IBootstrapFeature(address(zeroEx)).bootstrap( address(this), abi.encodeWithSelector(this.bootstrap.selector, owner, features) ); @@ -99,26 +99,26 @@ contract InitialMigration { LibBootstrap.delegatecallBootstrapFunction( address(features.registry), abi.encodeWithSelector( - SimpleFunctionRegistry.bootstrap.selector + SimpleFunctionRegistryFeature.bootstrap.selector ) ); - // Initialize Ownable. + // Initialize OwnableFeature. LibBootstrap.delegatecallBootstrapFunction( address(features.ownable), abi.encodeWithSelector( - Ownable.bootstrap.selector + OwnableFeature.bootstrap.selector ) ); - // De-register `SimpleFunctionRegistry._extendSelf`. - SimpleFunctionRegistry(address(this)).rollback( - SimpleFunctionRegistry._extendSelf.selector, + // De-register `SimpleFunctionRegistryFeature._extendSelf`. + SimpleFunctionRegistryFeature(address(this)).rollback( + SimpleFunctionRegistryFeature._extendSelf.selector, address(0) ); // Transfer ownership to the real owner. - Ownable(address(this)).transferOwnership(owner); + OwnableFeature(address(this)).transferOwnership(owner); success = LibBootstrap.BOOTSTRAP_SUCCESS; } diff --git a/contracts/zero-ex/contracts/test/TestFullMigration.sol b/contracts/zero-ex/contracts/test/TestFullMigration.sol index 6777af099c..61244812e0 100644 --- a/contracts/zero-ex/contracts/test/TestFullMigration.sol +++ b/contracts/zero-ex/contracts/test/TestFullMigration.sol @@ -20,7 +20,6 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; import "../src/ZeroEx.sol"; -import "../src/features/IBootstrap.sol"; import "../src/migrations/FullMigration.sol"; diff --git a/contracts/zero-ex/contracts/test/TestInitialMigration.sol b/contracts/zero-ex/contracts/test/TestInitialMigration.sol index 2f57d731f5..f6337bc5ed 100644 --- a/contracts/zero-ex/contracts/test/TestInitialMigration.sol +++ b/contracts/zero-ex/contracts/test/TestInitialMigration.sol @@ -20,7 +20,7 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; import "../src/ZeroEx.sol"; -import "../src/features/IBootstrap.sol"; +import "../src/features/IBootstrapFeature.sol"; import "../src/migrations/InitialMigration.sol"; @@ -34,7 +34,7 @@ contract TestInitialMigration is constructor(address deployer) public InitialMigration(deployer) {} function callBootstrap(ZeroEx zeroEx) external { - IBootstrap(address(zeroEx)).bootstrap(address(this), new bytes(0)); + IBootstrapFeature(address(zeroEx)).bootstrap(address(this), new bytes(0)); } function bootstrap(address owner, BootstrapFeatures memory features) @@ -45,7 +45,7 @@ contract TestInitialMigration is success = InitialMigration.bootstrap(owner, features); // Snoop the bootstrap feature contract. bootstrapFeature = ZeroEx(address(uint160(address(this)))) - .getFunctionImplementation(IBootstrap.bootstrap.selector); + .getFunctionImplementation(IBootstrapFeature.bootstrap.selector); } function die(address payable ethRecipient) public override { diff --git a/contracts/zero-ex/contracts/test/TestMetaTransactionsTransformERC20Feature.sol b/contracts/zero-ex/contracts/test/TestMetaTransactionsTransformERC20Feature.sol index 5c7d8f1596..bb31d76187 100644 --- a/contracts/zero-ex/contracts/test/TestMetaTransactionsTransformERC20Feature.sol +++ b/contracts/zero-ex/contracts/test/TestMetaTransactionsTransformERC20Feature.sol @@ -19,12 +19,12 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; -import "../src/features/TransformERC20.sol"; -import "../src/features/IMetaTransactions.sol"; +import "../src/features/TransformERC20Feature.sol"; +import "../src/features/IMetaTransactionsFeature.sol"; contract TestMetaTransactionsTransformERC20Feature is - TransformERC20 + TransformERC20Feature { event TransformERC20Called( address sender, @@ -51,8 +51,8 @@ contract TestMetaTransactionsTransformERC20Feature is if (msg.value == 777) { // Try to reenter `executeMetaTransaction()` - IMetaTransactions(address(this)).executeMetaTransaction( - IMetaTransactions.MetaTransactionData({ + IMetaTransactionsFeature(address(this)).executeMetaTransaction( + IMetaTransactionsFeature.MetaTransactionData({ signer: address(0), sender: address(0), minGasPrice: 0, @@ -70,10 +70,10 @@ contract TestMetaTransactionsTransformERC20Feature is if (msg.value == 888) { // Try to reenter `batchExecuteMetaTransactions()` - IMetaTransactions.MetaTransactionData[] memory mtxs = - new IMetaTransactions.MetaTransactionData[](1); + IMetaTransactionsFeature.MetaTransactionData[] memory mtxs = + new IMetaTransactionsFeature.MetaTransactionData[](1); bytes[] memory signatures = new bytes[](1); - mtxs[0] = IMetaTransactions.MetaTransactionData({ + mtxs[0] = IMetaTransactionsFeature.MetaTransactionData({ signer: address(0), sender: address(0), minGasPrice: 0, @@ -86,7 +86,7 @@ contract TestMetaTransactionsTransformERC20Feature is feeAmount: 0 }); signatures[0] = ""; - IMetaTransactions(address(this)).batchExecuteMetaTransactions( + IMetaTransactionsFeature(address(this)).batchExecuteMetaTransactions( mtxs, signatures ); diff --git a/contracts/zero-ex/contracts/test/TestMigrator.sol b/contracts/zero-ex/contracts/test/TestMigrator.sol index f81a589fd3..db9d68bb84 100644 --- a/contracts/zero-ex/contracts/test/TestMigrator.sol +++ b/contracts/zero-ex/contracts/test/TestMigrator.sol @@ -20,7 +20,7 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; import "../src/migrations/LibMigrate.sol"; -import "../src/features/IOwnable.sol"; +import "../src/features/IOwnableFeature.sol"; contract TestMigrator { @@ -32,7 +32,7 @@ contract TestMigrator { function succeedingMigrate() external returns (bytes4 success) { emit TestMigrateCalled( msg.data, - IOwnable(address(this)).owner() + IOwnableFeature(address(this)).owner() ); return LibMigrate.MIGRATE_SUCCESS; } @@ -40,7 +40,7 @@ contract TestMigrator { function failingMigrate() external returns (bytes4 success) { emit TestMigrateCalled( msg.data, - IOwnable(address(this)).owner() + IOwnableFeature(address(this)).owner() ); return 0xdeadbeef; } diff --git a/contracts/zero-ex/contracts/test/TestTokenSpender.sol b/contracts/zero-ex/contracts/test/TestTokenSpender.sol index 8213b0d503..8c64a6503c 100644 --- a/contracts/zero-ex/contracts/test/TestTokenSpender.sol +++ b/contracts/zero-ex/contracts/test/TestTokenSpender.sol @@ -19,10 +19,10 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; -import "../src/features/TokenSpender.sol"; +import "../src/features/TokenSpenderFeature.sol"; contract TestTokenSpender is - TokenSpender + TokenSpenderFeature { modifier onlySelf() override { _; diff --git a/contracts/zero-ex/contracts/test/TestTransformERC20.sol b/contracts/zero-ex/contracts/test/TestTransformERC20.sol index 0e133d81d1..6afc5f0dbe 100644 --- a/contracts/zero-ex/contracts/test/TestTransformERC20.sol +++ b/contracts/zero-ex/contracts/test/TestTransformERC20.sol @@ -19,18 +19,12 @@ pragma solidity ^0.6.5; pragma experimental ABIEncoderV2; -import "../src/features/TransformERC20.sol"; +import "../src/features/TransformERC20Feature.sol"; contract TestTransformERC20 is - TransformERC20 + TransformERC20Feature { - // solhint-disable no-empty-blocks - constructor() - TransformERC20() - public - {} - modifier onlySelf() override { _; } diff --git a/contracts/zero-ex/package.json b/contracts/zero-ex/package.json index a962fe51b7..9a35bc0407 100644 --- a/contracts/zero-ex/package.json +++ b/contracts/zero-ex/package.json @@ -39,9 +39,9 @@ "publish:private": "yarn build && gitpkg publish" }, "config": { - "publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnable,ISimpleFunctionRegistry,ITokenSpender,ITransformERC20,FillQuoteTransformer,PayTakerTransformer,WethTransformer,Ownable,SimpleFunctionRegistry,TransformERC20,TokenSpender,AffiliateFeeTransformer,SignatureValidator,MetaTransactions,LogMetadataTransformer,BridgeAdapter", + "publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITokenSpenderFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,TokenSpenderFeature,AffiliateFeeTransformer,SignatureValidatorFeature,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.", - "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|Bootstrap|BridgeAdapter|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrap|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|IMetaTransactions|IOwnable|ISignatureValidator|ISimpleFunctionRegistry|ITestSimpleFunctionRegistryFeature|ITokenSpender|ITransformERC20|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LogMetadataTransformer|MetaTransactions|MixinAdapterAddresses|MixinBalancer|MixinCurve|MixinKyber|MixinMStable|MixinOasis|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|Ownable|PayTakerTransformer|SignatureValidator|SimpleFunctionRegistry|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpender|TransformERC20|Transformer|TransformerDeployer|WethTransformer|ZeroEx).json" + "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|BootstrapFeature|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinGasToken|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrapFeature|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|IMetaTransactionsFeature|IOwnableFeature|ISignatureValidatorFeature|ISimpleFunctionRegistryFeature|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapV2Feature|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LogMetadataTransformer|MetaTransactionsFeature|OwnableFeature|PayTakerTransformer|SignatureValidatorFeature|SimpleFunctionRegistryFeature|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpenderFeature|TransformERC20Feature|Transformer|TransformerDeployer|WethTransformer|ZeroEx).json" }, "repository": { "type": "git", diff --git a/contracts/zero-ex/src/artifacts.ts b/contracts/zero-ex/src/artifacts.ts index 2a71e7a2fd..b51add69e6 100644 --- a/contracts/zero-ex/src/artifacts.ts +++ b/contracts/zero-ex/src/artifacts.ts @@ -13,19 +13,19 @@ import * as IAllowanceTarget from '../generated-artifacts/IAllowanceTarget.json' import * as IERC20Transformer from '../generated-artifacts/IERC20Transformer.json'; import * as IFlashWallet from '../generated-artifacts/IFlashWallet.json'; import * as InitialMigration from '../generated-artifacts/InitialMigration.json'; -import * as IOwnable from '../generated-artifacts/IOwnable.json'; -import * as ISimpleFunctionRegistry from '../generated-artifacts/ISimpleFunctionRegistry.json'; -import * as ITokenSpender from '../generated-artifacts/ITokenSpender.json'; -import * as ITransformERC20 from '../generated-artifacts/ITransformERC20.json'; +import * as IOwnableFeature from '../generated-artifacts/IOwnableFeature.json'; +import * as ISimpleFunctionRegistryFeature from '../generated-artifacts/ISimpleFunctionRegistryFeature.json'; +import * as ITokenSpenderFeature from '../generated-artifacts/ITokenSpenderFeature.json'; +import * as ITransformERC20Feature from '../generated-artifacts/ITransformERC20Feature.json'; import * as IZeroEx from '../generated-artifacts/IZeroEx.json'; import * as LogMetadataTransformer from '../generated-artifacts/LogMetadataTransformer.json'; -import * as MetaTransactions from '../generated-artifacts/MetaTransactions.json'; -import * as Ownable from '../generated-artifacts/Ownable.json'; +import * as MetaTransactionsFeature from '../generated-artifacts/MetaTransactionsFeature.json'; +import * as OwnableFeature from '../generated-artifacts/OwnableFeature.json'; import * as PayTakerTransformer from '../generated-artifacts/PayTakerTransformer.json'; -import * as SignatureValidator from '../generated-artifacts/SignatureValidator.json'; -import * as SimpleFunctionRegistry from '../generated-artifacts/SimpleFunctionRegistry.json'; -import * as TokenSpender from '../generated-artifacts/TokenSpender.json'; -import * as TransformERC20 from '../generated-artifacts/TransformERC20.json'; +import * as SignatureValidatorFeature from '../generated-artifacts/SignatureValidatorFeature.json'; +import * as SimpleFunctionRegistryFeature from '../generated-artifacts/SimpleFunctionRegistryFeature.json'; +import * as TokenSpenderFeature from '../generated-artifacts/TokenSpenderFeature.json'; +import * as TransformERC20Feature from '../generated-artifacts/TransformERC20Feature.json'; import * as WethTransformer from '../generated-artifacts/WethTransformer.json'; import * as ZeroEx from '../generated-artifacts/ZeroEx.json'; export const artifacts = { @@ -36,20 +36,20 @@ export const artifacts = { IFlashWallet: IFlashWallet as ContractArtifact, IAllowanceTarget: IAllowanceTarget as ContractArtifact, IERC20Transformer: IERC20Transformer as ContractArtifact, - IOwnable: IOwnable as ContractArtifact, - ISimpleFunctionRegistry: ISimpleFunctionRegistry as ContractArtifact, - ITokenSpender: ITokenSpender as ContractArtifact, - ITransformERC20: ITransformERC20 as ContractArtifact, + IOwnableFeature: IOwnableFeature as ContractArtifact, + ISimpleFunctionRegistryFeature: ISimpleFunctionRegistryFeature as ContractArtifact, + ITokenSpenderFeature: ITokenSpenderFeature as ContractArtifact, + ITransformERC20Feature: ITransformERC20Feature as ContractArtifact, FillQuoteTransformer: FillQuoteTransformer as ContractArtifact, PayTakerTransformer: PayTakerTransformer as ContractArtifact, WethTransformer: WethTransformer as ContractArtifact, - Ownable: Ownable as ContractArtifact, - SimpleFunctionRegistry: SimpleFunctionRegistry as ContractArtifact, - TransformERC20: TransformERC20 as ContractArtifact, - TokenSpender: TokenSpender as ContractArtifact, + OwnableFeature: OwnableFeature as ContractArtifact, + SimpleFunctionRegistryFeature: SimpleFunctionRegistryFeature as ContractArtifact, + TransformERC20Feature: TransformERC20Feature as ContractArtifact, + TokenSpenderFeature: TokenSpenderFeature as ContractArtifact, AffiliateFeeTransformer: AffiliateFeeTransformer as ContractArtifact, - SignatureValidator: SignatureValidator as ContractArtifact, - MetaTransactions: MetaTransactions as ContractArtifact, + SignatureValidatorFeature: SignatureValidatorFeature as ContractArtifact, + MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact, LogMetadataTransformer: LogMetadataTransformer as ContractArtifact, BridgeAdapter: BridgeAdapter as ContractArtifact, }; diff --git a/contracts/zero-ex/src/index.ts b/contracts/zero-ex/src/index.ts index 73819ecc9e..6ad89649d3 100644 --- a/contracts/zero-ex/src/index.ts +++ b/contracts/zero-ex/src/index.ts @@ -36,12 +36,12 @@ export { AffiliateFeeTransformerContract, BridgeAdapterContract, FillQuoteTransformerContract, - IOwnableContract, - IOwnableEvents, - ISimpleFunctionRegistryContract, - ISimpleFunctionRegistryEvents, - ITokenSpenderContract, - ITransformERC20Contract, + IOwnableFeatureContract, + IOwnableFeatureEvents, + ISimpleFunctionRegistryFeatureContract, + ISimpleFunctionRegistryFeatureEvents, + ITokenSpenderFeatureContract, + ITransformERC20FeatureContract, IZeroExContract, LogMetadataTransformerContract, PayTakerTransformerContract, diff --git a/contracts/zero-ex/src/migration.ts b/contracts/zero-ex/src/migration.ts index 8d211800e0..ef0af08b54 100644 --- a/contracts/zero-ex/src/migration.ts +++ b/contracts/zero-ex/src/migration.ts @@ -6,12 +6,13 @@ import { artifacts } from './artifacts'; import { FullMigrationContract, InitialMigrationContract, - MetaTransactionsContract, - OwnableContract, - SignatureValidatorContract, - SimpleFunctionRegistryContract, - TokenSpenderContract, - TransformERC20Contract, + IZeroExContract, + MetaTransactionsFeatureContract, + OwnableFeatureContract, + SignatureValidatorFeatureContract, + SimpleFunctionRegistryFeatureContract, + TokenSpenderFeatureContract, + TransformERC20FeatureContract, ZeroExContract, } from './wrappers'; @@ -36,15 +37,15 @@ export async function deployBootstrapFeaturesAsync( return { registry: features.registry || - (await SimpleFunctionRegistryContract.deployFrom0xArtifactAsync( - artifacts.SimpleFunctionRegistry, + (await SimpleFunctionRegistryFeatureContract.deployFrom0xArtifactAsync( + artifacts.SimpleFunctionRegistryFeature, provider, txDefaults, artifacts, )).address, ownable: features.ownable || - (await OwnableContract.deployFrom0xArtifactAsync(artifacts.Ownable, provider, txDefaults, artifacts)) + (await OwnableFeatureContract.deployFrom0xArtifactAsync(artifacts.OwnableFeature, provider, txDefaults, artifacts)) .address, }; } @@ -107,32 +108,32 @@ export async function deployFullFeaturesAsync( ...(await deployBootstrapFeaturesAsync(provider, txDefaults)), tokenSpender: features.tokenSpender || - (await TokenSpenderContract.deployFrom0xArtifactAsync( - artifacts.TokenSpender, + (await TokenSpenderFeatureContract.deployFrom0xArtifactAsync( + artifacts.TokenSpenderFeature, provider, txDefaults, artifacts, )).address, transformERC20: features.transformERC20 || - (await TransformERC20Contract.deployFrom0xArtifactAsync( - artifacts.TransformERC20, + (await TransformERC20FeatureContract.deployFrom0xArtifactAsync( + artifacts.TransformERC20Feature, provider, txDefaults, artifacts, )).address, signatureValidator: features.signatureValidator || - (await SignatureValidatorContract.deployFrom0xArtifactAsync( - artifacts.SignatureValidator, + (await SignatureValidatorFeatureContract.deployFrom0xArtifactAsync( + artifacts.SignatureValidatorFeature, provider, txDefaults, artifacts, )).address, metaTransactions: features.metaTransactions || - (await MetaTransactionsContract.deployFrom0xArtifactAsync( - artifacts.MetaTransactions, + (await MetaTransactionsFeatureContract.deployFrom0xArtifactAsync( + artifacts.MetaTransactionsFeature, provider, txDefaults, artifacts, @@ -150,7 +151,7 @@ export async function fullMigrateAsync( txDefaults: Partial, features: Partial = {}, opts: Partial = {}, -): Promise { +): Promise { const migrator = await FullMigrationContract.deployFrom0xArtifactAsync( artifacts.FullMigration, provider, @@ -171,5 +172,5 @@ export async function fullMigrateAsync( ...opts, }; await migrator.initializeZeroEx(owner, zeroEx.address, _features, _opts).awaitTransactionSuccessAsync(); - return zeroEx; + return new IZeroExContract(zeroEx.address, provider, txDefaults); } diff --git a/contracts/zero-ex/src/wrappers.ts b/contracts/zero-ex/src/wrappers.ts index fed8ef1693..ea09d3416d 100644 --- a/contracts/zero-ex/src/wrappers.ts +++ b/contracts/zero-ex/src/wrappers.ts @@ -10,19 +10,19 @@ export * from '../generated-wrappers/full_migration'; export * from '../generated-wrappers/i_allowance_target'; export * from '../generated-wrappers/i_erc20_transformer'; export * from '../generated-wrappers/i_flash_wallet'; -export * from '../generated-wrappers/i_ownable'; -export * from '../generated-wrappers/i_simple_function_registry'; -export * from '../generated-wrappers/i_token_spender'; -export * from '../generated-wrappers/i_transform_erc20'; +export * from '../generated-wrappers/i_ownable_feature'; +export * from '../generated-wrappers/i_simple_function_registry_feature'; +export * from '../generated-wrappers/i_token_spender_feature'; +export * from '../generated-wrappers/i_transform_erc20_feature'; export * from '../generated-wrappers/i_zero_ex'; export * from '../generated-wrappers/initial_migration'; export * from '../generated-wrappers/log_metadata_transformer'; -export * from '../generated-wrappers/meta_transactions'; -export * from '../generated-wrappers/ownable'; +export * from '../generated-wrappers/meta_transactions_feature'; +export * from '../generated-wrappers/ownable_feature'; export * from '../generated-wrappers/pay_taker_transformer'; -export * from '../generated-wrappers/signature_validator'; -export * from '../generated-wrappers/simple_function_registry'; -export * from '../generated-wrappers/token_spender'; -export * from '../generated-wrappers/transform_erc20'; +export * from '../generated-wrappers/signature_validator_feature'; +export * from '../generated-wrappers/simple_function_registry_feature'; +export * from '../generated-wrappers/token_spender_feature'; +export * from '../generated-wrappers/transform_erc20_feature'; export * from '../generated-wrappers/weth_transformer'; export * from '../generated-wrappers/zero_ex'; diff --git a/contracts/zero-ex/test/artifacts.ts b/contracts/zero-ex/test/artifacts.ts index 7956a71e69..b925ecfa0f 100644 --- a/contracts/zero-ex/test/artifacts.ts +++ b/contracts/zero-ex/test/artifacts.ts @@ -7,8 +7,8 @@ import { ContractArtifact } from 'ethereum-types'; import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json'; import * as AllowanceTarget from '../test/generated-artifacts/AllowanceTarget.json'; -import * as Bootstrap from '../test/generated-artifacts/Bootstrap.json'; import * as BridgeAdapter from '../test/generated-artifacts/BridgeAdapter.json'; +import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json'; import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json'; import * as FixinCommon from '../test/generated-artifacts/FixinCommon.json'; import * as FixinEIP712 from '../test/generated-artifacts/FixinEIP712.json'; @@ -16,22 +16,23 @@ import * as FixinReentrancyGuard from '../test/generated-artifacts/FixinReentran import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json'; import * as FullMigration from '../test/generated-artifacts/FullMigration.json'; import * as IAllowanceTarget from '../test/generated-artifacts/IAllowanceTarget.json'; -import * as IBootstrap from '../test/generated-artifacts/IBootstrap.json'; import * as IBridgeAdapter from '../test/generated-artifacts/IBridgeAdapter.json'; +import * as IBootstrapFeature from '../test/generated-artifacts/IBootstrapFeature.json'; import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json'; import * as IERC20Transformer from '../test/generated-artifacts/IERC20Transformer.json'; import * as IExchange from '../test/generated-artifacts/IExchange.json'; import * as IFeature from '../test/generated-artifacts/IFeature.json'; import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json'; import * as IGasToken from '../test/generated-artifacts/IGasToken.json'; -import * as IMetaTransactions from '../test/generated-artifacts/IMetaTransactions.json'; +import * as IMetaTransactionsFeature from '../test/generated-artifacts/IMetaTransactionsFeature.json'; import * as InitialMigration from '../test/generated-artifacts/InitialMigration.json'; -import * as IOwnable from '../test/generated-artifacts/IOwnable.json'; -import * as ISignatureValidator from '../test/generated-artifacts/ISignatureValidator.json'; -import * as ISimpleFunctionRegistry from '../test/generated-artifacts/ISimpleFunctionRegistry.json'; +import * as IOwnableFeature from '../test/generated-artifacts/IOwnableFeature.json'; +import * as ISignatureValidatorFeature from '../test/generated-artifacts/ISignatureValidatorFeature.json'; +import * as ISimpleFunctionRegistryFeature from '../test/generated-artifacts/ISimpleFunctionRegistryFeature.json'; import * as ITestSimpleFunctionRegistryFeature from '../test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json'; -import * as ITokenSpender from '../test/generated-artifacts/ITokenSpender.json'; -import * as ITransformERC20 from '../test/generated-artifacts/ITransformERC20.json'; +import * as ITokenSpenderFeature from '../test/generated-artifacts/ITokenSpenderFeature.json'; +import * as ITransformERC20Feature from '../test/generated-artifacts/ITransformERC20Feature.json'; +import * as IUniswapV2Feature from '../test/generated-artifacts/IUniswapV2Feature.json'; import * as IZeroEx from '../test/generated-artifacts/IZeroEx.json'; import * as LibBootstrap from '../test/generated-artifacts/LibBootstrap.json'; import * as LibCommonRichErrors from '../test/generated-artifacts/LibCommonRichErrors.json'; @@ -55,7 +56,6 @@ import * as LibTransformERC20RichErrors from '../test/generated-artifacts/LibTra import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json'; import * as LibWalletRichErrors from '../test/generated-artifacts/LibWalletRichErrors.json'; import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json'; -import * as MetaTransactions from '../test/generated-artifacts/MetaTransactions.json'; import * as MixinAdapterAddresses from '../test/generated-artifacts/MixinAdapterAddresses.json'; import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.json'; import * as MixinCurve from '../test/generated-artifacts/MixinCurve.json'; @@ -65,10 +65,11 @@ import * as MixinOasis from '../test/generated-artifacts/MixinOasis.json'; import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json'; import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.json'; import * as MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json'; -import * as Ownable from '../test/generated-artifacts/Ownable.json'; +import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json'; +import * as OwnableFeature from '../test/generated-artifacts/OwnableFeature.json'; import * as PayTakerTransformer from '../test/generated-artifacts/PayTakerTransformer.json'; -import * as SignatureValidator from '../test/generated-artifacts/SignatureValidator.json'; -import * as SimpleFunctionRegistry from '../test/generated-artifacts/SimpleFunctionRegistry.json'; +import * as SignatureValidatorFeature from '../test/generated-artifacts/SignatureValidatorFeature.json'; +import * as SimpleFunctionRegistryFeature from '../test/generated-artifacts/SimpleFunctionRegistryFeature.json'; import * as TestCallTarget from '../test/generated-artifacts/TestCallTarget.json'; import * as TestDelegateCaller from '../test/generated-artifacts/TestDelegateCaller.json'; import * as TestFillQuoteTransformerBridge from '../test/generated-artifacts/TestFillQuoteTransformerBridge.json'; @@ -91,9 +92,9 @@ import * as TestTransformerHost from '../test/generated-artifacts/TestTransforme import * as TestWeth from '../test/generated-artifacts/TestWeth.json'; import * as TestWethTransformerHost from '../test/generated-artifacts/TestWethTransformerHost.json'; import * as TestZeroExFeature from '../test/generated-artifacts/TestZeroExFeature.json'; -import * as TokenSpender from '../test/generated-artifacts/TokenSpender.json'; +import * as TokenSpenderFeature from '../test/generated-artifacts/TokenSpenderFeature.json'; import * as Transformer from '../test/generated-artifacts/Transformer.json'; -import * as TransformERC20 from '../test/generated-artifacts/TransformERC20.json'; +import * as TransformERC20Feature from '../test/generated-artifacts/TransformERC20Feature.json'; import * as TransformerDeployer from '../test/generated-artifacts/TransformerDeployer.json'; import * as WethTransformer from '../test/generated-artifacts/WethTransformer.json'; import * as ZeroEx from '../test/generated-artifacts/ZeroEx.json'; @@ -125,21 +126,22 @@ export const artifacts = { IAllowanceTarget: IAllowanceTarget as ContractArtifact, IFlashWallet: IFlashWallet as ContractArtifact, TransformerDeployer: TransformerDeployer as ContractArtifact, - Bootstrap: Bootstrap as ContractArtifact, - IBootstrap: IBootstrap as ContractArtifact, + BootstrapFeature: BootstrapFeature as ContractArtifact, + IBootstrapFeature: IBootstrapFeature as ContractArtifact, IFeature: IFeature as ContractArtifact, - IMetaTransactions: IMetaTransactions as ContractArtifact, - IOwnable: IOwnable as ContractArtifact, - ISignatureValidator: ISignatureValidator as ContractArtifact, - ISimpleFunctionRegistry: ISimpleFunctionRegistry as ContractArtifact, - ITokenSpender: ITokenSpender as ContractArtifact, - ITransformERC20: ITransformERC20 as ContractArtifact, - MetaTransactions: MetaTransactions as ContractArtifact, - Ownable: Ownable as ContractArtifact, - SignatureValidator: SignatureValidator as ContractArtifact, - SimpleFunctionRegistry: SimpleFunctionRegistry as ContractArtifact, - TokenSpender: TokenSpender as ContractArtifact, - TransformERC20: TransformERC20 as ContractArtifact, + IMetaTransactionsFeature: IMetaTransactionsFeature as ContractArtifact, + IOwnableFeature: IOwnableFeature as ContractArtifact, + ISignatureValidatorFeature: ISignatureValidatorFeature as ContractArtifact, + ISimpleFunctionRegistryFeature: ISimpleFunctionRegistryFeature as ContractArtifact, + ITokenSpenderFeature: ITokenSpenderFeature as ContractArtifact, + ITransformERC20Feature: ITransformERC20Feature as ContractArtifact, + IUniswapV2Feature: IUniswapV2Feature as ContractArtifact, + MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact, + OwnableFeature: OwnableFeature as ContractArtifact, + SignatureValidatorFeature: SignatureValidatorFeature as ContractArtifact, + SimpleFunctionRegistryFeature: SimpleFunctionRegistryFeature as ContractArtifact, + TokenSpenderFeature: TokenSpenderFeature as ContractArtifact, + TransformERC20Feature: TransformERC20Feature as ContractArtifact, LibSignedCallData: LibSignedCallData as ContractArtifact, FixinCommon: FixinCommon as ContractArtifact, FixinEIP712: FixinEIP712 as ContractArtifact, diff --git a/contracts/zero-ex/test/features/meta_transactions_test.ts b/contracts/zero-ex/test/features/meta_transactions_test.ts index 9b9f59ab56..f3633a551b 100644 --- a/contracts/zero-ex/test/features/meta_transactions_test.ts +++ b/contracts/zero-ex/test/features/meta_transactions_test.ts @@ -12,12 +12,12 @@ import { BigNumber, hexUtils, StringRevertError, ZeroExRevertErrors } from '@0x/ import * as _ from 'lodash'; import { generateCallDataSignature, signCallData } from '../../src/signed_call_data'; -import { MetaTransactionsContract, ZeroExContract } from '../../src/wrappers'; +import { IZeroExContract, MetaTransactionsFeatureContract } from '../../src/wrappers'; import { artifacts } from '../artifacts'; import { abis } from '../utils/abis'; import { fullMigrateAsync } from '../utils/migration'; import { - ITokenSpenderContract, + ITokenSpenderFeatureContract, TestMetaTransactionsTransformERC20FeatureContract, TestMetaTransactionsTransformERC20FeatureEvents, TestMintableERC20TokenContract, @@ -29,8 +29,8 @@ blockchainTests.resets('MetaTransactions feature', env => { let owner: string; let sender: string; let signers: string[]; - let zeroEx: ZeroExContract; - let feature: MetaTransactionsContract; + let zeroEx: IZeroExContract; + let feature: MetaTransactionsFeatureContract; let feeToken: TestMintableERC20TokenContract; let transformERC20Feature: TestMetaTransactionsTransformERC20FeatureContract; let allowanceTarget: string; @@ -52,14 +52,14 @@ blockchainTests.resets('MetaTransactions feature', env => { zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, { transformERC20: transformERC20Feature.address, }); - feature = new MetaTransactionsContract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis); + feature = new MetaTransactionsFeatureContract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis); feeToken = await TestMintableERC20TokenContract.deployFrom0xArtifactAsync( artifacts.TestMintableERC20Token, env.provider, env.txDefaults, {}, ); - allowanceTarget = await new ITokenSpenderContract(zeroEx.address, env.provider, env.txDefaults) + allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults) .getAllowanceTarget() .callAsync(); // Fund signers with fee tokens. diff --git a/contracts/zero-ex/test/features/ownable_test.ts b/contracts/zero-ex/test/features/ownable_test.ts index 4c4f4d1708..2809f98af0 100644 --- a/contracts/zero-ex/test/features/ownable_test.ts +++ b/contracts/zero-ex/test/features/ownable_test.ts @@ -3,12 +3,12 @@ import { hexUtils, OwnableRevertErrors, StringRevertError, ZeroExRevertErrors } import { artifacts } from '../artifacts'; import { initialMigrateAsync } from '../utils/migration'; -import { IOwnableContract, IOwnableEvents, TestMigratorContract, TestMigratorEvents } from '../wrappers'; +import { IOwnableFeatureContract, IOwnableFeatureEvents, TestMigratorContract, TestMigratorEvents } from '../wrappers'; blockchainTests.resets('Ownable feature', env => { const notOwner = randomAddress(); let owner: string; - let ownable: IOwnableContract; + let ownable: IOwnableFeatureContract; let testMigrator: TestMigratorContract; let succeedingMigrateFnCallData: string; let failingMigrateFnCallData: string; @@ -19,7 +19,7 @@ blockchainTests.resets('Ownable feature', env => { [owner] = await env.getAccountAddressesAsync(); logDecoder = new LogDecoder(env.web3Wrapper, artifacts); const zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults); - ownable = new IOwnableContract(zeroEx.address, env.provider, env.txDefaults); + ownable = new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults); testMigrator = await TestMigratorContract.deployFrom0xArtifactAsync( artifacts.TestMigrator, env.provider, @@ -49,7 +49,7 @@ blockchainTests.resets('Ownable feature', env => { newOwner, }, ], - IOwnableEvents.OwnershipTransferred, + IOwnableFeatureEvents.OwnershipTransferred, ); expect(await ownable.owner().callAsync()).to.eq(newOwner); }); diff --git a/contracts/zero-ex/test/features/signature_validator_test.ts b/contracts/zero-ex/test/features/signature_validator_test.ts index 99fdd79e9b..2ea0b7e636 100644 --- a/contracts/zero-ex/test/features/signature_validator_test.ts +++ b/contracts/zero-ex/test/features/signature_validator_test.ts @@ -5,7 +5,7 @@ import { hexUtils, ZeroExRevertErrors } from '@0x/utils'; import * as ethjs from 'ethereumjs-util'; import * as _ from 'lodash'; -import { SignatureValidatorContract, ZeroExContract } from '../../src/wrappers'; +import { IZeroExContract, SignatureValidatorFeatureContract } from '../../src/wrappers'; import { abis } from '../utils/abis'; import { fullMigrateAsync } from '../utils/migration'; @@ -14,13 +14,13 @@ const { NULL_BYTES } = constants; blockchainTests.resets('SignatureValidator feature', env => { let owner: string; let signers: string[]; - let zeroEx: ZeroExContract; - let feature: SignatureValidatorContract; + let zeroEx: IZeroExContract; + let feature: SignatureValidatorFeatureContract; before(async () => { [owner, ...signers] = await env.getAccountAddressesAsync(); zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults); - feature = new SignatureValidatorContract(zeroEx.address, env.provider, env.txDefaults, abis); + feature = new SignatureValidatorFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis); }); describe('validateHashSignature()', () => { diff --git a/contracts/zero-ex/test/features/simple_function_registry_test.ts b/contracts/zero-ex/test/features/simple_function_registry_test.ts index 4f4f06fd5f..53d0ec99b0 100644 --- a/contracts/zero-ex/test/features/simple_function_registry_test.ts +++ b/contracts/zero-ex/test/features/simple_function_registry_test.ts @@ -5,8 +5,8 @@ import { ZeroExContract } from '../../src/wrappers'; import { artifacts } from '../artifacts'; import { initialMigrateAsync } from '../utils/migration'; import { - ISimpleFunctionRegistryContract, - ISimpleFunctionRegistryEvents, + ISimpleFunctionRegistryFeatureContract, + ISimpleFunctionRegistryFeatureEvents, ITestSimpleFunctionRegistryFeatureContract, TestSimpleFunctionRegistryFeatureImpl1Contract, TestSimpleFunctionRegistryFeatureImpl2Contract, @@ -17,7 +17,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => { const notOwner = randomAddress(); let owner: string; let zeroEx: ZeroExContract; - let registry: ISimpleFunctionRegistryContract; + let registry: ISimpleFunctionRegistryFeatureContract; let testFnSelector: string; let testFeature: ITestSimpleFunctionRegistryFeatureContract; let testFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1Contract; @@ -26,7 +26,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => { before(async () => { [owner] = await env.getAccountAddressesAsync(); zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults); - registry = new ISimpleFunctionRegistryContract(zeroEx.address, env.provider, { + registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, { ...env.txDefaults, from: owner, }); @@ -75,7 +75,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => { verifyEventsFromLogs( logs, [{ selector: testFnSelector, oldImpl: NULL_ADDRESS, newImpl: testFeatureImpl1.address }], - ISimpleFunctionRegistryEvents.ProxyFunctionUpdated, + ISimpleFunctionRegistryFeatureEvents.ProxyFunctionUpdated, ); const r = await testFeature.testFn().callAsync(); expect(r).to.bignumber.eq(1337); @@ -117,7 +117,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => { verifyEventsFromLogs( logs, [{ selector: testFnSelector, oldImpl: testFeatureImpl2.address, newImpl: NULL_ADDRESS }], - ISimpleFunctionRegistryEvents.ProxyFunctionUpdated, + ISimpleFunctionRegistryFeatureEvents.ProxyFunctionUpdated, ); const rollbackLength = await registry.getRollbackLength(testFnSelector).callAsync(); expect(rollbackLength).to.bignumber.eq(0); diff --git a/contracts/zero-ex/test/features/token_spender_test.ts b/contracts/zero-ex/test/features/token_spender_test.ts index 825ed49478..dd4dfba51c 100644 --- a/contracts/zero-ex/test/features/token_spender_test.ts +++ b/contracts/zero-ex/test/features/token_spender_test.ts @@ -7,29 +7,29 @@ import { } from '@0x/contracts-test-utils'; import { BigNumber, hexUtils, StringRevertError, ZeroExRevertErrors } from '@0x/utils'; -import { TokenSpenderContract, ZeroExContract } from '../../src/wrappers'; +import { IZeroExContract, TokenSpenderFeatureContract } from '../../src/wrappers'; import { artifacts } from '../artifacts'; import { abis } from '../utils/abis'; import { fullMigrateAsync } from '../utils/migration'; import { TestTokenSpenderERC20TokenContract, TestTokenSpenderERC20TokenEvents } from '../wrappers'; blockchainTests.resets('TokenSpender feature', env => { - let zeroEx: ZeroExContract; - let feature: TokenSpenderContract; + let zeroEx: IZeroExContract; + let feature: TokenSpenderFeatureContract; let token: TestTokenSpenderERC20TokenContract; let allowanceTarget: string; before(async () => { const [owner] = await env.getAccountAddressesAsync(); zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, { - tokenSpender: (await TokenSpenderContract.deployFrom0xArtifactAsync( + tokenSpender: (await TokenSpenderFeatureContract.deployFrom0xArtifactAsync( artifacts.TestTokenSpender, env.provider, env.txDefaults, artifacts, )).address, }); - feature = new TokenSpenderContract(zeroEx.address, env.provider, env.txDefaults, abis); + feature = new TokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis); token = await TestTokenSpenderERC20TokenContract.deployFrom0xArtifactAsync( artifacts.TestTokenSpenderERC20Token, env.provider, diff --git a/contracts/zero-ex/test/features/transform_erc20_test.ts b/contracts/zero-ex/test/features/transform_erc20_test.ts index a0a28e399b..55c5a65622 100644 --- a/contracts/zero-ex/test/features/transform_erc20_test.ts +++ b/contracts/zero-ex/test/features/transform_erc20_test.ts @@ -14,18 +14,18 @@ import { DecodedLogEntry } from 'ethereum-types'; import * as ethjs from 'ethereumjs-util'; import { generateCallDataHashSignature, signCallData } from '../../src/signed_call_data'; -import { TransformERC20Contract, ZeroExContract } from '../../src/wrappers'; +import { IZeroExContract, TransformERC20FeatureContract } from '../../src/wrappers'; import { artifacts } from '../artifacts'; import { abis } from '../utils/abis'; import { fullMigrateAsync } from '../utils/migration'; import { FlashWalletContract, - ITokenSpenderContract, + ITokenSpenderFeatureContract, TestMintableERC20TokenContract, TestMintTokenERC20TransformerContract, TestMintTokenERC20TransformerEvents, TestMintTokenERC20TransformerMintTransformEventArgs, - TransformERC20Events, + TransformERC20FeatureEvents, } from '../wrappers'; const { NULL_BYTES, NULL_BYTES32 } = constants; @@ -39,8 +39,8 @@ blockchainTests.resets('TransformERC20 feature', env => { let taker: string; let sender: string; let transformerDeployer: string; - let zeroEx: ZeroExContract; - let feature: TransformERC20Contract; + let zeroEx: IZeroExContract; + let feature: TransformERC20FeatureContract; let wallet: FlashWalletContract; let allowanceTarget: string; @@ -51,7 +51,7 @@ blockchainTests.resets('TransformERC20 feature', env => { env.provider, env.txDefaults, { - transformERC20: (await TransformERC20Contract.deployFrom0xArtifactAsync( + transformERC20: (await TransformERC20FeatureContract.deployFrom0xArtifactAsync( artifacts.TestTransformERC20, env.provider, env.txDefaults, @@ -60,9 +60,9 @@ blockchainTests.resets('TransformERC20 feature', env => { }, { transformerDeployer }, ); - feature = new TransformERC20Contract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis); + feature = new TransformERC20FeatureContract(zeroEx.address, env.provider, { ...env.txDefaults, from: sender }, abis); wallet = new FlashWalletContract(await feature.getTransformWallet().callAsync(), env.provider, env.txDefaults); - allowanceTarget = await new ITokenSpenderContract(zeroEx.address, env.provider, env.txDefaults) + allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults) .getAllowanceTarget() .callAsync(); await feature.setQuoteSigner(callDataSigner).awaitTransactionSuccessAsync({ from: owner }); @@ -99,7 +99,7 @@ blockchainTests.resets('TransformERC20 feature', env => { verifyEventsFromLogs( receipt.logs, [{ transformerDeployer: newDeployer }], - TransformERC20Events.TransformerDeployerUpdated, + TransformERC20FeatureEvents.TransformerDeployerUpdated, ); const actualDeployer = await feature.getTransformerDeployer().callAsync(); expect(actualDeployer).to.eq(newDeployer); @@ -122,7 +122,7 @@ blockchainTests.resets('TransformERC20 feature', env => { it('owner can set the quote signer with `setQuoteSigner()`', async () => { const newSigner = randomAddress(); const receipt = await feature.setQuoteSigner(newSigner).awaitTransactionSuccessAsync({ from: owner }); - verifyEventsFromLogs(receipt.logs, [{ quoteSigner: newSigner }], TransformERC20Events.QuoteSignerUpdated); + verifyEventsFromLogs(receipt.logs, [{ quoteSigner: newSigner }], TransformERC20FeatureEvents.QuoteSignerUpdated); const actualSigner = await feature.getQuoteSigner().callAsync(); expect(actualSigner).to.eq(newSigner); }); @@ -259,7 +259,7 @@ blockchainTests.resets('TransformERC20 feature', env => { outputToken: outputToken.address, }, ], - TransformERC20Events.TransformedERC20, + TransformERC20FeatureEvents.TransformedERC20, ); verifyEventsFromLogs( receipt.logs, @@ -316,7 +316,7 @@ blockchainTests.resets('TransformERC20 feature', env => { outputToken: ETH_TOKEN_ADDRESS, }, ], - TransformERC20Events.TransformedERC20, + TransformERC20FeatureEvents.TransformedERC20, ); verifyEventsFromLogs( receipt.logs, @@ -376,7 +376,7 @@ blockchainTests.resets('TransformERC20 feature', env => { outputToken: outputToken.address, }, ], - TransformERC20Events.TransformedERC20, + TransformERC20FeatureEvents.TransformedERC20, ); verifyEventsFromLogs( receipt.logs, diff --git a/contracts/zero-ex/test/full_migration_test.ts b/contracts/zero-ex/test/full_migration_test.ts index dea5bf3749..0611e45420 100644 --- a/contracts/zero-ex/test/full_migration_test.ts +++ b/contracts/zero-ex/test/full_migration_test.ts @@ -9,11 +9,11 @@ import { abis } from './utils/abis'; import { deployFullFeaturesAsync, FullFeatures } from './utils/migration'; import { AllowanceTargetContract, - IMetaTransactionsContract, - IOwnableContract, - ISignatureValidatorContract, - ITokenSpenderContract, - ITransformERC20Contract, + IMetaTransactionsFeatureContract, + IOwnableFeatureContract, + ISignatureValidatorFeatureContract, + ITokenSpenderFeatureContract, + ITransformERC20FeatureContract, TestFullMigrationContract, ZeroExContract, } from './wrappers'; @@ -50,7 +50,7 @@ blockchainTests.resets('Full migration', env => { }); it('ZeroEx has the correct owner', async () => { - const ownable = new IOwnableContract(zeroEx.address, env.provider, env.txDefaults); + const ownable = new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults); const actualOwner = await ownable.owner().callAsync(); expect(actualOwner).to.eq(owner); }); @@ -70,11 +70,11 @@ blockchainTests.resets('Full migration', env => { const FEATURE_FNS = { TokenSpender: { - contractType: ITokenSpenderContract, + contractType: ITokenSpenderFeatureContract, fns: ['_spendERC20Tokens'], }, TransformERC20: { - contractType: ITransformERC20Contract, + contractType: ITransformERC20FeatureContract, fns: [ 'transformERC20', '_transformERC20', @@ -86,11 +86,11 @@ blockchainTests.resets('Full migration', env => { ], }, SignatureValidator: { - contractType: ISignatureValidatorContract, + contractType: ISignatureValidatorFeatureContract, fns: ['isValidHashSignature', 'validateHashSignature'], }, MetaTransactions: { - contractType: IMetaTransactionsContract, + contractType: IMetaTransactionsFeatureContract, fns: [ 'executeMetaTransaction', 'batchExecuteMetaTransactions', @@ -181,7 +181,7 @@ blockchainTests.resets('Full migration', env => { let allowanceTarget: AllowanceTargetContract; before(async () => { - const contract = new ITokenSpenderContract(zeroEx.address, env.provider, env.txDefaults); + const contract = new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults); allowanceTarget = new AllowanceTargetContract( await contract.getAllowanceTarget().callAsync(), env.provider, @@ -199,10 +199,10 @@ blockchainTests.resets('Full migration', env => { }); describe('TransformERC20', () => { - let feature: ITransformERC20Contract; + let feature: ITransformERC20FeatureContract; before(async () => { - feature = new ITransformERC20Contract(zeroEx.address, env.provider, env.txDefaults); + feature = new ITransformERC20FeatureContract(zeroEx.address, env.provider, env.txDefaults); }); it('has the correct transformer deployer', async () => { diff --git a/contracts/zero-ex/test/initial_migration_test.ts b/contracts/zero-ex/test/initial_migration_test.ts index f9985ea4c2..6fafe719ae 100644 --- a/contracts/zero-ex/test/initial_migration_test.ts +++ b/contracts/zero-ex/test/initial_migration_test.ts @@ -4,10 +4,10 @@ import { hexUtils, ZeroExRevertErrors } from '@0x/utils'; import { artifacts } from './artifacts'; import { BootstrapFeatures, deployBootstrapFeaturesAsync } from './utils/migration'; import { - IBootstrapContract, + IBootstrapFeatureContract, InitialMigrationContract, - IOwnableContract, - SimpleFunctionRegistryContract, + IOwnableFeatureContract, + SimpleFunctionRegistryFeatureContract, TestInitialMigrationContract, ZeroExContract, } from './wrappers'; @@ -16,7 +16,7 @@ blockchainTests.resets('Initial migration', env => { let owner: string; let zeroEx: ZeroExContract; let migrator: TestInitialMigrationContract; - let bootstrapFeature: IBootstrapContract; + let bootstrapFeature: IBootstrapFeatureContract; let features: BootstrapFeatures; before(async () => { @@ -29,7 +29,7 @@ blockchainTests.resets('Initial migration', env => { artifacts, env.txDefaults.from as string, ); - bootstrapFeature = new IBootstrapContract( + bootstrapFeature = new IBootstrapFeatureContract( await migrator.bootstrapFeature().callAsync(), env.provider, env.txDefaults, @@ -82,10 +82,10 @@ blockchainTests.resets('Initial migration', env => { }); describe('Ownable feature', () => { - let ownable: IOwnableContract; + let ownable: IOwnableFeatureContract; before(async () => { - ownable = new IOwnableContract(zeroEx.address, env.provider, env.txDefaults); + ownable = new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults); }); it('has the correct owner', async () => { @@ -95,10 +95,10 @@ blockchainTests.resets('Initial migration', env => { }); describe('SimpleFunctionRegistry feature', () => { - let registry: SimpleFunctionRegistryContract; + let registry: SimpleFunctionRegistryFeatureContract; before(async () => { - registry = new SimpleFunctionRegistryContract(zeroEx.address, env.provider, env.txDefaults); + registry = new SimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, env.txDefaults); }); it('_extendSelf() is deregistered', async () => { diff --git a/contracts/zero-ex/test/zero_ex_test.ts b/contracts/zero-ex/test/zero_ex_test.ts index ade1ab2b94..566504f157 100644 --- a/contracts/zero-ex/test/zero_ex_test.ts +++ b/contracts/zero-ex/test/zero_ex_test.ts @@ -7,8 +7,8 @@ import { artifacts } from './artifacts'; import { initialMigrateAsync } from './utils/migration'; import { IFeatureContract, - IOwnableContract, - ISimpleFunctionRegistryContract, + IOwnableFeatureContract, + ISimpleFunctionRegistryFeatureContract, TestZeroExFeatureContract, TestZeroExFeatureEvents, } from './wrappers'; @@ -16,15 +16,15 @@ import { blockchainTests.resets('ZeroEx contract', env => { let owner: string; let zeroEx: ZeroExContract; - let ownable: IOwnableContract; - let registry: ISimpleFunctionRegistryContract; + let ownable: IOwnableFeatureContract; + let registry: ISimpleFunctionRegistryFeatureContract; let testFeature: TestZeroExFeatureContract; before(async () => { [owner] = await env.getAccountAddressesAsync(); zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults); - ownable = new IOwnableContract(zeroEx.address, env.provider, env.txDefaults); - registry = new ISimpleFunctionRegistryContract(zeroEx.address, env.provider, env.txDefaults); + ownable = new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults); + registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, env.txDefaults); testFeature = new TestZeroExFeatureContract(zeroEx.address, env.provider, env.txDefaults); // Register test features. const testFeatureImpl = await TestZeroExFeatureContract.deployFrom0xArtifactAsync( diff --git a/contracts/zero-ex/tsconfig.json b/contracts/zero-ex/tsconfig.json index 45ad033a8a..f7b6cc3179 100644 --- a/contracts/zero-ex/tsconfig.json +++ b/contracts/zero-ex/tsconfig.json @@ -10,26 +10,26 @@ "generated-artifacts/IAllowanceTarget.json", "generated-artifacts/IERC20Transformer.json", "generated-artifacts/IFlashWallet.json", - "generated-artifacts/IOwnable.json", - "generated-artifacts/ISimpleFunctionRegistry.json", - "generated-artifacts/ITokenSpender.json", - "generated-artifacts/ITransformERC20.json", + "generated-artifacts/IOwnableFeature.json", + "generated-artifacts/ISimpleFunctionRegistryFeature.json", + "generated-artifacts/ITokenSpenderFeature.json", + "generated-artifacts/ITransformERC20Feature.json", "generated-artifacts/IZeroEx.json", "generated-artifacts/InitialMigration.json", "generated-artifacts/LogMetadataTransformer.json", - "generated-artifacts/MetaTransactions.json", - "generated-artifacts/Ownable.json", + "generated-artifacts/MetaTransactionsFeature.json", + "generated-artifacts/OwnableFeature.json", "generated-artifacts/PayTakerTransformer.json", - "generated-artifacts/SignatureValidator.json", - "generated-artifacts/SimpleFunctionRegistry.json", - "generated-artifacts/TokenSpender.json", - "generated-artifacts/TransformERC20.json", + "generated-artifacts/SignatureValidatorFeature.json", + "generated-artifacts/SimpleFunctionRegistryFeature.json", + "generated-artifacts/TokenSpenderFeature.json", + "generated-artifacts/TransformERC20Feature.json", "generated-artifacts/WethTransformer.json", "generated-artifacts/ZeroEx.json", "test/generated-artifacts/AffiliateFeeTransformer.json", "test/generated-artifacts/AllowanceTarget.json", - "test/generated-artifacts/Bootstrap.json", "test/generated-artifacts/BridgeAdapter.json", + "test/generated-artifacts/BootstrapFeature.json", "test/generated-artifacts/FillQuoteTransformer.json", "test/generated-artifacts/FixinCommon.json", "test/generated-artifacts/FixinEIP712.json", @@ -37,7 +37,6 @@ "test/generated-artifacts/FlashWallet.json", "test/generated-artifacts/FullMigration.json", "test/generated-artifacts/IAllowanceTarget.json", - "test/generated-artifacts/IBootstrap.json", "test/generated-artifacts/IBridgeAdapter.json", "test/generated-artifacts/IERC20Bridge.json", "test/generated-artifacts/IERC20Transformer.json", @@ -45,13 +44,14 @@ "test/generated-artifacts/IFeature.json", "test/generated-artifacts/IFlashWallet.json", "test/generated-artifacts/IGasToken.json", - "test/generated-artifacts/IMetaTransactions.json", - "test/generated-artifacts/IOwnable.json", - "test/generated-artifacts/ISignatureValidator.json", - "test/generated-artifacts/ISimpleFunctionRegistry.json", + "test/generated-artifacts/IMetaTransactionsFeature.json", + "test/generated-artifacts/IOwnableFeature.json", + "test/generated-artifacts/ISignatureValidatorFeature.json", + "test/generated-artifacts/ISimpleFunctionRegistryFeature.json", "test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json", - "test/generated-artifacts/ITokenSpender.json", - "test/generated-artifacts/ITransformERC20.json", + "test/generated-artifacts/ITokenSpenderFeature.json", + "test/generated-artifacts/ITransformERC20Feature.json", + "test/generated-artifacts/IUniswapV2Feature.json", "test/generated-artifacts/IZeroEx.json", "test/generated-artifacts/InitialMigration.json", "test/generated-artifacts/LibBootstrap.json", @@ -76,7 +76,6 @@ "test/generated-artifacts/LibTransformERC20Storage.json", "test/generated-artifacts/LibWalletRichErrors.json", "test/generated-artifacts/LogMetadataTransformer.json", - "test/generated-artifacts/MetaTransactions.json", "test/generated-artifacts/MixinAdapterAddresses.json", "test/generated-artifacts/MixinBalancer.json", "test/generated-artifacts/MixinCurve.json", @@ -87,9 +86,11 @@ "test/generated-artifacts/MixinUniswapV2.json", "test/generated-artifacts/MixinZeroExBridge.json", "test/generated-artifacts/Ownable.json", + "test/generated-artifacts/MetaTransactionsFeature.json", + "test/generated-artifacts/OwnableFeature.json", "test/generated-artifacts/PayTakerTransformer.json", - "test/generated-artifacts/SignatureValidator.json", - "test/generated-artifacts/SimpleFunctionRegistry.json", + "test/generated-artifacts/SignatureValidatorFeature.json", + "test/generated-artifacts/SimpleFunctionRegistryFeature.json", "test/generated-artifacts/TestCallTarget.json", "test/generated-artifacts/TestDelegateCaller.json", "test/generated-artifacts/TestFillQuoteTransformerBridge.json", @@ -112,8 +113,8 @@ "test/generated-artifacts/TestWeth.json", "test/generated-artifacts/TestWethTransformerHost.json", "test/generated-artifacts/TestZeroExFeature.json", - "test/generated-artifacts/TokenSpender.json", - "test/generated-artifacts/TransformERC20.json", + "test/generated-artifacts/TokenSpenderFeature.json", + "test/generated-artifacts/TransformERC20Feature.json", "test/generated-artifacts/Transformer.json", "test/generated-artifacts/TransformerDeployer.json", "test/generated-artifacts/WethTransformer.json", diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json index c1697f5304..85b3890512 100644 --- a/packages/asset-swapper/CHANGELOG.json +++ b/packages/asset-swapper/CHANGELOG.json @@ -89,6 +89,10 @@ { "note": "Add `refundReceiver` to `ExchangeProxySwapQuoteConsumer` options.", "pr": 2657 + }, + { + "note": "Use `IZeroExContract` in EP swap quote consumer.", + "pr": "TODO" } ] }, diff --git a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts index 5ae52bca13..d69f31b160 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts @@ -1,5 +1,5 @@ import { ContractAddresses } from '@0x/contract-addresses'; -import { ITransformERC20Contract } from '@0x/contract-wrappers'; +import { IZeroExContract } from '@0x/contract-wrappers'; import { encodeAffiliateFeeTransformerData, encodeFillQuoteTransformerData, @@ -43,7 +43,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { affiliateFeeTransformer: number; }; - private readonly _transformFeature: ITransformERC20Contract; + private readonly _exchangeProxy: IZeroExContract; constructor( supportedProvider: SupportedProvider, @@ -56,7 +56,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { this.provider = provider; this.chainId = chainId; this.contractAddresses = contractAddresses; - this._transformFeature = new ITransformERC20Contract(contractAddresses.exchangeProxy, supportedProvider); + this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, supportedProvider); this.transformerNonces = { wethTransformer: findTransformerNonce( contractAddresses.transformers.wethTransformer, @@ -194,7 +194,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { }); const minBuyAmount = BigNumber.max(0, quote.worstCaseQuoteInfo.makerAssetAmount.minus(buyTokenFeeAmount)); - const calldataHexString = this._transformFeature + const calldataHexString = this._exchangeProxy .transformERC20( isFromETH ? ETH_TOKEN_ADDRESS : sellToken, isToETH ? ETH_TOKEN_ADDRESS : buyToken, @@ -212,7 +212,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { return { calldataHexString, ethAmount, - toAddress: this._transformFeature.address, + toAddress: this._exchangeProxy.address, allowanceTarget: this.contractAddresses.exchangeProxyAllowanceTarget, }; } diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 7430065450..f8aaafb220 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -13,6 +13,10 @@ { "note": "Add bancorBridge to addresses", "pr": 2650 + }, + { + "note": "Update EP migration.", + "pr": "TODO" } ] }, diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 30b4734b16..e885e26770 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -31,8 +31,7 @@ import { BridgeAdapterContract, FillQuoteTransformerContract, fullMigrateAsync as fullMigrateExchangeProxyAsync, - ITokenSpenderContract, - ITransformERC20Contract, + IZeroExContract, PayTakerTransformerContract, WethTransformerContract, } from '@0x/contracts-zero-ex'; @@ -330,16 +329,8 @@ export async function runMigrationsAsync( ); const exchangeProxy = await fullMigrateExchangeProxyAsync(txDefaults.from, provider, txDefaults); - const exchangeProxyAllowanceTargetAddress = await new ITokenSpenderContract( - exchangeProxy.address, - provider, - txDefaults, - ) - .getAllowanceTarget() - .callAsync(); - const exchangeProxyFlashWalletAddress = await new ITransformERC20Contract(exchangeProxy.address, provider) - .getTransformWallet() - .callAsync(); + const exchangeProxyAllowanceTargetAddress = await exchangeProxy.getAllowanceTarget().callAsync(); + const exchangeProxyFlashWalletAddress = await exchangeProxy.getTransformWallet().callAsync(); // Deploy transformers. const fillQuoteTransformer = await FillQuoteTransformerContract.deployFrom0xArtifactAsync(