diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-19 23:38:15 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-19 23:38:15 +0800 |
commit | 9acf4458c026ca9e2748ca4291573ac95c66fe26 (patch) | |
tree | 1e137e009863ce74ae73b6261e873ff888cccd44 | |
parent | 70de264d4dd96efce2719c209c4b866c93668877 (diff) | |
download | dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar.gz dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar.bz2 dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar.lz dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar.xz dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.tar.zst dexon-sol-tools-9acf4458c026ca9e2748ca4291573ac95c66fe26.zip |
Remove hack in ERC20Wrapper
-rw-r--r-- | packages/contracts/src/utils/erc20_wrapper.ts | 12 | ||||
-rw-r--r-- | packages/contracts/test/asset_proxy/proxies.ts | 5 | ||||
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 5 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 5 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 5 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 5 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 5 |
7 files changed, 30 insertions, 12 deletions
diff --git a/packages/contracts/src/utils/erc20_wrapper.ts b/packages/contracts/src/utils/erc20_wrapper.ts index ca2ca492b..6dd717f4a 100644 --- a/packages/contracts/src/utils/erc20_wrapper.ts +++ b/packages/contracts/src/utils/erc20_wrapper.ts @@ -27,11 +27,11 @@ export class ERC20Wrapper { this._tokenOwnerAddresses = tokenOwnerAddresses; this._contractOwnerAddress = contractOwnerAddress; } - public async deployDummyTokensAsync(num?: number, decimals?: BigNumber): Promise<DummyERC20TokenContract[]> { - // TODO(fabio): Remove and refactor all tests - const finalNum = _.isUndefined(num) ? constants.NUM_DUMMY_ERC20_TO_DEPLOY : num; - const finalDecimals = _.isUndefined(decimals) ? constants.DUMMY_TOKEN_DECIMALS : decimals; - for (let i = 0; i < finalNum; i++) { + public async deployDummyTokensAsync( + numberToDeploy: number, + decimals: BigNumber, + ): Promise<DummyERC20TokenContract[]> { + for (let i = 0; i < numberToDeploy; i++) { this._dummyTokenContracts.push( await DummyERC20TokenContract.deployFrom0xArtifactAsync( artifacts.DummyERC20Token, @@ -39,7 +39,7 @@ export class ERC20Wrapper { txDefaults, constants.DUMMY_TOKEN_NAME, constants.DUMMY_TOKEN_SYMBOL, - finalDecimals, + decimals, constants.DUMMY_TOKEN_TOTAL_SUPPLY, ), ); diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 4a51e0db8..185d1639e 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -58,7 +58,10 @@ describe('Asset Transfer Proxies', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); await web3Wrapper.awaitTransactionSuccessAsync( diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 453f05df2..64b7bf943 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -72,7 +72,10 @@ describe('Exchange core', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index abbfd7ac7..0e2b82f19 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -48,7 +48,10 @@ describe('AssetProxyDispatcher', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index b8dca04fd..4ed4f2266 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -81,7 +81,10 @@ describe('matchOrders', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); // Deploy ERC20 token & ERC20 proxy - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); // Deploy ERC721 token and proxy diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 21ff123e5..beb7054e7 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -64,7 +64,10 @@ describe('Exchange transactions', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 00c5e4352..6f03c7f6f 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -66,7 +66,10 @@ describe('Exchange wrappers', () => { erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); - [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); + [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( + constants.NUM_DUMMY_ERC20_TO_DEPLOY, + constants.DUMMY_TOKEN_DECIMALS, + ); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); |