diff --git a/contracts/zero-ex/contracts/src/IZeroEx.sol b/contracts/zero-ex/contracts/src/IZeroEx.sol index 8a5daca320..20a53ad474 100644 --- a/contracts/zero-ex/contracts/src/IZeroEx.sol +++ b/contracts/zero-ex/contracts/src/IZeroEx.sol @@ -33,6 +33,7 @@ import "./features/interfaces/INativeOrdersFeature.sol"; import "./features/interfaces/IBatchFillNativeOrdersFeature.sol"; import "./features/interfaces/IMultiplexFeature.sol"; import "./features/interfaces/IOtcOrdersFeature.sol"; +import "./features/interfaces/IEpFundRecoveryFeature.sol"; /// @dev Interface for a fully featured Exchange Proxy. @@ -48,7 +49,8 @@ interface IZeroEx is INativeOrdersFeature, IBatchFillNativeOrdersFeature, IMultiplexFeature, - IOtcOrdersFeature + IOtcOrdersFeature, + IEpFundRecoveryFeature { // solhint-disable state-visibility diff --git a/contracts/zero-ex/contracts/src/features/EpFundRecoveryFeature.sol b/contracts/zero-ex/contracts/src/features/EpFundRecoveryFeature.sol index 519fc77830..1153089d1d 100644 --- a/contracts/zero-ex/contracts/src/features/EpFundRecoveryFeature.sol +++ b/contracts/zero-ex/contracts/src/features/EpFundRecoveryFeature.sol @@ -29,7 +29,6 @@ contract EpFundRecoveryFeature is IFeature, IEpFundRecoveryFeature, FixinCommon, - ITransformERC20Feature, FixinTokenSpender { /// @dev Name of this feature. @@ -37,14 +36,12 @@ contract EpFundRecoveryFeature is /// @dev Version of this feature. uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0); /// @dev Deployed exchange proxy address. - bytes32 private immutable 0X_EP_ADDRESS; + address private immutable ZEROEX_EP_ADDRESS; /// @dev Construct this contract. - /// @param erc20 Any ERC-20 contract address. - /// @param amountOut Amount in wei to withdraw - /// @param designatedWallet Designated wallet to send recovered funds to. + /// @param exchangeProxy Exchange Proxy contract address constructor(address exchangeProxy) public { - 0X_EP_ADDRESS = exchangeProxy; + ZEROEX_EP_ADDRESS = exchangeProxy; } // solhint-enable state-visibility @@ -52,21 +49,21 @@ contract EpFundRecoveryFeature is function recoverToDesignatedWallet( IERC20TokenV06 erc20, uint256 amountOut, - address designatedWallet + address payable designatedWallet ) - public + external + override { if(amountOut == uint256(-1)) { - amountOut = erc20.balanceOf(this); + amountOut = erc20.balanceOf(ZEROEX_EP_ADDRESS); } if(LibERC20Transformer.isTokenETH(erc20)) { - designatedWallet.transfer(amountOut); + payable(designatedWallet).transfer(amountOut); } else{ - erc20.transferFrom(0X_EP_ADDRESS,designatedWallet,amountOut); + erc20.transferFrom(ZEROEX_EP_ADDRESS,designatedWallet,amountOut); } - } /// @dev Initialize and register this feature. diff --git a/contracts/zero-ex/contracts/src/features/interfaces/IEpFundRecoveryFeature.sol b/contracts/zero-ex/contracts/src/features/interfaces/IEpFundRecoveryFeature.sol index 3e1356a94d..3af8ce2f2d 100644 --- a/contracts/zero-ex/contracts/src/features/interfaces/IEpFundRecoveryFeature.sol +++ b/contracts/zero-ex/contracts/src/features/interfaces/IEpFundRecoveryFeature.sol @@ -18,13 +18,13 @@ pragma experimental ABIEncoderV2; import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; -/// @dev VIP Exchange Proxy Recovery Funcions +/// @dev VIP Exchange Proxy Recovery Functions interface IEpFundRecoveryFeature { function recoverToDesignatedWallet( IERC20TokenV06 erc20, uint256 amountOut, - address designatedWallet + address payable designatedWallet ) - public; + external; } \ No newline at end of file diff --git a/contracts/zero-ex/package.json b/contracts/zero-ex/package.json index 7bfc025c52..17a46624f0 100644 --- a/contracts/zero-ex/package.json +++ b/contracts/zero-ex/package.json @@ -43,7 +43,11 @@ "config": { "publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.", +<<<<<<< HEAD "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinClipper|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinKyber|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json" +======= + "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|EpFundRecoveryFeature|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IEpFundRecoveryFeature|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinClipper|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinKyber|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json" +>>>>>>> 1c8800668 (fixed compilation errors for EpFundsRecovery) }, "repository": { "type": "git", diff --git a/contracts/zero-ex/test/artifacts.ts b/contracts/zero-ex/test/artifacts.ts index cbbb76b505..f74943a9a6 100644 --- a/contracts/zero-ex/test/artifacts.ts +++ b/contracts/zero-ex/test/artifacts.ts @@ -11,6 +11,7 @@ import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature. import * as BridgeAdapter from '../test/generated-artifacts/BridgeAdapter.json'; import * as BridgeProtocols from '../test/generated-artifacts/BridgeProtocols.json'; import * as CurveLiquidityProvider from '../test/generated-artifacts/CurveLiquidityProvider.json'; +import * as EpFundRecoveryFeature from '../test/generated-artifacts/EpFundRecoveryFeature.json'; import * as FeeCollector from '../test/generated-artifacts/FeeCollector.json'; import * as FeeCollectorController from '../test/generated-artifacts/FeeCollectorController.json'; import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json'; @@ -24,6 +25,7 @@ import * as FullMigration from '../test/generated-artifacts/FullMigration.json'; import * as IBatchFillNativeOrdersFeature from '../test/generated-artifacts/IBatchFillNativeOrdersFeature.json'; import * as IBootstrapFeature from '../test/generated-artifacts/IBootstrapFeature.json'; import * as IBridgeAdapter from '../test/generated-artifacts/IBridgeAdapter.json'; +import * as IEpFundRecoveryFeature from '../test/generated-artifacts/IEpFundRecoveryFeature.json'; import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json'; import * as IERC20Transformer from '../test/generated-artifacts/IERC20Transformer.json'; import * as IFeature from '../test/generated-artifacts/IFeature.json'; @@ -198,6 +200,7 @@ export const artifacts = { TransformerDeployer: TransformerDeployer as ContractArtifact, BatchFillNativeOrdersFeature: BatchFillNativeOrdersFeature as ContractArtifact, BootstrapFeature: BootstrapFeature as ContractArtifact, + EpFundRecoveryFeature: EpFundRecoveryFeature as ContractArtifact, LiquidityProviderFeature: LiquidityProviderFeature as ContractArtifact, MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact, NativeOrdersFeature: NativeOrdersFeature as ContractArtifact, @@ -210,6 +213,7 @@ export const artifacts = { UniswapV3Feature: UniswapV3Feature as ContractArtifact, IBatchFillNativeOrdersFeature: IBatchFillNativeOrdersFeature as ContractArtifact, IBootstrapFeature: IBootstrapFeature as ContractArtifact, + IEpFundRecoveryFeature: IEpFundRecoveryFeature as ContractArtifact, IFeature: IFeature as ContractArtifact, ILiquidityProviderFeature: ILiquidityProviderFeature as ContractArtifact, IMetaTransactionsFeature: IMetaTransactionsFeature as ContractArtifact, diff --git a/contracts/zero-ex/test/wrappers.ts b/contracts/zero-ex/test/wrappers.ts index 02059e5886..da1a3fe44e 100644 --- a/contracts/zero-ex/test/wrappers.ts +++ b/contracts/zero-ex/test/wrappers.ts @@ -9,6 +9,7 @@ export * from '../test/generated-wrappers/bootstrap_feature'; export * from '../test/generated-wrappers/bridge_adapter'; export * from '../test/generated-wrappers/bridge_protocols'; export * from '../test/generated-wrappers/curve_liquidity_provider'; +export * from '../test/generated-wrappers/ep_fund_recovery_feature'; export * from '../test/generated-wrappers/fee_collector'; export * from '../test/generated-wrappers/fee_collector_controller'; export * from '../test/generated-wrappers/fill_quote_transformer'; @@ -22,6 +23,7 @@ export * from '../test/generated-wrappers/full_migration'; export * from '../test/generated-wrappers/i_batch_fill_native_orders_feature'; export * from '../test/generated-wrappers/i_bootstrap_feature'; export * from '../test/generated-wrappers/i_bridge_adapter'; +export * from '../test/generated-wrappers/i_ep_fund_recovery_feature'; export * from '../test/generated-wrappers/i_erc20_bridge'; export * from '../test/generated-wrappers/i_erc20_transformer'; export * from '../test/generated-wrappers/i_feature'; diff --git a/contracts/zero-ex/tsconfig.json b/contracts/zero-ex/tsconfig.json index c9049f98e7..8227507aae 100644 --- a/contracts/zero-ex/tsconfig.json +++ b/contracts/zero-ex/tsconfig.json @@ -42,6 +42,7 @@ "test/generated-artifacts/BridgeAdapter.json", "test/generated-artifacts/BridgeProtocols.json", "test/generated-artifacts/CurveLiquidityProvider.json", + "test/generated-artifacts/EpFundRecoveryFeature.json", "test/generated-artifacts/FeeCollector.json", "test/generated-artifacts/FeeCollectorController.json", "test/generated-artifacts/FillQuoteTransformer.json", @@ -57,6 +58,7 @@ "test/generated-artifacts/IBridgeAdapter.json", "test/generated-artifacts/IERC20Bridge.json", "test/generated-artifacts/IERC20Transformer.json", + "test/generated-artifacts/IEpFundRecoveryFeature.json", "test/generated-artifacts/IFeature.json", "test/generated-artifacts/IFlashWallet.json", "test/generated-artifacts/ILiquidityProvider.json",