aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-22 02:45:50 +0800
committerGitHub <noreply@github.com>2018-08-22 02:45:50 +0800
commitf53157414f144a7ea8c24126c9d75d3168228130 (patch)
treefb7182f247a1b464f7b478e622b27fca146e8ad1 /packages/contracts
parent6216714be1f72ac8896478f36d6e03489b59becd (diff)
parent1ba26ea5e8034699315b39f2f55917abea963555 (diff)
downloaddexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar.gz
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar.bz2
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar.lz
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar.xz
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.tar.zst
dexon-sol-tools-f53157414f144a7ea8c24126c9d75d3168228130.zip
Merge pull request #995 from 0xProject/refactor/contracts/forwarderConstructor
[contracts] Remove redundant constructor args
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/2.0.0/forwarder/Forwarder.sol4
-rw-r--r--packages/contracts/src/2.0.0/forwarder/libs/LibConstants.sol12
-rw-r--r--packages/contracts/test/forwarder/forwarder.ts2
3 files changed, 8 insertions, 10 deletions
diff --git a/packages/contracts/src/2.0.0/forwarder/Forwarder.sol b/packages/contracts/src/2.0.0/forwarder/Forwarder.sol
index 5b88b05b1..6b17bb29b 100644
--- a/packages/contracts/src/2.0.0/forwarder/Forwarder.sol
+++ b/packages/contracts/src/2.0.0/forwarder/Forwarder.sol
@@ -37,16 +37,12 @@ contract Forwarder is
constructor (
address _exchange,
- address _etherToken,
- address _zrxToken,
bytes memory _zrxAssetData,
bytes memory _wethAssetData
)
public
LibConstants(
_exchange,
- _etherToken,
- _zrxToken,
_zrxAssetData,
_wethAssetData
)
diff --git a/packages/contracts/src/2.0.0/forwarder/libs/LibConstants.sol b/packages/contracts/src/2.0.0/forwarder/libs/LibConstants.sol
index c26d7902c..fb9691fe8 100644
--- a/packages/contracts/src/2.0.0/forwarder/libs/LibConstants.sol
+++ b/packages/contracts/src/2.0.0/forwarder/libs/LibConstants.sol
@@ -18,6 +18,7 @@
pragma solidity 0.4.24;
+import "../../utils/LibBytes/LibBytes.sol";
import "../../protocol/Exchange/interfaces/IExchange.sol";
import "../../tokens/EtherToken/IEtherToken.sol";
import "../../tokens/ERC20Token/IERC20Token.sol";
@@ -25,6 +26,8 @@ import "../../tokens/ERC20Token/IERC20Token.sol";
contract LibConstants {
+ using LibBytes for bytes;
+
bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)"));
bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)"));
uint256 constant internal MAX_UINT = 2**256 - 1;
@@ -42,17 +45,18 @@ contract LibConstants {
constructor (
address _exchange,
- address _etherToken,
- address _zrxToken,
bytes memory _zrxAssetData,
bytes memory _wethAssetData
)
public
{
EXCHANGE = IExchange(_exchange);
- ETHER_TOKEN = IEtherToken(_etherToken);
- ZRX_TOKEN = IERC20Token(_zrxToken);
ZRX_ASSET_DATA = _zrxAssetData;
WETH_ASSET_DATA = _wethAssetData;
+
+ address etherToken = _wethAssetData.readAddress(16);
+ address zrxToken = _zrxAssetData.readAddress(16);
+ ETHER_TOKEN = IEtherToken(etherToken);
+ ZRX_TOKEN = IERC20Token(zrxToken);
}
}
diff --git a/packages/contracts/test/forwarder/forwarder.ts b/packages/contracts/test/forwarder/forwarder.ts
index 28ffdeabe..18101d684 100644
--- a/packages/contracts/test/forwarder/forwarder.ts
+++ b/packages/contracts/test/forwarder/forwarder.ts
@@ -131,8 +131,6 @@ describe(ContractName.Forwarder, () => {
provider,
txDefaults,
exchangeInstance.address,
- wethContract.address,
- zrxToken.address,
zrxAssetData,
wethAssetData,
);