diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:27:38 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:27:38 +0800 |
commit | dad557164ea4ccc012243d43df013078a7c37eb6 (patch) | |
tree | 88e8477941dc0c98273fcb054086b2e89d034e19 /packages/order-utils | |
parent | acff177c547dee049b97e4b051fe22e1efaf992c (diff) | |
parent | f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0 (diff) | |
download | dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.gz dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.tar.zst dexon-sol-tools-dad557164ea4ccc012243d43df013078a7c37eb6.zip |
Merge branch 'v2-prototype' into feature/order-watcher-v2
Diffstat (limited to 'packages/order-utils')
8 files changed, 17 insertions, 18 deletions
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 20f050cb4..a8205f848 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -67,7 +67,7 @@ "npm-run-all": "^4.1.2", "shx": "^0.2.2", "sinon": "^4.0.0", - "tslint": "5.10.0", + "tslint": "5.11.0", "typedoc": "0xProject/typedoc", "typescript": "2.7.1" }, diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts index 72ed85406..c3a4f9c2a 100644 --- a/packages/order-utils/src/exchange_transfer_simulator.ts +++ b/packages/order-utils/src/exchange_transfer_simulator.ts @@ -34,7 +34,7 @@ const ERR_MSG_MAPPING = { }; export class ExchangeTransferSimulator { - private _store: AbstractBalanceAndProxyAllowanceLazyStore; + private readonly _store: AbstractBalanceAndProxyAllowanceLazyStore; private static _throwValidationError( failureReason: FailureReason, tradeSide: TradeSide, diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index dd45a1298..189bf4180 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -27,8 +27,8 @@ interface SidedOrderRelevantState { const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; export class OrderStateUtils { - private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; - private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; + private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; + private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; private static _validateIfOrderIsValid( signedOrder: SignedOrder, sidedOrderRelevantState: SidedOrderRelevantState, diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts index 94df3ef82..67d747081 100644 --- a/packages/order-utils/src/order_validation_utils.ts +++ b/packages/order-utils/src/order_validation_utils.ts @@ -13,7 +13,7 @@ import { isValidSignatureAsync } from './signature_utils'; import { utils } from './utils'; export class OrderValidationUtils { - private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; + private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; public static isRoundingError(numerator: BigNumber, denominator: BigNumber, target: BigNumber): boolean { // Solidity's mulmod() in JS // Source: https://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions diff --git a/packages/order-utils/src/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts index 29e19e5ab..7022aa979 100644 --- a/packages/order-utils/src/remaining_fillable_calculator.ts +++ b/packages/order-utils/src/remaining_fillable_calculator.ts @@ -1,14 +1,14 @@ import { BigNumber } from '@0xproject/utils'; export class RemainingFillableCalculator { - private _isTraderAssetZRX: boolean; + private readonly _isTraderAssetZRX: boolean; // Transferrable Amount is the minimum of Approval and Balance - private _transferrableAssetAmount: BigNumber; - private _transferrableFeeAmount: BigNumber; - private _remainingOrderAssetAmount: BigNumber; - private _remainingOrderFeeAmount: BigNumber; - private _orderFee: BigNumber; - private _orderAssetAmount: BigNumber; + private readonly _transferrableAssetAmount: BigNumber; + private readonly _transferrableFeeAmount: BigNumber; + private readonly _remainingOrderAssetAmount: BigNumber; + private readonly _remainingOrderFeeAmount: BigNumber; + private readonly _orderFee: BigNumber; + private readonly _orderAssetAmount: BigNumber; constructor( orderFee: BigNumber, orderAssetAmount: BigNumber, diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts index 8235725ed..0f9526662 100644 --- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts +++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts @@ -10,7 +10,7 @@ import { assetProxyUtils } from '../asset_proxy_utils'; * Copy on read store for balances/proxyAllowances of tokens/accounts */ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProxyAllowanceLazyStore { - private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; + private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher; private _balance: { [assetData: string]: { [userAddress: string]: BigNumber; diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts index 37b2bd712..f86b05e20 100644 --- a/packages/order-utils/test/exchange_transfer_simulator_test.ts +++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts @@ -34,7 +34,7 @@ describe('ExchangeTransferSimulator', async () => { let erc20ProxyAddress: string; before(async function(): Promise<void> { const mochaTestTimeoutMs = 20000; - this.timeout(mochaTestTimeoutMs); + this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this userAddresses = await web3Wrapper.getAvailableAddressesAsync(); [coinbase, sender, recipient] = userAddresses; @@ -77,8 +77,7 @@ describe('ExchangeTransferSimulator', async () => { describe('#transferFromAsync', function(): void { // HACK: For some reason these tests need a slightly longer timeout const mochaTestTimeoutMs = 3000; - this.timeout(mochaTestTimeoutMs); - + this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this beforeEach(() => { const simpleERC20BalanceAndProxyAllowanceFetcher = new SimpleERC20BalanceAndProxyAllowanceFetcher( (dummyERC20Token as any) as ERC20TokenContract, diff --git a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts index 68f6a164c..279a5c0db 100644 --- a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts +++ b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts @@ -5,8 +5,8 @@ import { AbstractBalanceAndProxyAllowanceFetcher } from '../../src/abstract/abst import { ERC20TokenContract } from '../../src/generated_contract_wrappers/erc20_token'; export class SimpleERC20BalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { - private _erc20TokenContract: ERC20TokenContract; - private _erc20ProxyAddress: string; + private readonly _erc20TokenContract: ERC20TokenContract; + private readonly _erc20ProxyAddress: string; constructor(erc20TokenWrapper: ERC20TokenContract, erc20ProxyAddress: string) { this._erc20TokenContract = erc20TokenWrapper; this._erc20ProxyAddress = erc20ProxyAddress; |