From fe6c77cafb3bc1b5e19e9a9b5eb9f995244d625c Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 21 Apr 2018 15:42:09 -0700 Subject: Remove unused constructor arguments --- .../current/protocol/Exchange/Exchange.sol | 8 ++--- .../protocol/Exchange/MixinSettlementProxy.sol | 35 ++++++++-------------- packages/contracts/test/exchange/core.ts | 3 +- packages/contracts/test/exchange/helpers.ts | 3 +- packages/contracts/test/exchange/wrapper.ts | 3 +- 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol index 91136b29f..995cbcf76 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol @@ -23,7 +23,6 @@ import "./MixinExchangeCore.sol"; import "./MixinSignatureValidator.sol"; import "./MixinSettlementProxy.sol"; import "./MixinWrapperFunctions.sol"; -import "../AssetProxyDispatcher/IAssetProxyDispatcher.sol"; contract Exchange is MixinExchangeCore, @@ -34,13 +33,12 @@ contract Exchange is string constant public VERSION = "2.0.1-alpha"; function Exchange( - IToken _zrxToken, - bytes _zrxProxyData, - IAssetProxy _assetProxyDispatcher) + address _assetProxyDispatcher, + bytes memory _zrxProxyData) public MixinExchangeCore() MixinSignatureValidator() - MixinSettlementProxy(_assetProxyDispatcher, _zrxToken, _zrxProxyData) + MixinSettlementProxy(_assetProxyDispatcher, _zrxProxyData) MixinWrapperFunctions() {} } diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol index e8a7a148f..0d1d13ede 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSettlementProxy.sol @@ -20,7 +20,6 @@ pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; import "./mixins/MSettlement.sol"; -import "../../tokens/Token/IToken.sol"; import "./LibPartialAmount.sol"; import "../AssetProxyDispatcher/IAssetProxy.sol"; @@ -29,40 +28,30 @@ contract MixinSettlementProxy is MSettlement, LibPartialAmount { - IAssetProxy TRANSFER_PROXY; + IAssetProxy ASSET_PROXY_DISPATCHER; bytes ZRX_PROXY_DATA; - IToken ZRX_TOKEN; - function transferProxy() + function assetProxyDispatcher() public view returns (IAssetProxy) { - return TRANSFER_PROXY; - } - - function zrxToken() - external view - returns (IToken) - { - return ZRX_TOKEN; + return ASSET_PROXY_DISPATCHER; } function zrxProxyData() external view - returns (bytes) + returns (bytes memory) { return ZRX_PROXY_DATA; } function MixinSettlementProxy( - IAssetProxy assetProxyDispatcherContract, - IToken zrxToken, - bytes zrxProxyData) + address _assetProxyDispatcher, + bytes memory _zrxProxyData) public { - ZRX_TOKEN = zrxToken; - TRANSFER_PROXY = assetProxyDispatcherContract; - ZRX_PROXY_DATA = zrxProxyData; + ASSET_PROXY_DISPATCHER = IAssetProxy(_assetProxyDispatcher); + ZRX_PROXY_DATA = _zrxProxyData; } function settleOrder( @@ -77,13 +66,13 @@ contract MixinSettlementProxy is ) { makerTokenFilledAmount = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerTokenAmount); - TRANSFER_PROXY.transferFrom( + ASSET_PROXY_DISPATCHER.transferFrom( order.makerAssetData, order.makerAddress, takerAddress, makerTokenFilledAmount ); - TRANSFER_PROXY.transferFrom( + ASSET_PROXY_DISPATCHER.transferFrom( order.takerAssetData, takerAddress, order.makerAddress, @@ -92,7 +81,7 @@ contract MixinSettlementProxy is if (order.feeRecipientAddress != address(0)) { if (order.makerFee > 0) { makerFeePaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.makerFee); - TRANSFER_PROXY.transferFrom( + ASSET_PROXY_DISPATCHER.transferFrom( ZRX_PROXY_DATA, order.makerAddress, order.feeRecipientAddress, @@ -101,7 +90,7 @@ contract MixinSettlementProxy is } if (order.takerFee > 0) { takerFeePaid = getPartialAmount(takerTokenFilledAmount, order.takerTokenAmount, order.takerFee); - TRANSFER_PROXY.transferFrom( + ASSET_PROXY_DISPATCHER.transferFrom( ZRX_PROXY_DATA, takerAddress, order.feeRecipientAddress, diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 1e5e0b53a..baa157dbc 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -129,9 +129,8 @@ describe('Exchange', () => { ); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ - zrx.address, - encodeERC20ProxyData(zrx.address), assetProxyDispatcher.address, + encodeERC20ProxyData(zrx.address), ]); exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 43dfd5402..e04153695 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -43,9 +43,8 @@ describe('Exchange', () => { const assetProxyDispatcher = await deployer.deployAsync(ContractName.AssetProxyDispatcher); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ - zrx.address, - AssetProxyId.ERC20, assetProxyDispatcher.address, + AssetProxyId.ERC20, ]); const exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 7744d0388..429c141f6 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -110,9 +110,8 @@ describe('Exchange', () => { ); // Deploy and configure Exchange const exchangeInstance = await deployer.deployAsync(ContractName.Exchange, [ - zrx.address, - encodeERC20ProxyData(zrx.address), assetProxyDispatcher.address, + encodeERC20ProxyData(zrx.address), ]); exchange = new ExchangeContract(exchangeInstance.abi, exchangeInstance.address, provider); await assetProxyDispatcher.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); -- cgit