diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
commit | bf8ac3b9e6ee59f267f7850418febfe84dedceb8 (patch) | |
tree | 0617e583892f9a8fe96a55dcac3a7f9af1ddae10 /packages/contracts/test | |
parent | edcdc9b1b903158cc61529853d7e9028ecbc266a (diff) | |
download | dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.gz dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.bz2 dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.lz dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.xz dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.zst dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.zip |
Fix tslint issues
Diffstat (limited to 'packages/contracts/test')
15 files changed, 49 insertions, 47 deletions
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts index f291170a2..3e548d186 100644 --- a/packages/contracts/test/utils/asset_wrapper.ts +++ b/packages/contracts/test/utils/asset_wrapper.ts @@ -17,7 +17,7 @@ interface ProxyIdToAssetWrappers { * the logic that uses it does not need to care what standard a token belongs to. */ export class AssetWrapper { - private _proxyIdToAssetWrappers: ProxyIdToAssetWrappers; + private readonly _proxyIdToAssetWrappers: ProxyIdToAssetWrappers; constructor(assetWrappers: AbstractAssetWrapper[]) { this._proxyIdToAssetWrappers = {}; _.each(assetWrappers, assetWrapper => { diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts index cf1433791..e1863be36 100644 --- a/packages/contracts/test/utils/erc20_wrapper.ts +++ b/packages/contracts/test/utils/erc20_wrapper.ts @@ -13,11 +13,11 @@ import { ERC20BalancesByOwner } from './types'; import { txDefaults } from './web3_wrapper'; export class ERC20Wrapper { - private _tokenOwnerAddresses: string[]; - private _contractOwnerAddress: string; - private _web3Wrapper: Web3Wrapper; - private _provider: Provider; - private _dummyTokenContracts: DummyERC20TokenContract[]; + private readonly _tokenOwnerAddresses: string[]; + private readonly _contractOwnerAddress: string; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _provider: Provider; + private readonly _dummyTokenContracts: DummyERC20TokenContract[]; private _proxyContract?: ERC20ProxyContract; private _proxyIdIfExists?: string; constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts index a38dfb811..d023b4d02 100644 --- a/packages/contracts/test/utils/erc721_wrapper.ts +++ b/packages/contracts/test/utils/erc721_wrapper.ts @@ -13,11 +13,11 @@ import { ERC721TokenIdsByOwner } from './types'; import { txDefaults } from './web3_wrapper'; export class ERC721Wrapper { - private _tokenOwnerAddresses: string[]; - private _contractOwnerAddress: string; - private _web3Wrapper: Web3Wrapper; - private _provider: Provider; - private _dummyTokenContracts: DummyERC721TokenContract[]; + private readonly _tokenOwnerAddresses: string[]; + private readonly _contractOwnerAddress: string; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _provider: Provider; + private readonly _dummyTokenContracts: DummyERC721TokenContract[]; private _proxyContract?: ERC721ProxyContract; private _proxyIdIfExists?: string; private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {}; diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts index 155d0eeb0..be0b32c62 100644 --- a/packages/contracts/test/utils/exchange_wrapper.ts +++ b/packages/contracts/test/utils/exchange_wrapper.ts @@ -11,9 +11,9 @@ import { orderUtils } from './order_utils'; import { OrderInfo, SignedTransaction } from './types'; export class ExchangeWrapper { - private _exchange: ExchangeContract; - private _web3Wrapper: Web3Wrapper; - private _logDecoder: LogDecoder; + private readonly _exchange: ExchangeContract; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _logDecoder: LogDecoder; constructor(exchangeContract: ExchangeContract, provider: Provider) { this._exchange = exchangeContract; this._web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts index d227420ee..0d4214402 100644 --- a/packages/contracts/test/utils/forwarder_wrapper.ts +++ b/packages/contracts/test/utils/forwarder_wrapper.ts @@ -18,10 +18,10 @@ const ZERO_AMOUNT = new BigNumber(0); const INSUFFICENT_ORDERS_FOR_MAKER_AMOUNT = 'Unable to satisfy makerAssetFillAmount with provided orders'; export class ForwarderWrapper { - private _web3Wrapper: Web3Wrapper; - private _forwarderContract: ForwarderContract; - private _logDecoder: LogDecoder; - private _zrxAddress: string; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _forwarderContract: ForwarderContract; + private readonly _logDecoder: LogDecoder; + private readonly _zrxAddress: string; private static _createOptimizedSellOrders(signedOrders: SignedOrder[]): MarketSellOrders { const marketSellOrders = formatters.createMarketSellOrders(signedOrders, ZERO_AMOUNT); const assetDataId = assetProxyUtils.decodeAssetDataId(signedOrders[0].makerAssetData); diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts index 07127ba79..5a4801319 100644 --- a/packages/contracts/test/utils/log_decoder.ts +++ b/packages/contracts/test/utils/log_decoder.ts @@ -15,9 +15,9 @@ import { artifacts } from './artifacts'; import { constants } from './constants'; export class LogDecoder { - private _web3Wrapper: Web3Wrapper; - private _contractAddress: string; - private _abiDecoder: AbiDecoder; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _contractAddress: string; + private readonly _abiDecoder: AbiDecoder; public static wrapLogBigNumbers(log: any): any { const argNames = _.keys(log.args); for (const argName of argNames) { diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts index 6145779b0..0d5ad5e9f 100644 --- a/packages/contracts/test/utils/match_order_tester.ts +++ b/packages/contracts/test/utils/match_order_tester.ts @@ -14,10 +14,10 @@ chaiSetup.configure(); const expect = chai.expect; export class MatchOrderTester { - private _exchangeWrapper: ExchangeWrapper; - private _erc20Wrapper: ERC20Wrapper; - private _erc721Wrapper: ERC721Wrapper; - private _feeTokenAddress: string; + private readonly _exchangeWrapper: ExchangeWrapper; + private readonly _erc20Wrapper: ERC20Wrapper; + private readonly _erc721Wrapper: ERC721Wrapper; + private readonly _feeTokenAddress: string; /// @dev Compares a pair of ERC20 balances and a pair of ERC721 token owners. /// @param expectedNewERC20BalancesByOwner Expected ERC20 balances. diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts index 2024c177d..8c8055d4a 100644 --- a/packages/contracts/test/utils/multi_sig_wrapper.ts +++ b/packages/contracts/test/utils/multi_sig_wrapper.ts @@ -10,9 +10,9 @@ import { constants } from './constants'; import { LogDecoder } from './log_decoder'; export class MultiSigWrapper { - private _multiSig: MultiSigWalletContract; - private _web3Wrapper: Web3Wrapper; - private _logDecoder: LogDecoder; + private readonly _multiSig: MultiSigWalletContract; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _logDecoder: LogDecoder; constructor(multiSigContract: MultiSigWalletContract, provider: Provider) { this._multiSig = multiSigContract; this._web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/contracts/test/utils/order_factory.ts b/packages/contracts/test/utils/order_factory.ts index 009dbc396..da418fa0f 100644 --- a/packages/contracts/test/utils/order_factory.ts +++ b/packages/contracts/test/utils/order_factory.ts @@ -6,8 +6,8 @@ import { constants } from './constants'; import { signingUtils } from './signing_utils'; export class OrderFactory { - private _defaultOrderParams: Partial<Order>; - private _privateKey: Buffer; + private readonly _defaultOrderParams: Partial<Order>; + private readonly _privateKey: Buffer; constructor(privateKey: Buffer, defaultOrderParams: Partial<Order>) { this._defaultOrderParams = defaultOrderParams; this._privateKey = privateKey; diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts index 526505871..e0edbff26 100644 --- a/packages/contracts/test/utils/order_factory_from_scenario.ts +++ b/packages/contracts/test/utils/order_factory_from_scenario.ts @@ -24,13 +24,13 @@ const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000); const ONE_NFT_UNIT = new BigNumber(1); export class OrderFactoryFromScenario { - private _userAddresses: string[]; - private _zrxAddress: string; - private _nonZrxERC20EighteenDecimalTokenAddresses: string[]; - private _erc20FiveDecimalTokenAddresses: string[]; - private _erc721Token: DummyERC721TokenContract; - private _erc721Balances: ERC721TokenIdsByOwner; - private _exchangeAddress: string; + private readonly _userAddresses: string[]; + private readonly _zrxAddress: string; + private readonly _nonZrxERC20EighteenDecimalTokenAddresses: string[]; + private readonly _erc20FiveDecimalTokenAddresses: string[]; + private readonly _erc721Token: DummyERC721TokenContract; + private readonly _erc721Balances: ERC721TokenIdsByOwner; + private readonly _exchangeAddress: string; constructor( userAddresses: string[], zrxAddress: string, diff --git a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts index a295a40c4..598ee6d29 100644 --- a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts +++ b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts @@ -4,7 +4,7 @@ import { BigNumber } from '@0xproject/utils'; import { AssetWrapper } from './asset_wrapper'; export class SimpleAssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { - private _assetWrapper: AssetWrapper; + private readonly _assetWrapper: AssetWrapper; constructor(assetWrapper: AssetWrapper) { this._assetWrapper = assetWrapper; } diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts index 24afe36b7..ed69ecc63 100644 --- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts +++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts @@ -4,8 +4,8 @@ import { BigNumber } from '@0xproject/utils'; import { ExchangeWrapper } from './exchange_wrapper'; export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher { - private _exchangeWrapper: ExchangeWrapper; - private _zrxAssetData: string; + private readonly _exchangeWrapper: ExchangeWrapper; + private readonly _zrxAssetData: string; constructor(exchange: ExchangeWrapper, zrxAssetData: string) { this._exchangeWrapper = exchange; this._zrxAssetData = zrxAssetData; diff --git a/packages/contracts/test/utils/token_registry_wrapper.ts b/packages/contracts/test/utils/token_registry_wrapper.ts index 0abf20e03..f1c40e8ff 100644 --- a/packages/contracts/test/utils/token_registry_wrapper.ts +++ b/packages/contracts/test/utils/token_registry_wrapper.ts @@ -8,8 +8,8 @@ import { Token } from './types'; import { constants } from './constants'; export class TokenRegWrapper { - private _tokenReg: TokenRegistryContract; - private _web3Wrapper: Web3Wrapper; + private readonly _tokenReg: TokenRegistryContract; + private readonly _web3Wrapper: Web3Wrapper; constructor(tokenRegContract: TokenRegistryContract, provider: Provider) { this._tokenReg = tokenRegContract; this._web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/contracts/test/utils/transaction_factory.ts b/packages/contracts/test/utils/transaction_factory.ts index 348c0715d..281c1e30d 100644 --- a/packages/contracts/test/utils/transaction_factory.ts +++ b/packages/contracts/test/utils/transaction_factory.ts @@ -15,9 +15,9 @@ const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = { }; export class TransactionFactory { - private _signerBuff: Buffer; - private _exchangeAddress: string; - private _privateKey: Buffer; + private readonly _signerBuff: Buffer; + private readonly _exchangeAddress: string; + private readonly _privateKey: Buffer; constructor(privateKey: Buffer, exchangeAddress: string) { this._privateKey = privateKey; this._exchangeAddress = exchangeAddress; diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index c9d83a02d..acb3103b7 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -51,8 +51,10 @@ export const provider = web3Factory.getRpcProvider(providerConfigs); const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage); const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler); const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace); -const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity) - .length; +const enabledSubproviderCount = _.filter( + [isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], + _.identity.bind(_), +).length; if (enabledSubproviderCount > 1) { throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`); } |