diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-06-07 08:21:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 08:21:09 +0800 |
commit | 67c4ad128c405692e471274148c9a2ef7cd8b6ca (patch) | |
tree | b410c792b110bbae4d1814aab8115b2b3120f65d /packages/contracts/test/exchange | |
parent | 5989844f1c3d00f57f1ab86a00aa97e17751c576 (diff) | |
parent | 870eca0d9f875f784c1847993246db3097f68405 (diff) | |
download | dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.gz dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.bz2 dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.lz dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.xz dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.zst dexon-sol-tools-67c4ad128c405692e471274148c9a2ef7cd8b6ca.zip |
Merge pull request #662 from 0xProject/feature/improve-linting
Tried enabling no-unused-variable...
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 13 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/exchange/libs.ts | 1 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 22 | ||||
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 1 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 4 |
7 files changed, 14 insertions, 37 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 17d416fd6..5ec04c4dd 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { assetProxyUtils, crypto, orderHashUtils } from '@0xproject/order-utils'; +import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils'; import { AssetProxyId, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -25,14 +25,13 @@ import { ERC20Wrapper } from '../../src/utils/erc20_wrapper'; import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; -import { orderUtils } from '../../src/utils/order_utils'; -import { ContractName, ERC20BalancesByOwner, OrderStatus } from '../../src/utils/types'; +import { ERC20BalancesByOwner } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - +// tslint:disable:no-unnecessary-type-assertion describe('Exchange core', () => { let makerAddress: string; let owner: string; @@ -571,7 +570,6 @@ describe('Exchange core', () => { }); it('should log 1 event with correct arguments', async () => { - const divisor = 2; const res = await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress); expect(res.logs).to.have.length(1); @@ -723,6 +721,7 @@ describe('Exchange core', () => { expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress); // Call Exchange const takerAssetFillAmount = signedOrder.takerAssetAmount; + // tslint:disable-next-line:no-unused-variable const res = await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }); // Verify post-conditions const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId); @@ -921,4 +920,6 @@ describe('Exchange core', () => { ); }); }); -}); // tslint:disable-line:max-file-line-count +}); +// tslint:disable:max-file-line-count +// tslint:enable:no-unnecessary-type-assertion diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index 1e956e72e..7804a2db9 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -3,7 +3,6 @@ import { assetProxyUtils } from '@0xproject/order-utils'; import { AssetProxyId } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import * as Web3 from 'web3'; import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token'; import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy'; @@ -24,7 +23,6 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); describe('AssetProxyDispatcher', () => { let owner: string; let notOwner: string; - let notAuthorized: string; let makerAddress: string; let takerAddress: string; @@ -46,7 +44,6 @@ describe('AssetProxyDispatcher', () => { // Setup accounts & addresses const accounts = await web3Wrapper.getAvailableAddressesAsync(); const usedAddresses = ([owner, notOwner, makerAddress, takerAddress] = accounts); - notAuthorized = notOwner; erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner); erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner); @@ -306,7 +303,6 @@ describe('AssetProxyDispatcher', () => { // Construct metadata for ERC20 proxy const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address); // Perform a transfer from makerAddress to takerAddress - const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(10); return expectRevertOrAlwaysFailingTransactionAsync( assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync( diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts index 10cb8b34e..8553e49c8 100644 --- a/packages/contracts/test/exchange/libs.ts +++ b/packages/contracts/test/exchange/libs.ts @@ -3,7 +3,6 @@ import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import ethUtil = require('ethereumjs-util'); import { TestLibsContract } from '../../src/contract_wrappers/generated/test_libs'; import { addressUtils } from '../../src/utils/address_utils'; diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index b1685dd4a..7c2ae4db8 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -1,22 +1,16 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { assetProxyUtils, crypto } from '@0xproject/order-utils'; -import { AssetProxyId, SignedOrder } from '@0xproject/types'; +import { assetProxyUtils } from '@0xproject/order-utils'; +import { AssetProxyId } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; -import { LogWithDecodedArgs } from 'ethereum-types'; -import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token'; import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token'; import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy'; import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy'; -import { - CancelContractEventArgs, - ExchangeContract, - FillContractEventArgs, -} from '../../src/contract_wrappers/generated/exchange'; +import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange'; import { artifacts } from '../../src/utils/artifacts'; import { expectRevertOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; @@ -26,13 +20,7 @@ import { ERC721Wrapper } from '../../src/utils/erc721_wrapper'; import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { MatchOrderTester } from '../../src/utils/match_order_tester'; import { OrderFactory } from '../../src/utils/order_factory'; -import { - ContractName, - ERC20BalancesByOwner, - ERC721TokenIdsByOwner, - OrderInfo, - OrderStatus, -} from '../../src/utils/types'; +import { ERC20BalancesByOwner, ERC721TokenIdsByOwner, OrderInfo, OrderStatus } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); @@ -65,7 +53,6 @@ describe('matchOrders', () => { let erc721LeftMakerAssetIds: BigNumber[]; let erc721RightMakerAssetIds: BigNumber[]; - let erc721TakerAssetIds: BigNumber[]; let defaultERC20MakerAssetAddress: string; let defaultERC20TakerAssetAddress: string; @@ -104,7 +91,6 @@ describe('matchOrders', () => { const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721LeftMakerAssetIds = erc721Balances[makerAddressLeft][erc721Token.address]; erc721RightMakerAssetIds = erc721Balances[makerAddressRight][erc721Token.address]; - erc721TakerAssetIds = erc721Balances[takerAddress][erc721Token.address]; // Depoy exchange exchange = await ExchangeContract.deployFrom0xArtifactAsync( artifacts.Exchange, diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index 936910ee9..bc3368d5f 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -1,7 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index e64cb68f5..e24978815 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -1,10 +1,8 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils'; -import { AssetProxyId, Order, OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types'; +import { AssetProxyId, OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import * as ethUtil from 'ethereumjs-util'; -import * as Web3 from 'web3'; import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token'; import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy'; @@ -19,7 +17,7 @@ import { ExchangeWrapper } from '../../src/utils/exchange_wrapper'; import { OrderFactory } from '../../src/utils/order_factory'; import { orderUtils } from '../../src/utils/order_utils'; import { TransactionFactory } from '../../src/utils/transaction_factory'; -import { ERC20BalancesByOwner, OrderStatus, SignedTransaction } from '../../src/utils/types'; +import { ERC20BalancesByOwner, SignedTransaction } from '../../src/utils/types'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; chaiSetup.configure(); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 8ef966be8..6a522e50e 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -1,4 +1,4 @@ -import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { assetProxyUtils } from '@0xproject/order-utils'; import { AssetProxyId, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; @@ -6,14 +6,12 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'make-promises-safe'; -import * as Web3 from 'web3'; import { DummyERC20TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c20_token'; import { DummyERC721TokenContract } from '../../src/contract_wrappers/generated/dummy_e_r_c721_token'; import { ERC20ProxyContract } from '../../src/contract_wrappers/generated/e_r_c20_proxy'; import { ERC721ProxyContract } from '../../src/contract_wrappers/generated/e_r_c721_proxy'; import { ExchangeContract } from '../../src/contract_wrappers/generated/exchange'; -import { TokenRegistryContract } from '../../src/contract_wrappers/generated/token_registry'; import { artifacts } from '../../src/utils/artifacts'; import { expectRevertOrAlwaysFailingTransactionAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; |