@0x/contracts-zero-ex
: Add IUniswapV2Feature
.
`@0x/contracts-zero-ex`: Rename all feature contracts to have `Feature` suffix. `@0x/contracts-zero-ex`: Return an `IZeroExContract` instance from `fullMigrateAsync()`.
This commit is contained in:
parent
9b6703398e
commit
e7ad7c3af7
@ -25,6 +25,18 @@
|
|||||||
{
|
{
|
||||||
"note": "Add `LogMetadataTransformer`",
|
"note": "Add `LogMetadataTransformer`",
|
||||||
"pr": 2657
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -19,22 +19,22 @@
|
|||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "./features/IOwnable.sol";
|
import "./features/IOwnableFeature.sol";
|
||||||
import "./features/ISimpleFunctionRegistry.sol";
|
import "./features/ISimpleFunctionRegistryFeature.sol";
|
||||||
import "./features/ITokenSpender.sol";
|
import "./features/ITokenSpenderFeature.sol";
|
||||||
import "./features/ISignatureValidator.sol";
|
import "./features/ISignatureValidatorFeature.sol";
|
||||||
import "./features/ITransformERC20.sol";
|
import "./features/ITransformERC20Feature.sol";
|
||||||
import "./features/IMetaTransactions.sol";
|
import "./features/IMetaTransactionsFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Interface for a fully featured Exchange Proxy.
|
/// @dev Interface for a fully featured Exchange Proxy.
|
||||||
interface IZeroEx is
|
interface IZeroEx is
|
||||||
IOwnable,
|
IOwnableFeature,
|
||||||
ISimpleFunctionRegistry,
|
ISimpleFunctionRegistryFeature,
|
||||||
ITokenSpender,
|
ITokenSpenderFeature,
|
||||||
ISignatureValidator,
|
ISignatureValidatorFeature,
|
||||||
ITransformERC20,
|
ITransformERC20Feature,
|
||||||
IMetaTransactions
|
IMetaTransactionsFeature
|
||||||
{
|
{
|
||||||
// solhint-disable state-visibility
|
// solhint-disable state-visibility
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
||||||
import "./migrations/LibBootstrap.sol";
|
import "./migrations/LibBootstrap.sol";
|
||||||
import "./features/Bootstrap.sol";
|
import "./features/BootstrapFeature.sol";
|
||||||
import "./storage/LibProxyStorage.sol";
|
import "./storage/LibProxyStorage.sol";
|
||||||
import "./errors/LibProxyRichErrors.sol";
|
import "./errors/LibProxyRichErrors.sol";
|
||||||
|
|
||||||
@ -32,14 +32,14 @@ contract ZeroEx {
|
|||||||
// solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase
|
// solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase
|
||||||
using LibBytesV06 for bytes;
|
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
|
/// After constructing this contract, `bootstrap()` should be called
|
||||||
/// by `bootstrap()` to seed the initial feature set.
|
/// by `bootstrap()` to seed the initial feature set.
|
||||||
/// @param bootstrapper Who can call `bootstrap()`.
|
/// @param bootstrapper Who can call `bootstrap()`.
|
||||||
constructor(address bootstrapper) public {
|
constructor(address bootstrapper) public {
|
||||||
// Temporarily create and register the bootstrap feature.
|
// Temporarily create and register the bootstrap feature.
|
||||||
// It will deregister itself after `bootstrap()` has been called.
|
// 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] =
|
LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] =
|
||||||
address(bootstrap);
|
address(bootstrap);
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,12 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||||
import "../migrations/LibBootstrap.sol";
|
import "../migrations/LibBootstrap.sol";
|
||||||
import "../storage/LibProxyStorage.sol";
|
import "../storage/LibProxyStorage.sol";
|
||||||
import "./IBootstrap.sol";
|
import "./IBootstrapFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Detachable `bootstrap()` feature.
|
/// @dev Detachable `bootstrap()` feature.
|
||||||
contract Bootstrap is
|
contract BootstrapFeature is
|
||||||
IBootstrap
|
IBootstrapFeature
|
||||||
{
|
{
|
||||||
// solhint-disable state-visibility,indent
|
// solhint-disable state-visibility,indent
|
||||||
/// @dev The ZeroEx contract.
|
/// @dev The ZeroEx contract.
|
||||||
@ -69,7 +69,7 @@ contract Bootstrap is
|
|||||||
// Deregister.
|
// Deregister.
|
||||||
LibProxyStorage.getStorage().impls[this.bootstrap.selector] = address(0);
|
LibProxyStorage.getStorage().impls[this.bootstrap.selector] = address(0);
|
||||||
// Self-destruct.
|
// Self-destruct.
|
||||||
Bootstrap(_implementation).die();
|
BootstrapFeature(_implementation).die();
|
||||||
// Call the bootstrapper.
|
// Call the bootstrapper.
|
||||||
LibBootstrap.delegatecallBootstrapFunction(target, callData);
|
LibBootstrap.delegatecallBootstrapFunction(target, callData);
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Detachable `bootstrap()` feature.
|
/// @dev Detachable `bootstrap()` feature.
|
||||||
interface IBootstrap {
|
interface IBootstrapFeature {
|
||||||
|
|
||||||
/// @dev Bootstrap the initial feature set of this contract by delegatecalling
|
/// @dev Bootstrap the initial feature set of this contract by delegatecalling
|
||||||
/// into `target`. Before exiting the `bootstrap()` function will
|
/// into `target`. Before exiting the `bootstrap()` function will
|
@ -23,7 +23,7 @@ import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Meta-transactions feature.
|
/// @dev Meta-transactions feature.
|
||||||
interface IMetaTransactions {
|
interface IMetaTransactionsFeature {
|
||||||
|
|
||||||
/// @dev Describes an exchange proxy meta transaction.
|
/// @dev Describes an exchange proxy meta transaction.
|
||||||
struct MetaTransactionData {
|
struct MetaTransactionData {
|
@ -24,7 +24,7 @@ import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol";
|
|||||||
|
|
||||||
// solhint-disable no-empty-blocks
|
// solhint-disable no-empty-blocks
|
||||||
/// @dev Owner management and migration features.
|
/// @dev Owner management and migration features.
|
||||||
interface IOwnable is
|
interface IOwnableFeature is
|
||||||
IOwnableV06
|
IOwnableV06
|
||||||
{
|
{
|
||||||
/// @dev Emitted when `migrate()` is called.
|
/// @dev Emitted when `migrate()` is called.
|
@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Feature for validating signatures.
|
/// @dev Feature for validating signatures.
|
||||||
interface ISignatureValidator {
|
interface ISignatureValidatorFeature {
|
||||||
|
|
||||||
/// @dev Allowed signature types.
|
/// @dev Allowed signature types.
|
||||||
enum SignatureType {
|
enum SignatureType {
|
@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Basic registry management features.
|
/// @dev Basic registry management features.
|
||||||
interface ISimpleFunctionRegistry {
|
interface ISimpleFunctionRegistryFeature {
|
||||||
|
|
||||||
/// @dev A function implementation was updated via `extend()` or `rollback()`.
|
/// @dev A function implementation was updated via `extend()` or `rollback()`.
|
||||||
/// @param selector The function selector.
|
/// @param selector The function selector.
|
@ -23,7 +23,7 @@ import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Feature that allows spending token allowances.
|
/// @dev Feature that allows spending token allowances.
|
||||||
interface ITokenSpender {
|
interface ITokenSpenderFeature {
|
||||||
|
|
||||||
/// @dev Transfers ERC20 tokens from `owner` to `to`.
|
/// @dev Transfers ERC20 tokens from `owner` to `to`.
|
||||||
/// Only callable from within.
|
/// Only callable from within.
|
@ -25,7 +25,7 @@ import "../external/IFlashWallet.sol";
|
|||||||
|
|
||||||
|
|
||||||
/// @dev Feature to composably transform between ERC20 tokens.
|
/// @dev Feature to composably transform between ERC20 tokens.
|
||||||
interface ITransformERC20 {
|
interface ITransformERC20Feature {
|
||||||
|
|
||||||
/// @dev Defines a transformation to run in `transformERC20()`.
|
/// @dev Defines a transformation to run in `transformERC20()`.
|
||||||
struct Transformation {
|
struct Transformation {
|
@ -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);
|
||||||
|
}
|
@ -29,17 +29,17 @@ import "../fixins/FixinEIP712.sol";
|
|||||||
import "../migrations/LibMigrate.sol";
|
import "../migrations/LibMigrate.sol";
|
||||||
import "../storage/LibMetaTransactionsStorage.sol";
|
import "../storage/LibMetaTransactionsStorage.sol";
|
||||||
import "./libs/LibSignedCallData.sol";
|
import "./libs/LibSignedCallData.sol";
|
||||||
import "./IMetaTransactions.sol";
|
import "./IMetaTransactionsFeature.sol";
|
||||||
import "./ITransformERC20.sol";
|
import "./ITransformERC20Feature.sol";
|
||||||
import "./ISignatureValidator.sol";
|
import "./ISignatureValidatorFeature.sol";
|
||||||
import "./ITokenSpender.sol";
|
import "./ITokenSpenderFeature.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev MetaTransactions feature.
|
/// @dev MetaTransactions feature.
|
||||||
contract MetaTransactions is
|
contract MetaTransactionsFeature is
|
||||||
IFeature,
|
IFeature,
|
||||||
IMetaTransactions,
|
IMetaTransactionsFeature,
|
||||||
FixinCommon,
|
FixinCommon,
|
||||||
FixinReentrancyGuard,
|
FixinReentrancyGuard,
|
||||||
FixinEIP712
|
FixinEIP712
|
||||||
@ -72,7 +72,7 @@ contract MetaTransactions is
|
|||||||
IERC20TokenV06 outputToken;
|
IERC20TokenV06 outputToken;
|
||||||
uint256 inputTokenAmount;
|
uint256 inputTokenAmount;
|
||||||
uint256 minOutputTokenAmount;
|
uint256 minOutputTokenAmount;
|
||||||
ITransformERC20.Transformation[] transformations;
|
ITransformERC20Feature.Transformation[] transformations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Name of this feature.
|
/// @dev Name of this feature.
|
||||||
@ -279,7 +279,7 @@ contract MetaTransactions is
|
|||||||
|
|
||||||
// Pay the fee to the sender.
|
// Pay the fee to the sender.
|
||||||
if (mtx.feeAmount > 0) {
|
if (mtx.feeAmount > 0) {
|
||||||
ITokenSpender(address(this))._spendERC20Tokens(
|
ITokenSpenderFeature(address(this))._spendERC20Tokens(
|
||||||
mtx.feeToken,
|
mtx.feeToken,
|
||||||
mtx.signer, // From the signer.
|
mtx.signer, // From the signer.
|
||||||
sender, // To the sender.
|
sender, // To the sender.
|
||||||
@ -289,7 +289,7 @@ contract MetaTransactions is
|
|||||||
|
|
||||||
// Execute the call based on the selector.
|
// Execute the call based on the selector.
|
||||||
state.selector = mtx.callData.readBytes4(0);
|
state.selector = mtx.callData.readBytes4(0);
|
||||||
if (state.selector == ITransformERC20.transformERC20.selector) {
|
if (state.selector == ITransformERC20Feature.transformERC20.selector) {
|
||||||
returnResult = _executeTransformERC20Call(state);
|
returnResult = _executeTransformERC20Call(state);
|
||||||
} else {
|
} else {
|
||||||
LibMetaTransactionsRichErrors
|
LibMetaTransactionsRichErrors
|
||||||
@ -349,7 +349,7 @@ contract MetaTransactions is
|
|||||||
}
|
}
|
||||||
// Must be signed by signer.
|
// Must be signed by signer.
|
||||||
try
|
try
|
||||||
ISignatureValidator(address(this))
|
ISignatureValidatorFeature(address(this))
|
||||||
.validateHashSignature(state.hash, state.mtx.signer, state.signature)
|
.validateHashSignature(state.hash, state.mtx.signer, state.signature)
|
||||||
{}
|
{}
|
||||||
catch (bytes memory err) {
|
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
|
/// 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.
|
/// the taker address.
|
||||||
function _executeTransformERC20Call(ExecuteState memory state)
|
function _executeTransformERC20Call(ExecuteState memory state)
|
||||||
private
|
private
|
||||||
@ -426,19 +426,19 @@ contract MetaTransactions is
|
|||||||
toMem := add(encodedStructArgs, 64)
|
toMem := add(encodedStructArgs, 64)
|
||||||
}
|
}
|
||||||
LibBytesV06.memCopy(toMem, fromMem, fromCallData.length - 4);
|
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));
|
args = abi.decode(encodedStructArgs, (ExternalTransformERC20Args));
|
||||||
}
|
}
|
||||||
// Parse the signature and hash out of the calldata so `_transformERC20()`
|
// Parse the signature and hash out of the calldata so `_transformERC20()`
|
||||||
// can authenticate it.
|
// can authenticate it.
|
||||||
(bytes32 callDataHash, bytes memory callDataSignature) =
|
(bytes32 callDataHash, bytes memory callDataSignature) =
|
||||||
LibSignedCallData.parseCallData(state.mtx.callData);
|
LibSignedCallData.parseCallData(state.mtx.callData);
|
||||||
// Call `ITransformERC20._transformERC20()` (internal variant).
|
// Call `ITransformERC20Feature._transformERC20()` (internal variant).
|
||||||
return _callSelf(
|
return _callSelf(
|
||||||
state.hash,
|
state.hash,
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
ITransformERC20._transformERC20.selector,
|
ITransformERC20Feature._transformERC20.selector,
|
||||||
ITransformERC20.TransformERC20Args({
|
ITransformERC20Feature.TransformERC20Args({
|
||||||
taker: state.mtx.signer, // taker is mtx signer
|
taker: state.mtx.signer, // taker is mtx signer
|
||||||
inputToken: args.inputToken,
|
inputToken: args.inputToken,
|
||||||
outputToken: args.outputToken,
|
outputToken: args.outputToken,
|
@ -26,14 +26,14 @@ import "../storage/LibOwnableStorage.sol";
|
|||||||
import "../migrations/LibBootstrap.sol";
|
import "../migrations/LibBootstrap.sol";
|
||||||
import "../migrations/LibMigrate.sol";
|
import "../migrations/LibMigrate.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
import "./IOwnable.sol";
|
import "./IOwnableFeature.sol";
|
||||||
import "./SimpleFunctionRegistry.sol";
|
import "./SimpleFunctionRegistryFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Owner management features.
|
/// @dev Owner management features.
|
||||||
contract Ownable is
|
contract OwnableFeature is
|
||||||
IFeature,
|
IFeature,
|
||||||
IOwnable,
|
IOwnableFeature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ contract Ownable is
|
|||||||
LibOwnableStorage.getStorage().owner = address(this);
|
LibOwnableStorage.getStorage().owner = address(this);
|
||||||
|
|
||||||
// Register feature functions.
|
// Register feature functions.
|
||||||
SimpleFunctionRegistry(address(this))._extendSelf(this.transferOwnership.selector, _implementation);
|
SimpleFunctionRegistryFeature(address(this))._extendSelf(this.transferOwnership.selector, _implementation);
|
||||||
SimpleFunctionRegistry(address(this))._extendSelf(this.owner.selector, _implementation);
|
SimpleFunctionRegistryFeature(address(this))._extendSelf(this.owner.selector, _implementation);
|
||||||
SimpleFunctionRegistry(address(this))._extendSelf(this.migrate.selector, _implementation);
|
SimpleFunctionRegistryFeature(address(this))._extendSelf(this.migrate.selector, _implementation);
|
||||||
return LibBootstrap.BOOTSTRAP_SUCCESS;
|
return LibBootstrap.BOOTSTRAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
@ -24,14 +24,14 @@ import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
|||||||
import "../errors/LibSignatureRichErrors.sol";
|
import "../errors/LibSignatureRichErrors.sol";
|
||||||
import "../fixins/FixinCommon.sol";
|
import "../fixins/FixinCommon.sol";
|
||||||
import "../migrations/LibMigrate.sol";
|
import "../migrations/LibMigrate.sol";
|
||||||
import "./ISignatureValidator.sol";
|
import "./ISignatureValidatorFeature.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Feature for validating signatures.
|
/// @dev Feature for validating signatures.
|
||||||
contract SignatureValidator is
|
contract SignatureValidatorFeature is
|
||||||
IFeature,
|
IFeature,
|
||||||
ISignatureValidator,
|
ISignatureValidatorFeature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
using LibBytesV06 for bytes;
|
using LibBytesV06 for bytes;
|
@ -26,13 +26,13 @@ import "../storage/LibSimpleFunctionRegistryStorage.sol";
|
|||||||
import "../errors/LibSimpleFunctionRegistryRichErrors.sol";
|
import "../errors/LibSimpleFunctionRegistryRichErrors.sol";
|
||||||
import "../migrations/LibBootstrap.sol";
|
import "../migrations/LibBootstrap.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
import "./ISimpleFunctionRegistry.sol";
|
import "./ISimpleFunctionRegistryFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Basic registry management features.
|
/// @dev Basic registry management features.
|
||||||
contract SimpleFunctionRegistry is
|
contract SimpleFunctionRegistryFeature is
|
||||||
IFeature,
|
IFeature,
|
||||||
ISimpleFunctionRegistry,
|
ISimpleFunctionRegistryFeature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
/// @dev Name of this feature.
|
/// @dev Name of this feature.
|
@ -28,15 +28,14 @@ import "../fixins/FixinCommon.sol";
|
|||||||
import "../migrations/LibMigrate.sol";
|
import "../migrations/LibMigrate.sol";
|
||||||
import "../external/IAllowanceTarget.sol";
|
import "../external/IAllowanceTarget.sol";
|
||||||
import "../storage/LibTokenSpenderStorage.sol";
|
import "../storage/LibTokenSpenderStorage.sol";
|
||||||
import "./ITokenSpender.sol";
|
import "./ITokenSpenderFeature.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
import "./ISimpleFunctionRegistry.sol";
|
|
||||||
|
|
||||||
|
|
||||||
/// @dev Feature that allows spending token allowances.
|
/// @dev Feature that allows spending token allowances.
|
||||||
contract TokenSpender is
|
contract TokenSpenderFeature is
|
||||||
IFeature,
|
IFeature,
|
||||||
ITokenSpender,
|
ITokenSpenderFeature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
// solhint-disable
|
// solhint-disable
|
@ -32,17 +32,16 @@ import "../storage/LibTransformERC20Storage.sol";
|
|||||||
import "../transformers/IERC20Transformer.sol";
|
import "../transformers/IERC20Transformer.sol";
|
||||||
import "../transformers/LibERC20Transformer.sol";
|
import "../transformers/LibERC20Transformer.sol";
|
||||||
import "./libs/LibSignedCallData.sol";
|
import "./libs/LibSignedCallData.sol";
|
||||||
import "./ITransformERC20.sol";
|
import "./ITransformERC20Feature.sol";
|
||||||
import "./ITokenSpender.sol";
|
import "./ITokenSpenderFeature.sol";
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
import "./ISignatureValidator.sol";
|
import "./ISignatureValidatorFeature.sol";
|
||||||
import "./ISimpleFunctionRegistry.sol";
|
|
||||||
|
|
||||||
|
|
||||||
/// @dev Feature to composably transform between ERC20 tokens.
|
/// @dev Feature to composably transform between ERC20 tokens.
|
||||||
contract TransformERC20 is
|
contract TransformERC20Feature is
|
||||||
IFeature,
|
IFeature,
|
||||||
ITransformERC20,
|
ITransformERC20Feature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
@ -209,7 +208,7 @@ contract TransformERC20 is
|
|||||||
// If the input token amount is -1, transform the taker's entire
|
// If the input token amount is -1, transform the taker's entire
|
||||||
// spendable balance.
|
// spendable balance.
|
||||||
if (args.inputTokenAmount == uint256(-1)) {
|
if (args.inputTokenAmount == uint256(-1)) {
|
||||||
args.inputTokenAmount = ITokenSpender(address(this))
|
args.inputTokenAmount = ITokenSpenderFeature(address(this))
|
||||||
.getSpendableERC20BalanceOf(args.inputToken, args.taker);
|
.getSpendableERC20BalanceOf(args.inputToken, args.taker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +312,7 @@ contract TransformERC20 is
|
|||||||
// Transfer input tokens.
|
// Transfer input tokens.
|
||||||
if (!LibERC20Transformer.isTokenETH(inputToken)) {
|
if (!LibERC20Transformer.isTokenETH(inputToken)) {
|
||||||
// Token is not ETH, so pull ERC20 tokens.
|
// Token is not ETH, so pull ERC20 tokens.
|
||||||
ITokenSpender(address(this))._spendERC20Tokens(
|
ITokenSpenderFeature(address(this))._spendERC20Tokens(
|
||||||
inputToken,
|
inputToken,
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
@ -391,7 +390,7 @@ contract TransformERC20 is
|
|||||||
return bytes32(0);
|
return bytes32(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISignatureValidator(address(this)).isValidHashSignature(
|
if (ISignatureValidatorFeature(address(this)).isValidHashSignature(
|
||||||
callDataHash,
|
callDataHash,
|
||||||
getQuoteSigner(),
|
getQuoteSigner(),
|
||||||
signature
|
signature
|
@ -22,8 +22,8 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||||
import "../errors/LibCommonRichErrors.sol";
|
import "../errors/LibCommonRichErrors.sol";
|
||||||
import "../errors/LibOwnableRichErrors.sol";
|
import "../errors/LibOwnableRichErrors.sol";
|
||||||
import "../features/IOwnable.sol";
|
import "../features/IOwnableFeature.sol";
|
||||||
import "../features/ISimpleFunctionRegistry.sol";
|
import "../features/ISimpleFunctionRegistryFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
/// @dev Common feature utilities.
|
/// @dev Common feature utilities.
|
||||||
@ -45,7 +45,7 @@ abstract contract FixinCommon {
|
|||||||
/// @dev The caller of this function must be the owner.
|
/// @dev The caller of this function must be the owner.
|
||||||
modifier onlyOwner() virtual {
|
modifier onlyOwner() virtual {
|
||||||
{
|
{
|
||||||
address owner = IOwnable(address(this)).owner();
|
address owner = IOwnableFeature(address(this)).owner();
|
||||||
if (msg.sender != owner) {
|
if (msg.sender != owner) {
|
||||||
LibOwnableRichErrors.OnlyOwnerError(
|
LibOwnableRichErrors.OnlyOwnerError(
|
||||||
msg.sender,
|
msg.sender,
|
||||||
@ -68,7 +68,7 @@ abstract contract FixinCommon {
|
|||||||
function _registerFeatureFunction(bytes4 selector)
|
function _registerFeatureFunction(bytes4 selector)
|
||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
ISimpleFunctionRegistry(address(this)).extend(selector, _implementation);
|
ISimpleFunctionRegistryFeature(address(this)).extend(selector, _implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Encode a feature version as a `uint256`.
|
/// @dev Encode a feature version as a `uint256`.
|
||||||
|
@ -22,7 +22,6 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||||
import "../errors/LibCommonRichErrors.sol";
|
import "../errors/LibCommonRichErrors.sol";
|
||||||
import "../errors/LibOwnableRichErrors.sol";
|
import "../errors/LibOwnableRichErrors.sol";
|
||||||
import "../features/IOwnable.sol";
|
|
||||||
|
|
||||||
|
|
||||||
/// @dev EIP712 helpers for features.
|
/// @dev EIP712 helpers for features.
|
||||||
|
@ -20,11 +20,11 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../ZeroEx.sol";
|
import "../ZeroEx.sol";
|
||||||
import "../features/IOwnable.sol";
|
import "../features/IOwnableFeature.sol";
|
||||||
import "../features/TokenSpender.sol";
|
import "../features/TokenSpenderFeature.sol";
|
||||||
import "../features/TransformERC20.sol";
|
import "../features/TransformERC20Feature.sol";
|
||||||
import "../features/SignatureValidator.sol";
|
import "../features/SignatureValidatorFeature.sol";
|
||||||
import "../features/MetaTransactions.sol";
|
import "../features/MetaTransactionsFeature.sol";
|
||||||
import "../external/AllowanceTarget.sol";
|
import "../external/AllowanceTarget.sol";
|
||||||
import "./InitialMigration.sol";
|
import "./InitialMigration.sol";
|
||||||
|
|
||||||
@ -36,12 +36,12 @@ contract FullMigration {
|
|||||||
|
|
||||||
/// @dev Features to add the the proxy contract.
|
/// @dev Features to add the the proxy contract.
|
||||||
struct Features {
|
struct Features {
|
||||||
SimpleFunctionRegistry registry;
|
SimpleFunctionRegistryFeature registry;
|
||||||
Ownable ownable;
|
OwnableFeature ownable;
|
||||||
TokenSpender tokenSpender;
|
TokenSpenderFeature tokenSpender;
|
||||||
TransformERC20 transformERC20;
|
TransformERC20Feature transformERC20;
|
||||||
SignatureValidator signatureValidator;
|
SignatureValidatorFeature signatureValidator;
|
||||||
MetaTransactions metaTransactions;
|
MetaTransactionsFeature metaTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Parameters needed to initialize features.
|
/// @dev Parameters needed to initialize features.
|
||||||
@ -109,7 +109,7 @@ contract FullMigration {
|
|||||||
_addFeatures(zeroEx, owner, features, migrateOpts);
|
_addFeatures(zeroEx, owner, features, migrateOpts);
|
||||||
|
|
||||||
// Transfer ownership to the real owner.
|
// Transfer ownership to the real owner.
|
||||||
IOwnable(address(zeroEx)).transferOwnership(owner);
|
IOwnableFeature(address(zeroEx)).transferOwnership(owner);
|
||||||
|
|
||||||
// Self-destruct.
|
// Self-destruct.
|
||||||
this.die(owner);
|
this.die(owner);
|
||||||
@ -142,8 +142,8 @@ contract FullMigration {
|
|||||||
)
|
)
|
||||||
private
|
private
|
||||||
{
|
{
|
||||||
IOwnable ownable = IOwnable(address(zeroEx));
|
IOwnableFeature ownable = IOwnableFeature(address(zeroEx));
|
||||||
// TokenSpender
|
// TokenSpenderFeature
|
||||||
{
|
{
|
||||||
// Create the allowance target.
|
// Create the allowance target.
|
||||||
AllowanceTarget allowanceTarget = new AllowanceTarget();
|
AllowanceTarget allowanceTarget = new AllowanceTarget();
|
||||||
@ -155,42 +155,42 @@ contract FullMigration {
|
|||||||
ownable.migrate(
|
ownable.migrate(
|
||||||
address(features.tokenSpender),
|
address(features.tokenSpender),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
TokenSpender.migrate.selector,
|
TokenSpenderFeature.migrate.selector,
|
||||||
allowanceTarget
|
allowanceTarget
|
||||||
),
|
),
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// TransformERC20
|
// TransformERC20Feature
|
||||||
{
|
{
|
||||||
// Register the feature.
|
// Register the feature.
|
||||||
ownable.migrate(
|
ownable.migrate(
|
||||||
address(features.transformERC20),
|
address(features.transformERC20),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
TransformERC20.migrate.selector,
|
TransformERC20Feature.migrate.selector,
|
||||||
migrateOpts.transformerDeployer
|
migrateOpts.transformerDeployer
|
||||||
),
|
),
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// SignatureValidator
|
// SignatureValidatorFeature
|
||||||
{
|
{
|
||||||
// Register the feature.
|
// Register the feature.
|
||||||
ownable.migrate(
|
ownable.migrate(
|
||||||
address(features.signatureValidator),
|
address(features.signatureValidator),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
SignatureValidator.migrate.selector
|
SignatureValidatorFeature.migrate.selector
|
||||||
),
|
),
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// MetaTransactions
|
// MetaTransactionsFeature
|
||||||
{
|
{
|
||||||
// Register the feature.
|
// Register the feature.
|
||||||
ownable.migrate(
|
ownable.migrate(
|
||||||
address(features.metaTransactions),
|
address(features.metaTransactions),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
MetaTransactions.migrate.selector
|
MetaTransactionsFeature.migrate.selector
|
||||||
),
|
),
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
|
@ -20,9 +20,9 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../ZeroEx.sol";
|
import "../ZeroEx.sol";
|
||||||
import "../features/IBootstrap.sol";
|
import "../features/IBootstrapFeature.sol";
|
||||||
import "../features/SimpleFunctionRegistry.sol";
|
import "../features/SimpleFunctionRegistryFeature.sol";
|
||||||
import "../features/Ownable.sol";
|
import "../features/OwnableFeature.sol";
|
||||||
import "./LibBootstrap.sol";
|
import "./LibBootstrap.sol";
|
||||||
|
|
||||||
|
|
||||||
@ -31,8 +31,8 @@ contract InitialMigration {
|
|||||||
|
|
||||||
/// @dev Features to bootstrap into the the proxy contract.
|
/// @dev Features to bootstrap into the the proxy contract.
|
||||||
struct BootstrapFeatures {
|
struct BootstrapFeatures {
|
||||||
SimpleFunctionRegistry registry;
|
SimpleFunctionRegistryFeature registry;
|
||||||
Ownable ownable;
|
OwnableFeature ownable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev The allowed caller of `initializeZeroEx()`. In production, this would be
|
/// @dev The allowed caller of `initializeZeroEx()`. In production, this would be
|
||||||
@ -70,7 +70,7 @@ contract InitialMigration {
|
|||||||
require(msg.sender == initializeCaller, "InitialMigration/INVALID_SENDER");
|
require(msg.sender == initializeCaller, "InitialMigration/INVALID_SENDER");
|
||||||
|
|
||||||
// Bootstrap the initial feature set.
|
// Bootstrap the initial feature set.
|
||||||
IBootstrap(address(zeroEx)).bootstrap(
|
IBootstrapFeature(address(zeroEx)).bootstrap(
|
||||||
address(this),
|
address(this),
|
||||||
abi.encodeWithSelector(this.bootstrap.selector, owner, features)
|
abi.encodeWithSelector(this.bootstrap.selector, owner, features)
|
||||||
);
|
);
|
||||||
@ -99,26 +99,26 @@ contract InitialMigration {
|
|||||||
LibBootstrap.delegatecallBootstrapFunction(
|
LibBootstrap.delegatecallBootstrapFunction(
|
||||||
address(features.registry),
|
address(features.registry),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
SimpleFunctionRegistry.bootstrap.selector
|
SimpleFunctionRegistryFeature.bootstrap.selector
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Initialize Ownable.
|
// Initialize OwnableFeature.
|
||||||
LibBootstrap.delegatecallBootstrapFunction(
|
LibBootstrap.delegatecallBootstrapFunction(
|
||||||
address(features.ownable),
|
address(features.ownable),
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
Ownable.bootstrap.selector
|
OwnableFeature.bootstrap.selector
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// De-register `SimpleFunctionRegistry._extendSelf`.
|
// De-register `SimpleFunctionRegistryFeature._extendSelf`.
|
||||||
SimpleFunctionRegistry(address(this)).rollback(
|
SimpleFunctionRegistryFeature(address(this)).rollback(
|
||||||
SimpleFunctionRegistry._extendSelf.selector,
|
SimpleFunctionRegistryFeature._extendSelf.selector,
|
||||||
address(0)
|
address(0)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Transfer ownership to the real owner.
|
// Transfer ownership to the real owner.
|
||||||
Ownable(address(this)).transferOwnership(owner);
|
OwnableFeature(address(this)).transferOwnership(owner);
|
||||||
|
|
||||||
success = LibBootstrap.BOOTSTRAP_SUCCESS;
|
success = LibBootstrap.BOOTSTRAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/ZeroEx.sol";
|
import "../src/ZeroEx.sol";
|
||||||
import "../src/features/IBootstrap.sol";
|
|
||||||
import "../src/migrations/FullMigration.sol";
|
import "../src/migrations/FullMigration.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/ZeroEx.sol";
|
import "../src/ZeroEx.sol";
|
||||||
import "../src/features/IBootstrap.sol";
|
import "../src/features/IBootstrapFeature.sol";
|
||||||
import "../src/migrations/InitialMigration.sol";
|
import "../src/migrations/InitialMigration.sol";
|
||||||
|
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ contract TestInitialMigration is
|
|||||||
constructor(address deployer) public InitialMigration(deployer) {}
|
constructor(address deployer) public InitialMigration(deployer) {}
|
||||||
|
|
||||||
function callBootstrap(ZeroEx zeroEx) external {
|
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)
|
function bootstrap(address owner, BootstrapFeatures memory features)
|
||||||
@ -45,7 +45,7 @@ contract TestInitialMigration is
|
|||||||
success = InitialMigration.bootstrap(owner, features);
|
success = InitialMigration.bootstrap(owner, features);
|
||||||
// Snoop the bootstrap feature contract.
|
// Snoop the bootstrap feature contract.
|
||||||
bootstrapFeature = ZeroEx(address(uint160(address(this))))
|
bootstrapFeature = ZeroEx(address(uint160(address(this))))
|
||||||
.getFunctionImplementation(IBootstrap.bootstrap.selector);
|
.getFunctionImplementation(IBootstrapFeature.bootstrap.selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
function die(address payable ethRecipient) public override {
|
function die(address payable ethRecipient) public override {
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/features/TransformERC20.sol";
|
import "../src/features/TransformERC20Feature.sol";
|
||||||
import "../src/features/IMetaTransactions.sol";
|
import "../src/features/IMetaTransactionsFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
contract TestMetaTransactionsTransformERC20Feature is
|
contract TestMetaTransactionsTransformERC20Feature is
|
||||||
TransformERC20
|
TransformERC20Feature
|
||||||
{
|
{
|
||||||
event TransformERC20Called(
|
event TransformERC20Called(
|
||||||
address sender,
|
address sender,
|
||||||
@ -51,8 +51,8 @@ contract TestMetaTransactionsTransformERC20Feature is
|
|||||||
|
|
||||||
if (msg.value == 777) {
|
if (msg.value == 777) {
|
||||||
// Try to reenter `executeMetaTransaction()`
|
// Try to reenter `executeMetaTransaction()`
|
||||||
IMetaTransactions(address(this)).executeMetaTransaction(
|
IMetaTransactionsFeature(address(this)).executeMetaTransaction(
|
||||||
IMetaTransactions.MetaTransactionData({
|
IMetaTransactionsFeature.MetaTransactionData({
|
||||||
signer: address(0),
|
signer: address(0),
|
||||||
sender: address(0),
|
sender: address(0),
|
||||||
minGasPrice: 0,
|
minGasPrice: 0,
|
||||||
@ -70,10 +70,10 @@ contract TestMetaTransactionsTransformERC20Feature is
|
|||||||
|
|
||||||
if (msg.value == 888) {
|
if (msg.value == 888) {
|
||||||
// Try to reenter `batchExecuteMetaTransactions()`
|
// Try to reenter `batchExecuteMetaTransactions()`
|
||||||
IMetaTransactions.MetaTransactionData[] memory mtxs =
|
IMetaTransactionsFeature.MetaTransactionData[] memory mtxs =
|
||||||
new IMetaTransactions.MetaTransactionData[](1);
|
new IMetaTransactionsFeature.MetaTransactionData[](1);
|
||||||
bytes[] memory signatures = new bytes[](1);
|
bytes[] memory signatures = new bytes[](1);
|
||||||
mtxs[0] = IMetaTransactions.MetaTransactionData({
|
mtxs[0] = IMetaTransactionsFeature.MetaTransactionData({
|
||||||
signer: address(0),
|
signer: address(0),
|
||||||
sender: address(0),
|
sender: address(0),
|
||||||
minGasPrice: 0,
|
minGasPrice: 0,
|
||||||
@ -86,7 +86,7 @@ contract TestMetaTransactionsTransformERC20Feature is
|
|||||||
feeAmount: 0
|
feeAmount: 0
|
||||||
});
|
});
|
||||||
signatures[0] = "";
|
signatures[0] = "";
|
||||||
IMetaTransactions(address(this)).batchExecuteMetaTransactions(
|
IMetaTransactionsFeature(address(this)).batchExecuteMetaTransactions(
|
||||||
mtxs,
|
mtxs,
|
||||||
signatures
|
signatures
|
||||||
);
|
);
|
||||||
|
@ -20,7 +20,7 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/migrations/LibMigrate.sol";
|
import "../src/migrations/LibMigrate.sol";
|
||||||
import "../src/features/IOwnable.sol";
|
import "../src/features/IOwnableFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
contract TestMigrator {
|
contract TestMigrator {
|
||||||
@ -32,7 +32,7 @@ contract TestMigrator {
|
|||||||
function succeedingMigrate() external returns (bytes4 success) {
|
function succeedingMigrate() external returns (bytes4 success) {
|
||||||
emit TestMigrateCalled(
|
emit TestMigrateCalled(
|
||||||
msg.data,
|
msg.data,
|
||||||
IOwnable(address(this)).owner()
|
IOwnableFeature(address(this)).owner()
|
||||||
);
|
);
|
||||||
return LibMigrate.MIGRATE_SUCCESS;
|
return LibMigrate.MIGRATE_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ contract TestMigrator {
|
|||||||
function failingMigrate() external returns (bytes4 success) {
|
function failingMigrate() external returns (bytes4 success) {
|
||||||
emit TestMigrateCalled(
|
emit TestMigrateCalled(
|
||||||
msg.data,
|
msg.data,
|
||||||
IOwnable(address(this)).owner()
|
IOwnableFeature(address(this)).owner()
|
||||||
);
|
);
|
||||||
return 0xdeadbeef;
|
return 0xdeadbeef;
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/features/TokenSpender.sol";
|
import "../src/features/TokenSpenderFeature.sol";
|
||||||
|
|
||||||
contract TestTokenSpender is
|
contract TestTokenSpender is
|
||||||
TokenSpender
|
TokenSpenderFeature
|
||||||
{
|
{
|
||||||
modifier onlySelf() override {
|
modifier onlySelf() override {
|
||||||
_;
|
_;
|
||||||
|
@ -19,18 +19,12 @@
|
|||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../src/features/TransformERC20.sol";
|
import "../src/features/TransformERC20Feature.sol";
|
||||||
|
|
||||||
|
|
||||||
contract TestTransformERC20 is
|
contract TestTransformERC20 is
|
||||||
TransformERC20
|
TransformERC20Feature
|
||||||
{
|
{
|
||||||
// solhint-disable no-empty-blocks
|
|
||||||
constructor()
|
|
||||||
TransformERC20()
|
|
||||||
public
|
|
||||||
{}
|
|
||||||
|
|
||||||
modifier onlySelf() override {
|
modifier onlySelf() override {
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
"publish:private": "yarn build && gitpkg publish"
|
"publish:private": "yarn build && gitpkg publish"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnable,ISimpleFunctionRegistry,ITokenSpender,ITransformERC20,FillQuoteTransformer,PayTakerTransformer,WethTransformer,Ownable,SimpleFunctionRegistry,TransformERC20,TokenSpender,AffiliateFeeTransformer,SignatureValidator,MetaTransactions,LogMetadataTransformer",
|
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITokenSpenderFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,TokenSpenderFeature,AffiliateFeeTransformer,SignatureValidatorFeature,MetaTransactionsFeature,LogMetadataTransformer",
|
||||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|Bootstrap|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinGasToken|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrap|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|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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -12,19 +12,19 @@ import * as IAllowanceTarget from '../generated-artifacts/IAllowanceTarget.json'
|
|||||||
import * as IERC20Transformer from '../generated-artifacts/IERC20Transformer.json';
|
import * as IERC20Transformer from '../generated-artifacts/IERC20Transformer.json';
|
||||||
import * as IFlashWallet from '../generated-artifacts/IFlashWallet.json';
|
import * as IFlashWallet from '../generated-artifacts/IFlashWallet.json';
|
||||||
import * as InitialMigration from '../generated-artifacts/InitialMigration.json';
|
import * as InitialMigration from '../generated-artifacts/InitialMigration.json';
|
||||||
import * as IOwnable from '../generated-artifacts/IOwnable.json';
|
import * as IOwnableFeature from '../generated-artifacts/IOwnableFeature.json';
|
||||||
import * as ISimpleFunctionRegistry from '../generated-artifacts/ISimpleFunctionRegistry.json';
|
import * as ISimpleFunctionRegistryFeature from '../generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
||||||
import * as ITokenSpender from '../generated-artifacts/ITokenSpender.json';
|
import * as ITokenSpenderFeature from '../generated-artifacts/ITokenSpenderFeature.json';
|
||||||
import * as ITransformERC20 from '../generated-artifacts/ITransformERC20.json';
|
import * as ITransformERC20Feature from '../generated-artifacts/ITransformERC20Feature.json';
|
||||||
import * as IZeroEx from '../generated-artifacts/IZeroEx.json';
|
import * as IZeroEx from '../generated-artifacts/IZeroEx.json';
|
||||||
import * as LogMetadataTransformer from '../generated-artifacts/LogMetadataTransformer.json';
|
import * as LogMetadataTransformer from '../generated-artifacts/LogMetadataTransformer.json';
|
||||||
import * as MetaTransactions from '../generated-artifacts/MetaTransactions.json';
|
import * as MetaTransactionsFeature from '../generated-artifacts/MetaTransactionsFeature.json';
|
||||||
import * as Ownable from '../generated-artifacts/Ownable.json';
|
import * as OwnableFeature from '../generated-artifacts/OwnableFeature.json';
|
||||||
import * as PayTakerTransformer from '../generated-artifacts/PayTakerTransformer.json';
|
import * as PayTakerTransformer from '../generated-artifacts/PayTakerTransformer.json';
|
||||||
import * as SignatureValidator from '../generated-artifacts/SignatureValidator.json';
|
import * as SignatureValidatorFeature from '../generated-artifacts/SignatureValidatorFeature.json';
|
||||||
import * as SimpleFunctionRegistry from '../generated-artifacts/SimpleFunctionRegistry.json';
|
import * as SimpleFunctionRegistryFeature from '../generated-artifacts/SimpleFunctionRegistryFeature.json';
|
||||||
import * as TokenSpender from '../generated-artifacts/TokenSpender.json';
|
import * as TokenSpenderFeature from '../generated-artifacts/TokenSpenderFeature.json';
|
||||||
import * as TransformERC20 from '../generated-artifacts/TransformERC20.json';
|
import * as TransformERC20Feature from '../generated-artifacts/TransformERC20Feature.json';
|
||||||
import * as WethTransformer from '../generated-artifacts/WethTransformer.json';
|
import * as WethTransformer from '../generated-artifacts/WethTransformer.json';
|
||||||
import * as ZeroEx from '../generated-artifacts/ZeroEx.json';
|
import * as ZeroEx from '../generated-artifacts/ZeroEx.json';
|
||||||
export const artifacts = {
|
export const artifacts = {
|
||||||
@ -35,19 +35,19 @@ export const artifacts = {
|
|||||||
IFlashWallet: IFlashWallet as ContractArtifact,
|
IFlashWallet: IFlashWallet as ContractArtifact,
|
||||||
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
||||||
IERC20Transformer: IERC20Transformer as ContractArtifact,
|
IERC20Transformer: IERC20Transformer as ContractArtifact,
|
||||||
IOwnable: IOwnable as ContractArtifact,
|
IOwnableFeature: IOwnableFeature as ContractArtifact,
|
||||||
ISimpleFunctionRegistry: ISimpleFunctionRegistry as ContractArtifact,
|
ISimpleFunctionRegistryFeature: ISimpleFunctionRegistryFeature as ContractArtifact,
|
||||||
ITokenSpender: ITokenSpender as ContractArtifact,
|
ITokenSpenderFeature: ITokenSpenderFeature as ContractArtifact,
|
||||||
ITransformERC20: ITransformERC20 as ContractArtifact,
|
ITransformERC20Feature: ITransformERC20Feature as ContractArtifact,
|
||||||
FillQuoteTransformer: FillQuoteTransformer as ContractArtifact,
|
FillQuoteTransformer: FillQuoteTransformer as ContractArtifact,
|
||||||
PayTakerTransformer: PayTakerTransformer as ContractArtifact,
|
PayTakerTransformer: PayTakerTransformer as ContractArtifact,
|
||||||
WethTransformer: WethTransformer as ContractArtifact,
|
WethTransformer: WethTransformer as ContractArtifact,
|
||||||
Ownable: Ownable as ContractArtifact,
|
OwnableFeature: OwnableFeature as ContractArtifact,
|
||||||
SimpleFunctionRegistry: SimpleFunctionRegistry as ContractArtifact,
|
SimpleFunctionRegistryFeature: SimpleFunctionRegistryFeature as ContractArtifact,
|
||||||
TransformERC20: TransformERC20 as ContractArtifact,
|
TransformERC20Feature: TransformERC20Feature as ContractArtifact,
|
||||||
TokenSpender: TokenSpender as ContractArtifact,
|
TokenSpenderFeature: TokenSpenderFeature as ContractArtifact,
|
||||||
AffiliateFeeTransformer: AffiliateFeeTransformer as ContractArtifact,
|
AffiliateFeeTransformer: AffiliateFeeTransformer as ContractArtifact,
|
||||||
SignatureValidator: SignatureValidator as ContractArtifact,
|
SignatureValidatorFeature: SignatureValidatorFeature as ContractArtifact,
|
||||||
MetaTransactions: MetaTransactions as ContractArtifact,
|
MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact,
|
||||||
LogMetadataTransformer: LogMetadataTransformer as ContractArtifact,
|
LogMetadataTransformer: LogMetadataTransformer as ContractArtifact,
|
||||||
};
|
};
|
||||||
|
@ -2,12 +2,12 @@ export { artifacts } from './artifacts';
|
|||||||
export {
|
export {
|
||||||
AffiliateFeeTransformerContract,
|
AffiliateFeeTransformerContract,
|
||||||
FillQuoteTransformerContract,
|
FillQuoteTransformerContract,
|
||||||
IOwnableContract,
|
IOwnableFeatureContract,
|
||||||
IOwnableEvents,
|
IOwnableFeatureEvents,
|
||||||
ISimpleFunctionRegistryContract,
|
ISimpleFunctionRegistryFeatureContract,
|
||||||
ISimpleFunctionRegistryEvents,
|
ISimpleFunctionRegistryFeatureEvents,
|
||||||
ITokenSpenderContract,
|
ITokenSpenderFeatureContract,
|
||||||
ITransformERC20Contract,
|
ITransformERC20FeatureContract,
|
||||||
IZeroExContract,
|
IZeroExContract,
|
||||||
LogMetadataTransformerContract,
|
LogMetadataTransformerContract,
|
||||||
PayTakerTransformerContract,
|
PayTakerTransformerContract,
|
||||||
|
@ -6,12 +6,13 @@ import { artifacts } from './artifacts';
|
|||||||
import {
|
import {
|
||||||
FullMigrationContract,
|
FullMigrationContract,
|
||||||
InitialMigrationContract,
|
InitialMigrationContract,
|
||||||
MetaTransactionsContract,
|
IZeroExContract,
|
||||||
OwnableContract,
|
MetaTransactionsFeatureContract,
|
||||||
SignatureValidatorContract,
|
OwnableFeatureContract,
|
||||||
SimpleFunctionRegistryContract,
|
SignatureValidatorFeatureContract,
|
||||||
TokenSpenderContract,
|
SimpleFunctionRegistryFeatureContract,
|
||||||
TransformERC20Contract,
|
TokenSpenderFeatureContract,
|
||||||
|
TransformERC20FeatureContract,
|
||||||
ZeroExContract,
|
ZeroExContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
|
|
||||||
@ -36,15 +37,15 @@ export async function deployBootstrapFeaturesAsync(
|
|||||||
return {
|
return {
|
||||||
registry:
|
registry:
|
||||||
features.registry ||
|
features.registry ||
|
||||||
(await SimpleFunctionRegistryContract.deployFrom0xArtifactAsync(
|
(await SimpleFunctionRegistryFeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.SimpleFunctionRegistry,
|
artifacts.SimpleFunctionRegistryFeature,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
)).address,
|
)).address,
|
||||||
ownable:
|
ownable:
|
||||||
features.ownable ||
|
features.ownable ||
|
||||||
(await OwnableContract.deployFrom0xArtifactAsync(artifacts.Ownable, provider, txDefaults, artifacts))
|
(await OwnableFeatureContract.deployFrom0xArtifactAsync(artifacts.OwnableFeature, provider, txDefaults, artifacts))
|
||||||
.address,
|
.address,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -107,32 +108,32 @@ export async function deployFullFeaturesAsync(
|
|||||||
...(await deployBootstrapFeaturesAsync(provider, txDefaults)),
|
...(await deployBootstrapFeaturesAsync(provider, txDefaults)),
|
||||||
tokenSpender:
|
tokenSpender:
|
||||||
features.tokenSpender ||
|
features.tokenSpender ||
|
||||||
(await TokenSpenderContract.deployFrom0xArtifactAsync(
|
(await TokenSpenderFeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenSpender,
|
artifacts.TokenSpenderFeature,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
)).address,
|
)).address,
|
||||||
transformERC20:
|
transformERC20:
|
||||||
features.transformERC20 ||
|
features.transformERC20 ||
|
||||||
(await TransformERC20Contract.deployFrom0xArtifactAsync(
|
(await TransformERC20FeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TransformERC20,
|
artifacts.TransformERC20Feature,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
)).address,
|
)).address,
|
||||||
signatureValidator:
|
signatureValidator:
|
||||||
features.signatureValidator ||
|
features.signatureValidator ||
|
||||||
(await SignatureValidatorContract.deployFrom0xArtifactAsync(
|
(await SignatureValidatorFeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.SignatureValidator,
|
artifacts.SignatureValidatorFeature,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
)).address,
|
)).address,
|
||||||
metaTransactions:
|
metaTransactions:
|
||||||
features.metaTransactions ||
|
features.metaTransactions ||
|
||||||
(await MetaTransactionsContract.deployFrom0xArtifactAsync(
|
(await MetaTransactionsFeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MetaTransactions,
|
artifacts.MetaTransactionsFeature,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
@ -150,7 +151,7 @@ export async function fullMigrateAsync(
|
|||||||
txDefaults: Partial<TxData>,
|
txDefaults: Partial<TxData>,
|
||||||
features: Partial<FullFeatures> = {},
|
features: Partial<FullFeatures> = {},
|
||||||
opts: Partial<FullMigrationOpts> = {},
|
opts: Partial<FullMigrationOpts> = {},
|
||||||
): Promise<ZeroExContract> {
|
): Promise<IZeroExContract> {
|
||||||
const migrator = await FullMigrationContract.deployFrom0xArtifactAsync(
|
const migrator = await FullMigrationContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.FullMigration,
|
artifacts.FullMigration,
|
||||||
provider,
|
provider,
|
||||||
@ -171,5 +172,5 @@ export async function fullMigrateAsync(
|
|||||||
...opts,
|
...opts,
|
||||||
};
|
};
|
||||||
await migrator.initializeZeroEx(owner, zeroEx.address, _features, _opts).awaitTransactionSuccessAsync();
|
await migrator.initializeZeroEx(owner, zeroEx.address, _features, _opts).awaitTransactionSuccessAsync();
|
||||||
return zeroEx;
|
return new IZeroExContract(zeroEx.address, provider, txDefaults);
|
||||||
}
|
}
|
||||||
|
@ -9,19 +9,19 @@ export * from '../generated-wrappers/full_migration';
|
|||||||
export * from '../generated-wrappers/i_allowance_target';
|
export * from '../generated-wrappers/i_allowance_target';
|
||||||
export * from '../generated-wrappers/i_erc20_transformer';
|
export * from '../generated-wrappers/i_erc20_transformer';
|
||||||
export * from '../generated-wrappers/i_flash_wallet';
|
export * from '../generated-wrappers/i_flash_wallet';
|
||||||
export * from '../generated-wrappers/i_ownable';
|
export * from '../generated-wrappers/i_ownable_feature';
|
||||||
export * from '../generated-wrappers/i_simple_function_registry';
|
export * from '../generated-wrappers/i_simple_function_registry_feature';
|
||||||
export * from '../generated-wrappers/i_token_spender';
|
export * from '../generated-wrappers/i_token_spender_feature';
|
||||||
export * from '../generated-wrappers/i_transform_erc20';
|
export * from '../generated-wrappers/i_transform_erc20_feature';
|
||||||
export * from '../generated-wrappers/i_zero_ex';
|
export * from '../generated-wrappers/i_zero_ex';
|
||||||
export * from '../generated-wrappers/initial_migration';
|
export * from '../generated-wrappers/initial_migration';
|
||||||
export * from '../generated-wrappers/log_metadata_transformer';
|
export * from '../generated-wrappers/log_metadata_transformer';
|
||||||
export * from '../generated-wrappers/meta_transactions';
|
export * from '../generated-wrappers/meta_transactions_feature';
|
||||||
export * from '../generated-wrappers/ownable';
|
export * from '../generated-wrappers/ownable_feature';
|
||||||
export * from '../generated-wrappers/pay_taker_transformer';
|
export * from '../generated-wrappers/pay_taker_transformer';
|
||||||
export * from '../generated-wrappers/signature_validator';
|
export * from '../generated-wrappers/signature_validator_feature';
|
||||||
export * from '../generated-wrappers/simple_function_registry';
|
export * from '../generated-wrappers/simple_function_registry_feature';
|
||||||
export * from '../generated-wrappers/token_spender';
|
export * from '../generated-wrappers/token_spender_feature';
|
||||||
export * from '../generated-wrappers/transform_erc20';
|
export * from '../generated-wrappers/transform_erc20_feature';
|
||||||
export * from '../generated-wrappers/weth_transformer';
|
export * from '../generated-wrappers/weth_transformer';
|
||||||
export * from '../generated-wrappers/zero_ex';
|
export * from '../generated-wrappers/zero_ex';
|
||||||
|
@ -7,7 +7,7 @@ import { ContractArtifact } from 'ethereum-types';
|
|||||||
|
|
||||||
import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json';
|
import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json';
|
||||||
import * as AllowanceTarget from '../test/generated-artifacts/AllowanceTarget.json';
|
import * as AllowanceTarget from '../test/generated-artifacts/AllowanceTarget.json';
|
||||||
import * as Bootstrap from '../test/generated-artifacts/Bootstrap.json';
|
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
|
||||||
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
||||||
import * as FixinCommon from '../test/generated-artifacts/FixinCommon.json';
|
import * as FixinCommon from '../test/generated-artifacts/FixinCommon.json';
|
||||||
import * as FixinEIP712 from '../test/generated-artifacts/FixinEIP712.json';
|
import * as FixinEIP712 from '../test/generated-artifacts/FixinEIP712.json';
|
||||||
@ -16,21 +16,22 @@ import * as FixinReentrancyGuard from '../test/generated-artifacts/FixinReentran
|
|||||||
import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json';
|
import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json';
|
||||||
import * as FullMigration from '../test/generated-artifacts/FullMigration.json';
|
import * as FullMigration from '../test/generated-artifacts/FullMigration.json';
|
||||||
import * as IAllowanceTarget from '../test/generated-artifacts/IAllowanceTarget.json';
|
import * as IAllowanceTarget from '../test/generated-artifacts/IAllowanceTarget.json';
|
||||||
import * as IBootstrap from '../test/generated-artifacts/IBootstrap.json';
|
import * as IBootstrapFeature from '../test/generated-artifacts/IBootstrapFeature.json';
|
||||||
import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json';
|
import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json';
|
||||||
import * as IERC20Transformer from '../test/generated-artifacts/IERC20Transformer.json';
|
import * as IERC20Transformer from '../test/generated-artifacts/IERC20Transformer.json';
|
||||||
import * as IExchange from '../test/generated-artifacts/IExchange.json';
|
import * as IExchange from '../test/generated-artifacts/IExchange.json';
|
||||||
import * as IFeature from '../test/generated-artifacts/IFeature.json';
|
import * as IFeature from '../test/generated-artifacts/IFeature.json';
|
||||||
import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json';
|
import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json';
|
||||||
import * as IGasToken from '../test/generated-artifacts/IGasToken.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 InitialMigration from '../test/generated-artifacts/InitialMigration.json';
|
||||||
import * as IOwnable from '../test/generated-artifacts/IOwnable.json';
|
import * as IOwnableFeature from '../test/generated-artifacts/IOwnableFeature.json';
|
||||||
import * as ISignatureValidator from '../test/generated-artifacts/ISignatureValidator.json';
|
import * as ISignatureValidatorFeature from '../test/generated-artifacts/ISignatureValidatorFeature.json';
|
||||||
import * as ISimpleFunctionRegistry from '../test/generated-artifacts/ISimpleFunctionRegistry.json';
|
import * as ISimpleFunctionRegistryFeature from '../test/generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
||||||
import * as ITestSimpleFunctionRegistryFeature from '../test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json';
|
import * as ITestSimpleFunctionRegistryFeature from '../test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json';
|
||||||
import * as ITokenSpender from '../test/generated-artifacts/ITokenSpender.json';
|
import * as ITokenSpenderFeature from '../test/generated-artifacts/ITokenSpenderFeature.json';
|
||||||
import * as ITransformERC20 from '../test/generated-artifacts/ITransformERC20.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 IZeroEx from '../test/generated-artifacts/IZeroEx.json';
|
||||||
import * as LibBootstrap from '../test/generated-artifacts/LibBootstrap.json';
|
import * as LibBootstrap from '../test/generated-artifacts/LibBootstrap.json';
|
||||||
import * as LibCommonRichErrors from '../test/generated-artifacts/LibCommonRichErrors.json';
|
import * as LibCommonRichErrors from '../test/generated-artifacts/LibCommonRichErrors.json';
|
||||||
@ -54,11 +55,11 @@ import * as LibTransformERC20RichErrors from '../test/generated-artifacts/LibTra
|
|||||||
import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json';
|
import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json';
|
||||||
import * as LibWalletRichErrors from '../test/generated-artifacts/LibWalletRichErrors.json';
|
import * as LibWalletRichErrors from '../test/generated-artifacts/LibWalletRichErrors.json';
|
||||||
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
||||||
import * as MetaTransactions from '../test/generated-artifacts/MetaTransactions.json';
|
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
||||||
import * as Ownable from '../test/generated-artifacts/Ownable.json';
|
import * as OwnableFeature from '../test/generated-artifacts/OwnableFeature.json';
|
||||||
import * as PayTakerTransformer from '../test/generated-artifacts/PayTakerTransformer.json';
|
import * as PayTakerTransformer from '../test/generated-artifacts/PayTakerTransformer.json';
|
||||||
import * as SignatureValidator from '../test/generated-artifacts/SignatureValidator.json';
|
import * as SignatureValidatorFeature from '../test/generated-artifacts/SignatureValidatorFeature.json';
|
||||||
import * as SimpleFunctionRegistry from '../test/generated-artifacts/SimpleFunctionRegistry.json';
|
import * as SimpleFunctionRegistryFeature from '../test/generated-artifacts/SimpleFunctionRegistryFeature.json';
|
||||||
import * as TestCallTarget from '../test/generated-artifacts/TestCallTarget.json';
|
import * as TestCallTarget from '../test/generated-artifacts/TestCallTarget.json';
|
||||||
import * as TestDelegateCaller from '../test/generated-artifacts/TestDelegateCaller.json';
|
import * as TestDelegateCaller from '../test/generated-artifacts/TestDelegateCaller.json';
|
||||||
import * as TestFillQuoteTransformerBridge from '../test/generated-artifacts/TestFillQuoteTransformerBridge.json';
|
import * as TestFillQuoteTransformerBridge from '../test/generated-artifacts/TestFillQuoteTransformerBridge.json';
|
||||||
@ -81,9 +82,9 @@ import * as TestTransformerHost from '../test/generated-artifacts/TestTransforme
|
|||||||
import * as TestWeth from '../test/generated-artifacts/TestWeth.json';
|
import * as TestWeth from '../test/generated-artifacts/TestWeth.json';
|
||||||
import * as TestWethTransformerHost from '../test/generated-artifacts/TestWethTransformerHost.json';
|
import * as TestWethTransformerHost from '../test/generated-artifacts/TestWethTransformerHost.json';
|
||||||
import * as TestZeroExFeature from '../test/generated-artifacts/TestZeroExFeature.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 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 TransformerDeployer from '../test/generated-artifacts/TransformerDeployer.json';
|
||||||
import * as WethTransformer from '../test/generated-artifacts/WethTransformer.json';
|
import * as WethTransformer from '../test/generated-artifacts/WethTransformer.json';
|
||||||
import * as ZeroEx from '../test/generated-artifacts/ZeroEx.json';
|
import * as ZeroEx from '../test/generated-artifacts/ZeroEx.json';
|
||||||
@ -104,21 +105,22 @@ export const artifacts = {
|
|||||||
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
||||||
IFlashWallet: IFlashWallet as ContractArtifact,
|
IFlashWallet: IFlashWallet as ContractArtifact,
|
||||||
TransformerDeployer: TransformerDeployer as ContractArtifact,
|
TransformerDeployer: TransformerDeployer as ContractArtifact,
|
||||||
Bootstrap: Bootstrap as ContractArtifact,
|
BootstrapFeature: BootstrapFeature as ContractArtifact,
|
||||||
IBootstrap: IBootstrap as ContractArtifact,
|
IBootstrapFeature: IBootstrapFeature as ContractArtifact,
|
||||||
IFeature: IFeature as ContractArtifact,
|
IFeature: IFeature as ContractArtifact,
|
||||||
IMetaTransactions: IMetaTransactions as ContractArtifact,
|
IMetaTransactionsFeature: IMetaTransactionsFeature as ContractArtifact,
|
||||||
IOwnable: IOwnable as ContractArtifact,
|
IOwnableFeature: IOwnableFeature as ContractArtifact,
|
||||||
ISignatureValidator: ISignatureValidator as ContractArtifact,
|
ISignatureValidatorFeature: ISignatureValidatorFeature as ContractArtifact,
|
||||||
ISimpleFunctionRegistry: ISimpleFunctionRegistry as ContractArtifact,
|
ISimpleFunctionRegistryFeature: ISimpleFunctionRegistryFeature as ContractArtifact,
|
||||||
ITokenSpender: ITokenSpender as ContractArtifact,
|
ITokenSpenderFeature: ITokenSpenderFeature as ContractArtifact,
|
||||||
ITransformERC20: ITransformERC20 as ContractArtifact,
|
ITransformERC20Feature: ITransformERC20Feature as ContractArtifact,
|
||||||
MetaTransactions: MetaTransactions as ContractArtifact,
|
IUniswapV2Feature: IUniswapV2Feature as ContractArtifact,
|
||||||
Ownable: Ownable as ContractArtifact,
|
MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact,
|
||||||
SignatureValidator: SignatureValidator as ContractArtifact,
|
OwnableFeature: OwnableFeature as ContractArtifact,
|
||||||
SimpleFunctionRegistry: SimpleFunctionRegistry as ContractArtifact,
|
SignatureValidatorFeature: SignatureValidatorFeature as ContractArtifact,
|
||||||
TokenSpender: TokenSpender as ContractArtifact,
|
SimpleFunctionRegistryFeature: SimpleFunctionRegistryFeature as ContractArtifact,
|
||||||
TransformERC20: TransformERC20 as ContractArtifact,
|
TokenSpenderFeature: TokenSpenderFeature as ContractArtifact,
|
||||||
|
TransformERC20Feature: TransformERC20Feature as ContractArtifact,
|
||||||
LibSignedCallData: LibSignedCallData as ContractArtifact,
|
LibSignedCallData: LibSignedCallData as ContractArtifact,
|
||||||
FixinCommon: FixinCommon as ContractArtifact,
|
FixinCommon: FixinCommon as ContractArtifact,
|
||||||
FixinEIP712: FixinEIP712 as ContractArtifact,
|
FixinEIP712: FixinEIP712 as ContractArtifact,
|
||||||
|
@ -12,12 +12,12 @@ import { BigNumber, hexUtils, StringRevertError, ZeroExRevertErrors } from '@0x/
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { generateCallDataSignature, signCallData } from '../../src/signed_call_data';
|
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 { artifacts } from '../artifacts';
|
||||||
import { abis } from '../utils/abis';
|
import { abis } from '../utils/abis';
|
||||||
import { fullMigrateAsync } from '../utils/migration';
|
import { fullMigrateAsync } from '../utils/migration';
|
||||||
import {
|
import {
|
||||||
ITokenSpenderContract,
|
ITokenSpenderFeatureContract,
|
||||||
TestMetaTransactionsTransformERC20FeatureContract,
|
TestMetaTransactionsTransformERC20FeatureContract,
|
||||||
TestMetaTransactionsTransformERC20FeatureEvents,
|
TestMetaTransactionsTransformERC20FeatureEvents,
|
||||||
TestMintableERC20TokenContract,
|
TestMintableERC20TokenContract,
|
||||||
@ -29,8 +29,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
|||||||
let owner: string;
|
let owner: string;
|
||||||
let sender: string;
|
let sender: string;
|
||||||
let signers: string[];
|
let signers: string[];
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: IZeroExContract;
|
||||||
let feature: MetaTransactionsContract;
|
let feature: MetaTransactionsFeatureContract;
|
||||||
let feeToken: TestMintableERC20TokenContract;
|
let feeToken: TestMintableERC20TokenContract;
|
||||||
let transformERC20Feature: TestMetaTransactionsTransformERC20FeatureContract;
|
let transformERC20Feature: TestMetaTransactionsTransformERC20FeatureContract;
|
||||||
let allowanceTarget: string;
|
let allowanceTarget: string;
|
||||||
@ -52,14 +52,14 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
|||||||
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
|
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
|
||||||
transformERC20: transformERC20Feature.address,
|
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(
|
feeToken = await TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestMintableERC20Token,
|
artifacts.TestMintableERC20Token,
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
allowanceTarget = await new ITokenSpenderContract(zeroEx.address, env.provider, env.txDefaults)
|
allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults)
|
||||||
.getAllowanceTarget()
|
.getAllowanceTarget()
|
||||||
.callAsync();
|
.callAsync();
|
||||||
// Fund signers with fee tokens.
|
// Fund signers with fee tokens.
|
||||||
|
@ -3,12 +3,12 @@ import { hexUtils, OwnableRevertErrors, StringRevertError, ZeroExRevertErrors }
|
|||||||
|
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import { initialMigrateAsync } from '../utils/migration';
|
import { initialMigrateAsync } from '../utils/migration';
|
||||||
import { IOwnableContract, IOwnableEvents, TestMigratorContract, TestMigratorEvents } from '../wrappers';
|
import { IOwnableFeatureContract, IOwnableFeatureEvents, TestMigratorContract, TestMigratorEvents } from '../wrappers';
|
||||||
|
|
||||||
blockchainTests.resets('Ownable feature', env => {
|
blockchainTests.resets('Ownable feature', env => {
|
||||||
const notOwner = randomAddress();
|
const notOwner = randomAddress();
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let ownable: IOwnableContract;
|
let ownable: IOwnableFeatureContract;
|
||||||
let testMigrator: TestMigratorContract;
|
let testMigrator: TestMigratorContract;
|
||||||
let succeedingMigrateFnCallData: string;
|
let succeedingMigrateFnCallData: string;
|
||||||
let failingMigrateFnCallData: string;
|
let failingMigrateFnCallData: string;
|
||||||
@ -19,7 +19,7 @@ blockchainTests.resets('Ownable feature', env => {
|
|||||||
[owner] = await env.getAccountAddressesAsync();
|
[owner] = await env.getAccountAddressesAsync();
|
||||||
logDecoder = new LogDecoder(env.web3Wrapper, artifacts);
|
logDecoder = new LogDecoder(env.web3Wrapper, artifacts);
|
||||||
const zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults);
|
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(
|
testMigrator = await TestMigratorContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestMigrator,
|
artifacts.TestMigrator,
|
||||||
env.provider,
|
env.provider,
|
||||||
@ -49,7 +49,7 @@ blockchainTests.resets('Ownable feature', env => {
|
|||||||
newOwner,
|
newOwner,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
IOwnableEvents.OwnershipTransferred,
|
IOwnableFeatureEvents.OwnershipTransferred,
|
||||||
);
|
);
|
||||||
expect(await ownable.owner().callAsync()).to.eq(newOwner);
|
expect(await ownable.owner().callAsync()).to.eq(newOwner);
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@ import { hexUtils, ZeroExRevertErrors } from '@0x/utils';
|
|||||||
import * as ethjs from 'ethereumjs-util';
|
import * as ethjs from 'ethereumjs-util';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { SignatureValidatorContract, ZeroExContract } from '../../src/wrappers';
|
import { IZeroExContract, SignatureValidatorFeatureContract } from '../../src/wrappers';
|
||||||
import { abis } from '../utils/abis';
|
import { abis } from '../utils/abis';
|
||||||
import { fullMigrateAsync } from '../utils/migration';
|
import { fullMigrateAsync } from '../utils/migration';
|
||||||
|
|
||||||
@ -14,13 +14,13 @@ const { NULL_BYTES } = constants;
|
|||||||
blockchainTests.resets('SignatureValidator feature', env => {
|
blockchainTests.resets('SignatureValidator feature', env => {
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let signers: string[];
|
let signers: string[];
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: IZeroExContract;
|
||||||
let feature: SignatureValidatorContract;
|
let feature: SignatureValidatorFeatureContract;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
[owner, ...signers] = await env.getAccountAddressesAsync();
|
[owner, ...signers] = await env.getAccountAddressesAsync();
|
||||||
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults);
|
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()', () => {
|
describe('validateHashSignature()', () => {
|
||||||
|
@ -5,8 +5,8 @@ import { ZeroExContract } from '../../src/wrappers';
|
|||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import { initialMigrateAsync } from '../utils/migration';
|
import { initialMigrateAsync } from '../utils/migration';
|
||||||
import {
|
import {
|
||||||
ISimpleFunctionRegistryContract,
|
ISimpleFunctionRegistryFeatureContract,
|
||||||
ISimpleFunctionRegistryEvents,
|
ISimpleFunctionRegistryFeatureEvents,
|
||||||
ITestSimpleFunctionRegistryFeatureContract,
|
ITestSimpleFunctionRegistryFeatureContract,
|
||||||
TestSimpleFunctionRegistryFeatureImpl1Contract,
|
TestSimpleFunctionRegistryFeatureImpl1Contract,
|
||||||
TestSimpleFunctionRegistryFeatureImpl2Contract,
|
TestSimpleFunctionRegistryFeatureImpl2Contract,
|
||||||
@ -17,7 +17,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => {
|
|||||||
const notOwner = randomAddress();
|
const notOwner = randomAddress();
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: ZeroExContract;
|
||||||
let registry: ISimpleFunctionRegistryContract;
|
let registry: ISimpleFunctionRegistryFeatureContract;
|
||||||
let testFnSelector: string;
|
let testFnSelector: string;
|
||||||
let testFeature: ITestSimpleFunctionRegistryFeatureContract;
|
let testFeature: ITestSimpleFunctionRegistryFeatureContract;
|
||||||
let testFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1Contract;
|
let testFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1Contract;
|
||||||
@ -26,7 +26,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => {
|
|||||||
before(async () => {
|
before(async () => {
|
||||||
[owner] = await env.getAccountAddressesAsync();
|
[owner] = await env.getAccountAddressesAsync();
|
||||||
zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults);
|
zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults);
|
||||||
registry = new ISimpleFunctionRegistryContract(zeroEx.address, env.provider, {
|
registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, {
|
||||||
...env.txDefaults,
|
...env.txDefaults,
|
||||||
from: owner,
|
from: owner,
|
||||||
});
|
});
|
||||||
@ -75,7 +75,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => {
|
|||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
logs,
|
logs,
|
||||||
[{ selector: testFnSelector, oldImpl: NULL_ADDRESS, newImpl: testFeatureImpl1.address }],
|
[{ selector: testFnSelector, oldImpl: NULL_ADDRESS, newImpl: testFeatureImpl1.address }],
|
||||||
ISimpleFunctionRegistryEvents.ProxyFunctionUpdated,
|
ISimpleFunctionRegistryFeatureEvents.ProxyFunctionUpdated,
|
||||||
);
|
);
|
||||||
const r = await testFeature.testFn().callAsync();
|
const r = await testFeature.testFn().callAsync();
|
||||||
expect(r).to.bignumber.eq(1337);
|
expect(r).to.bignumber.eq(1337);
|
||||||
@ -117,7 +117,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => {
|
|||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
logs,
|
logs,
|
||||||
[{ selector: testFnSelector, oldImpl: testFeatureImpl2.address, newImpl: NULL_ADDRESS }],
|
[{ selector: testFnSelector, oldImpl: testFeatureImpl2.address, newImpl: NULL_ADDRESS }],
|
||||||
ISimpleFunctionRegistryEvents.ProxyFunctionUpdated,
|
ISimpleFunctionRegistryFeatureEvents.ProxyFunctionUpdated,
|
||||||
);
|
);
|
||||||
const rollbackLength = await registry.getRollbackLength(testFnSelector).callAsync();
|
const rollbackLength = await registry.getRollbackLength(testFnSelector).callAsync();
|
||||||
expect(rollbackLength).to.bignumber.eq(0);
|
expect(rollbackLength).to.bignumber.eq(0);
|
||||||
|
@ -7,29 +7,29 @@ import {
|
|||||||
} from '@0x/contracts-test-utils';
|
} from '@0x/contracts-test-utils';
|
||||||
import { BigNumber, hexUtils, StringRevertError, ZeroExRevertErrors } from '@0x/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 { artifacts } from '../artifacts';
|
||||||
import { abis } from '../utils/abis';
|
import { abis } from '../utils/abis';
|
||||||
import { fullMigrateAsync } from '../utils/migration';
|
import { fullMigrateAsync } from '../utils/migration';
|
||||||
import { TestTokenSpenderERC20TokenContract, TestTokenSpenderERC20TokenEvents } from '../wrappers';
|
import { TestTokenSpenderERC20TokenContract, TestTokenSpenderERC20TokenEvents } from '../wrappers';
|
||||||
|
|
||||||
blockchainTests.resets('TokenSpender feature', env => {
|
blockchainTests.resets('TokenSpender feature', env => {
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: IZeroExContract;
|
||||||
let feature: TokenSpenderContract;
|
let feature: TokenSpenderFeatureContract;
|
||||||
let token: TestTokenSpenderERC20TokenContract;
|
let token: TestTokenSpenderERC20TokenContract;
|
||||||
let allowanceTarget: string;
|
let allowanceTarget: string;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
const [owner] = await env.getAccountAddressesAsync();
|
const [owner] = await env.getAccountAddressesAsync();
|
||||||
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
|
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
|
||||||
tokenSpender: (await TokenSpenderContract.deployFrom0xArtifactAsync(
|
tokenSpender: (await TokenSpenderFeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestTokenSpender,
|
artifacts.TestTokenSpender,
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
)).address,
|
)).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(
|
token = await TestTokenSpenderERC20TokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestTokenSpenderERC20Token,
|
artifacts.TestTokenSpenderERC20Token,
|
||||||
env.provider,
|
env.provider,
|
||||||
|
@ -14,18 +14,18 @@ import { DecodedLogEntry } from 'ethereum-types';
|
|||||||
import * as ethjs from 'ethereumjs-util';
|
import * as ethjs from 'ethereumjs-util';
|
||||||
|
|
||||||
import { generateCallDataHashSignature, signCallData } from '../../src/signed_call_data';
|
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 { artifacts } from '../artifacts';
|
||||||
import { abis } from '../utils/abis';
|
import { abis } from '../utils/abis';
|
||||||
import { fullMigrateAsync } from '../utils/migration';
|
import { fullMigrateAsync } from '../utils/migration';
|
||||||
import {
|
import {
|
||||||
FlashWalletContract,
|
FlashWalletContract,
|
||||||
ITokenSpenderContract,
|
ITokenSpenderFeatureContract,
|
||||||
TestMintableERC20TokenContract,
|
TestMintableERC20TokenContract,
|
||||||
TestMintTokenERC20TransformerContract,
|
TestMintTokenERC20TransformerContract,
|
||||||
TestMintTokenERC20TransformerEvents,
|
TestMintTokenERC20TransformerEvents,
|
||||||
TestMintTokenERC20TransformerMintTransformEventArgs,
|
TestMintTokenERC20TransformerMintTransformEventArgs,
|
||||||
TransformERC20Events,
|
TransformERC20FeatureEvents,
|
||||||
} from '../wrappers';
|
} from '../wrappers';
|
||||||
|
|
||||||
const { NULL_BYTES, NULL_BYTES32 } = constants;
|
const { NULL_BYTES, NULL_BYTES32 } = constants;
|
||||||
@ -39,8 +39,8 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
let taker: string;
|
let taker: string;
|
||||||
let sender: string;
|
let sender: string;
|
||||||
let transformerDeployer: string;
|
let transformerDeployer: string;
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: IZeroExContract;
|
||||||
let feature: TransformERC20Contract;
|
let feature: TransformERC20FeatureContract;
|
||||||
let wallet: FlashWalletContract;
|
let wallet: FlashWalletContract;
|
||||||
let allowanceTarget: string;
|
let allowanceTarget: string;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
{
|
{
|
||||||
transformERC20: (await TransformERC20Contract.deployFrom0xArtifactAsync(
|
transformERC20: (await TransformERC20FeatureContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestTransformERC20,
|
artifacts.TestTransformERC20,
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
@ -60,9 +60,9 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
},
|
},
|
||||||
{ transformerDeployer },
|
{ 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);
|
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()
|
.getAllowanceTarget()
|
||||||
.callAsync();
|
.callAsync();
|
||||||
await feature.setQuoteSigner(callDataSigner).awaitTransactionSuccessAsync({ from: owner });
|
await feature.setQuoteSigner(callDataSigner).awaitTransactionSuccessAsync({ from: owner });
|
||||||
@ -99,7 +99,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
receipt.logs,
|
receipt.logs,
|
||||||
[{ transformerDeployer: newDeployer }],
|
[{ transformerDeployer: newDeployer }],
|
||||||
TransformERC20Events.TransformerDeployerUpdated,
|
TransformERC20FeatureEvents.TransformerDeployerUpdated,
|
||||||
);
|
);
|
||||||
const actualDeployer = await feature.getTransformerDeployer().callAsync();
|
const actualDeployer = await feature.getTransformerDeployer().callAsync();
|
||||||
expect(actualDeployer).to.eq(newDeployer);
|
expect(actualDeployer).to.eq(newDeployer);
|
||||||
@ -122,7 +122,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
it('owner can set the quote signer with `setQuoteSigner()`', async () => {
|
it('owner can set the quote signer with `setQuoteSigner()`', async () => {
|
||||||
const newSigner = randomAddress();
|
const newSigner = randomAddress();
|
||||||
const receipt = await feature.setQuoteSigner(newSigner).awaitTransactionSuccessAsync({ from: owner });
|
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();
|
const actualSigner = await feature.getQuoteSigner().callAsync();
|
||||||
expect(actualSigner).to.eq(newSigner);
|
expect(actualSigner).to.eq(newSigner);
|
||||||
});
|
});
|
||||||
@ -259,7 +259,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
outputToken: outputToken.address,
|
outputToken: outputToken.address,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
TransformERC20Events.TransformedERC20,
|
TransformERC20FeatureEvents.TransformedERC20,
|
||||||
);
|
);
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
receipt.logs,
|
receipt.logs,
|
||||||
@ -316,7 +316,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
outputToken: ETH_TOKEN_ADDRESS,
|
outputToken: ETH_TOKEN_ADDRESS,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
TransformERC20Events.TransformedERC20,
|
TransformERC20FeatureEvents.TransformedERC20,
|
||||||
);
|
);
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
receipt.logs,
|
receipt.logs,
|
||||||
@ -376,7 +376,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
|
|||||||
outputToken: outputToken.address,
|
outputToken: outputToken.address,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
TransformERC20Events.TransformedERC20,
|
TransformERC20FeatureEvents.TransformedERC20,
|
||||||
);
|
);
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
receipt.logs,
|
receipt.logs,
|
||||||
|
@ -9,11 +9,11 @@ import { abis } from './utils/abis';
|
|||||||
import { deployFullFeaturesAsync, FullFeatures } from './utils/migration';
|
import { deployFullFeaturesAsync, FullFeatures } from './utils/migration';
|
||||||
import {
|
import {
|
||||||
AllowanceTargetContract,
|
AllowanceTargetContract,
|
||||||
IMetaTransactionsContract,
|
IMetaTransactionsFeatureContract,
|
||||||
IOwnableContract,
|
IOwnableFeatureContract,
|
||||||
ISignatureValidatorContract,
|
ISignatureValidatorFeatureContract,
|
||||||
ITokenSpenderContract,
|
ITokenSpenderFeatureContract,
|
||||||
ITransformERC20Contract,
|
ITransformERC20FeatureContract,
|
||||||
TestFullMigrationContract,
|
TestFullMigrationContract,
|
||||||
ZeroExContract,
|
ZeroExContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
@ -50,7 +50,7 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('ZeroEx has the correct owner', async () => {
|
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();
|
const actualOwner = await ownable.owner().callAsync();
|
||||||
expect(actualOwner).to.eq(owner);
|
expect(actualOwner).to.eq(owner);
|
||||||
});
|
});
|
||||||
@ -70,11 +70,11 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
|
|
||||||
const FEATURE_FNS = {
|
const FEATURE_FNS = {
|
||||||
TokenSpender: {
|
TokenSpender: {
|
||||||
contractType: ITokenSpenderContract,
|
contractType: ITokenSpenderFeatureContract,
|
||||||
fns: ['_spendERC20Tokens'],
|
fns: ['_spendERC20Tokens'],
|
||||||
},
|
},
|
||||||
TransformERC20: {
|
TransformERC20: {
|
||||||
contractType: ITransformERC20Contract,
|
contractType: ITransformERC20FeatureContract,
|
||||||
fns: [
|
fns: [
|
||||||
'transformERC20',
|
'transformERC20',
|
||||||
'_transformERC20',
|
'_transformERC20',
|
||||||
@ -86,11 +86,11 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
SignatureValidator: {
|
SignatureValidator: {
|
||||||
contractType: ISignatureValidatorContract,
|
contractType: ISignatureValidatorFeatureContract,
|
||||||
fns: ['isValidHashSignature', 'validateHashSignature'],
|
fns: ['isValidHashSignature', 'validateHashSignature'],
|
||||||
},
|
},
|
||||||
MetaTransactions: {
|
MetaTransactions: {
|
||||||
contractType: IMetaTransactionsContract,
|
contractType: IMetaTransactionsFeatureContract,
|
||||||
fns: [
|
fns: [
|
||||||
'executeMetaTransaction',
|
'executeMetaTransaction',
|
||||||
'batchExecuteMetaTransactions',
|
'batchExecuteMetaTransactions',
|
||||||
@ -181,7 +181,7 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
let allowanceTarget: AllowanceTargetContract;
|
let allowanceTarget: AllowanceTargetContract;
|
||||||
|
|
||||||
before(async () => {
|
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(
|
allowanceTarget = new AllowanceTargetContract(
|
||||||
await contract.getAllowanceTarget().callAsync(),
|
await contract.getAllowanceTarget().callAsync(),
|
||||||
env.provider,
|
env.provider,
|
||||||
@ -199,10 +199,10 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('TransformERC20', () => {
|
describe('TransformERC20', () => {
|
||||||
let feature: ITransformERC20Contract;
|
let feature: ITransformERC20FeatureContract;
|
||||||
|
|
||||||
before(async () => {
|
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 () => {
|
it('has the correct transformer deployer', async () => {
|
||||||
|
@ -4,10 +4,10 @@ import { hexUtils, ZeroExRevertErrors } from '@0x/utils';
|
|||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { BootstrapFeatures, deployBootstrapFeaturesAsync } from './utils/migration';
|
import { BootstrapFeatures, deployBootstrapFeaturesAsync } from './utils/migration';
|
||||||
import {
|
import {
|
||||||
IBootstrapContract,
|
IBootstrapFeatureContract,
|
||||||
InitialMigrationContract,
|
InitialMigrationContract,
|
||||||
IOwnableContract,
|
IOwnableFeatureContract,
|
||||||
SimpleFunctionRegistryContract,
|
SimpleFunctionRegistryFeatureContract,
|
||||||
TestInitialMigrationContract,
|
TestInitialMigrationContract,
|
||||||
ZeroExContract,
|
ZeroExContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
@ -16,7 +16,7 @@ blockchainTests.resets('Initial migration', env => {
|
|||||||
let owner: string;
|
let owner: string;
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: ZeroExContract;
|
||||||
let migrator: TestInitialMigrationContract;
|
let migrator: TestInitialMigrationContract;
|
||||||
let bootstrapFeature: IBootstrapContract;
|
let bootstrapFeature: IBootstrapFeatureContract;
|
||||||
let features: BootstrapFeatures;
|
let features: BootstrapFeatures;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
@ -29,7 +29,7 @@ blockchainTests.resets('Initial migration', env => {
|
|||||||
artifacts,
|
artifacts,
|
||||||
env.txDefaults.from as string,
|
env.txDefaults.from as string,
|
||||||
);
|
);
|
||||||
bootstrapFeature = new IBootstrapContract(
|
bootstrapFeature = new IBootstrapFeatureContract(
|
||||||
await migrator.bootstrapFeature().callAsync(),
|
await migrator.bootstrapFeature().callAsync(),
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
@ -82,10 +82,10 @@ blockchainTests.resets('Initial migration', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Ownable feature', () => {
|
describe('Ownable feature', () => {
|
||||||
let ownable: IOwnableContract;
|
let ownable: IOwnableFeatureContract;
|
||||||
|
|
||||||
before(async () => {
|
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 () => {
|
it('has the correct owner', async () => {
|
||||||
@ -95,10 +95,10 @@ blockchainTests.resets('Initial migration', env => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('SimpleFunctionRegistry feature', () => {
|
describe('SimpleFunctionRegistry feature', () => {
|
||||||
let registry: SimpleFunctionRegistryContract;
|
let registry: SimpleFunctionRegistryFeatureContract;
|
||||||
|
|
||||||
before(async () => {
|
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 () => {
|
it('_extendSelf() is deregistered', async () => {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
export * from '../test/generated-wrappers/affiliate_fee_transformer';
|
export * from '../test/generated-wrappers/affiliate_fee_transformer';
|
||||||
export * from '../test/generated-wrappers/allowance_target';
|
export * from '../test/generated-wrappers/allowance_target';
|
||||||
export * from '../test/generated-wrappers/bootstrap';
|
export * from '../test/generated-wrappers/bootstrap_feature';
|
||||||
export * from '../test/generated-wrappers/fill_quote_transformer';
|
export * from '../test/generated-wrappers/fill_quote_transformer';
|
||||||
export * from '../test/generated-wrappers/fixin_common';
|
export * from '../test/generated-wrappers/fixin_common';
|
||||||
export * from '../test/generated-wrappers/fixin_e_i_p712';
|
export * from '../test/generated-wrappers/fixin_e_i_p712';
|
||||||
@ -14,20 +14,21 @@ export * from '../test/generated-wrappers/fixin_reentrancy_guard';
|
|||||||
export * from '../test/generated-wrappers/flash_wallet';
|
export * from '../test/generated-wrappers/flash_wallet';
|
||||||
export * from '../test/generated-wrappers/full_migration';
|
export * from '../test/generated-wrappers/full_migration';
|
||||||
export * from '../test/generated-wrappers/i_allowance_target';
|
export * from '../test/generated-wrappers/i_allowance_target';
|
||||||
export * from '../test/generated-wrappers/i_bootstrap';
|
export * from '../test/generated-wrappers/i_bootstrap_feature';
|
||||||
export * from '../test/generated-wrappers/i_erc20_bridge';
|
export * from '../test/generated-wrappers/i_erc20_bridge';
|
||||||
export * from '../test/generated-wrappers/i_erc20_transformer';
|
export * from '../test/generated-wrappers/i_erc20_transformer';
|
||||||
export * from '../test/generated-wrappers/i_exchange';
|
export * from '../test/generated-wrappers/i_exchange';
|
||||||
export * from '../test/generated-wrappers/i_feature';
|
export * from '../test/generated-wrappers/i_feature';
|
||||||
export * from '../test/generated-wrappers/i_flash_wallet';
|
export * from '../test/generated-wrappers/i_flash_wallet';
|
||||||
export * from '../test/generated-wrappers/i_gas_token';
|
export * from '../test/generated-wrappers/i_gas_token';
|
||||||
export * from '../test/generated-wrappers/i_meta_transactions';
|
export * from '../test/generated-wrappers/i_meta_transactions_feature';
|
||||||
export * from '../test/generated-wrappers/i_ownable';
|
export * from '../test/generated-wrappers/i_ownable_feature';
|
||||||
export * from '../test/generated-wrappers/i_signature_validator';
|
export * from '../test/generated-wrappers/i_signature_validator_feature';
|
||||||
export * from '../test/generated-wrappers/i_simple_function_registry';
|
export * from '../test/generated-wrappers/i_simple_function_registry_feature';
|
||||||
export * from '../test/generated-wrappers/i_test_simple_function_registry_feature';
|
export * from '../test/generated-wrappers/i_test_simple_function_registry_feature';
|
||||||
export * from '../test/generated-wrappers/i_token_spender';
|
export * from '../test/generated-wrappers/i_token_spender_feature';
|
||||||
export * from '../test/generated-wrappers/i_transform_erc20';
|
export * from '../test/generated-wrappers/i_transform_erc20_feature';
|
||||||
|
export * from '../test/generated-wrappers/i_uniswap_v2_feature';
|
||||||
export * from '../test/generated-wrappers/i_zero_ex';
|
export * from '../test/generated-wrappers/i_zero_ex';
|
||||||
export * from '../test/generated-wrappers/initial_migration';
|
export * from '../test/generated-wrappers/initial_migration';
|
||||||
export * from '../test/generated-wrappers/lib_bootstrap';
|
export * from '../test/generated-wrappers/lib_bootstrap';
|
||||||
@ -52,11 +53,11 @@ export * from '../test/generated-wrappers/lib_transform_erc20_rich_errors';
|
|||||||
export * from '../test/generated-wrappers/lib_transform_erc20_storage';
|
export * from '../test/generated-wrappers/lib_transform_erc20_storage';
|
||||||
export * from '../test/generated-wrappers/lib_wallet_rich_errors';
|
export * from '../test/generated-wrappers/lib_wallet_rich_errors';
|
||||||
export * from '../test/generated-wrappers/log_metadata_transformer';
|
export * from '../test/generated-wrappers/log_metadata_transformer';
|
||||||
export * from '../test/generated-wrappers/meta_transactions';
|
export * from '../test/generated-wrappers/meta_transactions_feature';
|
||||||
export * from '../test/generated-wrappers/ownable';
|
export * from '../test/generated-wrappers/ownable_feature';
|
||||||
export * from '../test/generated-wrappers/pay_taker_transformer';
|
export * from '../test/generated-wrappers/pay_taker_transformer';
|
||||||
export * from '../test/generated-wrappers/signature_validator';
|
export * from '../test/generated-wrappers/signature_validator_feature';
|
||||||
export * from '../test/generated-wrappers/simple_function_registry';
|
export * from '../test/generated-wrappers/simple_function_registry_feature';
|
||||||
export * from '../test/generated-wrappers/test_call_target';
|
export * from '../test/generated-wrappers/test_call_target';
|
||||||
export * from '../test/generated-wrappers/test_delegate_caller';
|
export * from '../test/generated-wrappers/test_delegate_caller';
|
||||||
export * from '../test/generated-wrappers/test_fill_quote_transformer_bridge';
|
export * from '../test/generated-wrappers/test_fill_quote_transformer_bridge';
|
||||||
@ -79,8 +80,8 @@ export * from '../test/generated-wrappers/test_transformer_host';
|
|||||||
export * from '../test/generated-wrappers/test_weth';
|
export * from '../test/generated-wrappers/test_weth';
|
||||||
export * from '../test/generated-wrappers/test_weth_transformer_host';
|
export * from '../test/generated-wrappers/test_weth_transformer_host';
|
||||||
export * from '../test/generated-wrappers/test_zero_ex_feature';
|
export * from '../test/generated-wrappers/test_zero_ex_feature';
|
||||||
export * from '../test/generated-wrappers/token_spender';
|
export * from '../test/generated-wrappers/token_spender_feature';
|
||||||
export * from '../test/generated-wrappers/transform_erc20';
|
export * from '../test/generated-wrappers/transform_erc20_feature';
|
||||||
export * from '../test/generated-wrappers/transformer';
|
export * from '../test/generated-wrappers/transformer';
|
||||||
export * from '../test/generated-wrappers/transformer_deployer';
|
export * from '../test/generated-wrappers/transformer_deployer';
|
||||||
export * from '../test/generated-wrappers/weth_transformer';
|
export * from '../test/generated-wrappers/weth_transformer';
|
||||||
|
@ -7,8 +7,8 @@ import { artifacts } from './artifacts';
|
|||||||
import { initialMigrateAsync } from './utils/migration';
|
import { initialMigrateAsync } from './utils/migration';
|
||||||
import {
|
import {
|
||||||
IFeatureContract,
|
IFeatureContract,
|
||||||
IOwnableContract,
|
IOwnableFeatureContract,
|
||||||
ISimpleFunctionRegistryContract,
|
ISimpleFunctionRegistryFeatureContract,
|
||||||
TestZeroExFeatureContract,
|
TestZeroExFeatureContract,
|
||||||
TestZeroExFeatureEvents,
|
TestZeroExFeatureEvents,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
@ -16,15 +16,15 @@ import {
|
|||||||
blockchainTests.resets('ZeroEx contract', env => {
|
blockchainTests.resets('ZeroEx contract', env => {
|
||||||
let owner: string;
|
let owner: string;
|
||||||
let zeroEx: ZeroExContract;
|
let zeroEx: ZeroExContract;
|
||||||
let ownable: IOwnableContract;
|
let ownable: IOwnableFeatureContract;
|
||||||
let registry: ISimpleFunctionRegistryContract;
|
let registry: ISimpleFunctionRegistryFeatureContract;
|
||||||
let testFeature: TestZeroExFeatureContract;
|
let testFeature: TestZeroExFeatureContract;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
[owner] = await env.getAccountAddressesAsync();
|
[owner] = await env.getAccountAddressesAsync();
|
||||||
zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults);
|
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);
|
||||||
registry = new ISimpleFunctionRegistryContract(zeroEx.address, env.provider, env.txDefaults);
|
registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||||
testFeature = new TestZeroExFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
testFeature = new TestZeroExFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||||
// Register test features.
|
// Register test features.
|
||||||
const testFeatureImpl = await TestZeroExFeatureContract.deployFrom0xArtifactAsync(
|
const testFeatureImpl = await TestZeroExFeatureContract.deployFrom0xArtifactAsync(
|
||||||
|
@ -9,25 +9,25 @@
|
|||||||
"generated-artifacts/IAllowanceTarget.json",
|
"generated-artifacts/IAllowanceTarget.json",
|
||||||
"generated-artifacts/IERC20Transformer.json",
|
"generated-artifacts/IERC20Transformer.json",
|
||||||
"generated-artifacts/IFlashWallet.json",
|
"generated-artifacts/IFlashWallet.json",
|
||||||
"generated-artifacts/IOwnable.json",
|
"generated-artifacts/IOwnableFeature.json",
|
||||||
"generated-artifacts/ISimpleFunctionRegistry.json",
|
"generated-artifacts/ISimpleFunctionRegistryFeature.json",
|
||||||
"generated-artifacts/ITokenSpender.json",
|
"generated-artifacts/ITokenSpenderFeature.json",
|
||||||
"generated-artifacts/ITransformERC20.json",
|
"generated-artifacts/ITransformERC20Feature.json",
|
||||||
"generated-artifacts/IZeroEx.json",
|
"generated-artifacts/IZeroEx.json",
|
||||||
"generated-artifacts/InitialMigration.json",
|
"generated-artifacts/InitialMigration.json",
|
||||||
"generated-artifacts/LogMetadataTransformer.json",
|
"generated-artifacts/LogMetadataTransformer.json",
|
||||||
"generated-artifacts/MetaTransactions.json",
|
"generated-artifacts/MetaTransactionsFeature.json",
|
||||||
"generated-artifacts/Ownable.json",
|
"generated-artifacts/OwnableFeature.json",
|
||||||
"generated-artifacts/PayTakerTransformer.json",
|
"generated-artifacts/PayTakerTransformer.json",
|
||||||
"generated-artifacts/SignatureValidator.json",
|
"generated-artifacts/SignatureValidatorFeature.json",
|
||||||
"generated-artifacts/SimpleFunctionRegistry.json",
|
"generated-artifacts/SimpleFunctionRegistryFeature.json",
|
||||||
"generated-artifacts/TokenSpender.json",
|
"generated-artifacts/TokenSpenderFeature.json",
|
||||||
"generated-artifacts/TransformERC20.json",
|
"generated-artifacts/TransformERC20Feature.json",
|
||||||
"generated-artifacts/WethTransformer.json",
|
"generated-artifacts/WethTransformer.json",
|
||||||
"generated-artifacts/ZeroEx.json",
|
"generated-artifacts/ZeroEx.json",
|
||||||
"test/generated-artifacts/AffiliateFeeTransformer.json",
|
"test/generated-artifacts/AffiliateFeeTransformer.json",
|
||||||
"test/generated-artifacts/AllowanceTarget.json",
|
"test/generated-artifacts/AllowanceTarget.json",
|
||||||
"test/generated-artifacts/Bootstrap.json",
|
"test/generated-artifacts/BootstrapFeature.json",
|
||||||
"test/generated-artifacts/FillQuoteTransformer.json",
|
"test/generated-artifacts/FillQuoteTransformer.json",
|
||||||
"test/generated-artifacts/FixinCommon.json",
|
"test/generated-artifacts/FixinCommon.json",
|
||||||
"test/generated-artifacts/FixinEIP712.json",
|
"test/generated-artifacts/FixinEIP712.json",
|
||||||
@ -36,20 +36,21 @@
|
|||||||
"test/generated-artifacts/FlashWallet.json",
|
"test/generated-artifacts/FlashWallet.json",
|
||||||
"test/generated-artifacts/FullMigration.json",
|
"test/generated-artifacts/FullMigration.json",
|
||||||
"test/generated-artifacts/IAllowanceTarget.json",
|
"test/generated-artifacts/IAllowanceTarget.json",
|
||||||
"test/generated-artifacts/IBootstrap.json",
|
"test/generated-artifacts/IBootstrapFeature.json",
|
||||||
"test/generated-artifacts/IERC20Bridge.json",
|
"test/generated-artifacts/IERC20Bridge.json",
|
||||||
"test/generated-artifacts/IERC20Transformer.json",
|
"test/generated-artifacts/IERC20Transformer.json",
|
||||||
"test/generated-artifacts/IExchange.json",
|
"test/generated-artifacts/IExchange.json",
|
||||||
"test/generated-artifacts/IFeature.json",
|
"test/generated-artifacts/IFeature.json",
|
||||||
"test/generated-artifacts/IFlashWallet.json",
|
"test/generated-artifacts/IFlashWallet.json",
|
||||||
"test/generated-artifacts/IGasToken.json",
|
"test/generated-artifacts/IGasToken.json",
|
||||||
"test/generated-artifacts/IMetaTransactions.json",
|
"test/generated-artifacts/IMetaTransactionsFeature.json",
|
||||||
"test/generated-artifacts/IOwnable.json",
|
"test/generated-artifacts/IOwnableFeature.json",
|
||||||
"test/generated-artifacts/ISignatureValidator.json",
|
"test/generated-artifacts/ISignatureValidatorFeature.json",
|
||||||
"test/generated-artifacts/ISimpleFunctionRegistry.json",
|
"test/generated-artifacts/ISimpleFunctionRegistryFeature.json",
|
||||||
"test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json",
|
"test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json",
|
||||||
"test/generated-artifacts/ITokenSpender.json",
|
"test/generated-artifacts/ITokenSpenderFeature.json",
|
||||||
"test/generated-artifacts/ITransformERC20.json",
|
"test/generated-artifacts/ITransformERC20Feature.json",
|
||||||
|
"test/generated-artifacts/IUniswapV2Feature.json",
|
||||||
"test/generated-artifacts/IZeroEx.json",
|
"test/generated-artifacts/IZeroEx.json",
|
||||||
"test/generated-artifacts/InitialMigration.json",
|
"test/generated-artifacts/InitialMigration.json",
|
||||||
"test/generated-artifacts/LibBootstrap.json",
|
"test/generated-artifacts/LibBootstrap.json",
|
||||||
@ -74,11 +75,11 @@
|
|||||||
"test/generated-artifacts/LibTransformERC20Storage.json",
|
"test/generated-artifacts/LibTransformERC20Storage.json",
|
||||||
"test/generated-artifacts/LibWalletRichErrors.json",
|
"test/generated-artifacts/LibWalletRichErrors.json",
|
||||||
"test/generated-artifacts/LogMetadataTransformer.json",
|
"test/generated-artifacts/LogMetadataTransformer.json",
|
||||||
"test/generated-artifacts/MetaTransactions.json",
|
"test/generated-artifacts/MetaTransactionsFeature.json",
|
||||||
"test/generated-artifacts/Ownable.json",
|
"test/generated-artifacts/OwnableFeature.json",
|
||||||
"test/generated-artifacts/PayTakerTransformer.json",
|
"test/generated-artifacts/PayTakerTransformer.json",
|
||||||
"test/generated-artifacts/SignatureValidator.json",
|
"test/generated-artifacts/SignatureValidatorFeature.json",
|
||||||
"test/generated-artifacts/SimpleFunctionRegistry.json",
|
"test/generated-artifacts/SimpleFunctionRegistryFeature.json",
|
||||||
"test/generated-artifacts/TestCallTarget.json",
|
"test/generated-artifacts/TestCallTarget.json",
|
||||||
"test/generated-artifacts/TestDelegateCaller.json",
|
"test/generated-artifacts/TestDelegateCaller.json",
|
||||||
"test/generated-artifacts/TestFillQuoteTransformerBridge.json",
|
"test/generated-artifacts/TestFillQuoteTransformerBridge.json",
|
||||||
@ -101,8 +102,8 @@
|
|||||||
"test/generated-artifacts/TestWeth.json",
|
"test/generated-artifacts/TestWeth.json",
|
||||||
"test/generated-artifacts/TestWethTransformerHost.json",
|
"test/generated-artifacts/TestWethTransformerHost.json",
|
||||||
"test/generated-artifacts/TestZeroExFeature.json",
|
"test/generated-artifacts/TestZeroExFeature.json",
|
||||||
"test/generated-artifacts/TokenSpender.json",
|
"test/generated-artifacts/TokenSpenderFeature.json",
|
||||||
"test/generated-artifacts/TransformERC20.json",
|
"test/generated-artifacts/TransformERC20Feature.json",
|
||||||
"test/generated-artifacts/Transformer.json",
|
"test/generated-artifacts/Transformer.json",
|
||||||
"test/generated-artifacts/TransformerDeployer.json",
|
"test/generated-artifacts/TransformerDeployer.json",
|
||||||
"test/generated-artifacts/WethTransformer.json",
|
"test/generated-artifacts/WethTransformer.json",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user