diff options
author | Ara Kevonian <ara@dextroid.io> | 2018-04-13 18:17:09 +0800 |
---|---|---|
committer | Ara Kevonian <ara@dextroid.io> | 2018-04-13 18:17:09 +0800 |
commit | 5355da6cad157bb67d1b55a2f8463efe3e072385 (patch) | |
tree | d2a4d0d718ea6b1b4dff6d5d138b7da54968568e /packages | |
parent | 38f7c4a0d2d9269b5fd185b303ede7a44ab78c99 (diff) | |
download | dexon-sol-tools-5355da6cad157bb67d1b55a2f8463efe3e072385.tar.gz dexon-sol-tools-5355da6cad157bb67d1b55a2f8463efe3e072385.tar.zst dexon-sol-tools-5355da6cad157bb67d1b55a2f8463efe3e072385.zip |
Rename BalanceAndAllowanceFetchers to BalanceAndProxyAllowanceFetchers
Diffstat (limited to 'packages')
-rw-r--r-- | packages/0x.js/src/abstract/balance_and_proxy_allowance_fetcher.ts (renamed from packages/0x.js/src/abstract/balance_and_allowance_fetcher.ts) | 2 | ||||
-rw-r--r-- | packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 8 | ||||
-rw-r--r-- | packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts (renamed from packages/0x.js/src/fetchers/simple_balance_and_allowance_fetcher.ts) | 4 | ||||
-rw-r--r-- | packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts | 4 | ||||
-rw-r--r-- | packages/0x.js/src/utils/order_state_utils.ts | 16 |
5 files changed, 17 insertions, 17 deletions
diff --git a/packages/0x.js/src/abstract/balance_and_allowance_fetcher.ts b/packages/0x.js/src/abstract/balance_and_proxy_allowance_fetcher.ts index f7b1183f1..c357f8447 100644 --- a/packages/0x.js/src/abstract/balance_and_allowance_fetcher.ts +++ b/packages/0x.js/src/abstract/balance_and_proxy_allowance_fetcher.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -export abstract class BalanceAndAllowanceFetcher { +export abstract class BalanceAndProxyAllowanceFetcher { public abstract async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>; public abstract async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>; } diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 65b5a2e53..5dea70769 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -13,7 +13,7 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { SimpleBalanceAndAllowanceFetcher } from '../fetchers/simple_balance_and_allowance_fetcher'; +import { SimpleBalanceAndProxyAllowanceFetcher } from '../fetchers/simple_balance_and_proxy_allowance_fetcher'; import { SimpleOrderFilledCancelledFetcher } from '../fetchers/simple_order_filled_cancelled_fetcher'; import { BlockRange, @@ -881,12 +881,12 @@ export class ExchangeWrapper extends ContractWrapper { * @param signedOrder The signedOrder */ public async getOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { - const balanceAndProxyAllowanceLazyStore = new SimpleBalanceAndAllowanceFetcher( + const simpleBalanceAndProxyAllowanceFetcher = new SimpleBalanceAndProxyAllowanceFetcher( this._tokenWrapper, BlockParamLiteral.Latest, ); - const orderFilledCancelledLazyStore = new SimpleOrderFilledCancelledFetcher(this); - const orderStateUtils = new OrderStateUtils(balanceAndProxyAllowanceLazyStore, orderFilledCancelledLazyStore); + const simpleOrderFilledCancelledFetcher = new SimpleOrderFilledCancelledFetcher(this); + const orderStateUtils = new OrderStateUtils(simpleBalanceAndProxyAllowanceFetcher, simpleOrderFilledCancelledFetcher); return orderStateUtils.getOrderStateAsync(signedOrder); } /** diff --git a/packages/0x.js/src/fetchers/simple_balance_and_allowance_fetcher.ts b/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts index 2aa1cc2b7..877f07a22 100644 --- a/packages/0x.js/src/fetchers/simple_balance_and_allowance_fetcher.ts +++ b/packages/0x.js/src/fetchers/simple_balance_and_proxy_allowance_fetcher.ts @@ -1,10 +1,10 @@ import { BlockParamLiteral } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import {BalanceAndAllowanceFetcher} from '../abstract/balance_and_allowance_fetcher'; +import {BalanceAndProxyAllowanceFetcher} from '../abstract/balance_and_proxy_allowance_fetcher'; import {TokenWrapper} from '../contract_wrappers/token_wrapper'; -export class SimpleBalanceAndAllowanceFetcher implements BalanceAndAllowanceFetcher { +export class SimpleBalanceAndProxyAllowanceFetcher implements BalanceAndProxyAllowanceFetcher { private _token: TokenWrapper; private _defaultBlock: BlockParamLiteral; constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) { diff --git a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts index 9ca622a69..97739f969 100644 --- a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts @@ -3,12 +3,12 @@ import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { TokenWrapper } from '../contract_wrappers/token_wrapper'; -import { BalanceAndAllowanceFetcher } from '../abstract/balance_and_allowance_fetcher'; +import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher'; /** * Copy on read store for balances/proxyAllowances of tokens/accounts */ -export class BalanceAndProxyAllowanceLazyStore implements BalanceAndAllowanceFetcher { +export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowanceFetcher { private _token: TokenWrapper; private _defaultBlock: BlockParamLiteral; private _balance: { diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index d45b67dc2..d8d69185f 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash'; import { ZeroEx } from '../0x'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { BalanceAndAllowanceFetcher } from '../abstract/balance_and_allowance_fetcher'; +import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher'; import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher'; import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator'; import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types'; @@ -12,7 +12,7 @@ import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; export class OrderStateUtils { - private _balanceAndAllowanceFetcher: BalanceAndAllowanceFetcher; + private _balanceAndProxyAllowanceFetcher: BalanceAndProxyAllowanceFetcher; private _orderFilledCancelledFetcher: OrderFilledCancelledFetcher; private static _validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void { const unavailableTakerTokenAmount = orderRelevantState.cancelledTakerTokenAmount.add( @@ -49,10 +49,10 @@ export class OrderStateUtils { } } constructor( - balanceAndProxyAllowanceFetcher: BalanceAndAllowanceFetcher, + balanceAndProxyAllowanceFetcher: BalanceAndProxyAllowanceFetcher, orderFilledCancelledFetcher: OrderFilledCancelledFetcher, ) { - this._balanceAndAllowanceFetcher = balanceAndProxyAllowanceFetcher; + this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } public async getOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { @@ -83,19 +83,19 @@ export class OrderStateUtils { const exchange = (this._orderFilledCancelledFetcher as any)._exchange as ExchangeWrapper; const zrxTokenAddress = exchange.getZRXTokenAddress(); const orderHash = ZeroEx.getOrderHashHex(signedOrder); - const makerBalance = await this._balanceAndAllowanceFetcher.getBalanceAsync( + const makerBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( signedOrder.makerTokenAddress, signedOrder.maker, ); - const makerProxyAllowance = await this._balanceAndAllowanceFetcher.getProxyAllowanceAsync( + const makerProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( signedOrder.makerTokenAddress, signedOrder.maker, ); - const makerFeeBalance = await this._balanceAndAllowanceFetcher.getBalanceAsync( + const makerFeeBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( zrxTokenAddress, signedOrder.maker, ); - const makerFeeProxyAllowance = await this._balanceAndAllowanceFetcher.getProxyAllowanceAsync( + const makerFeeProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( zrxTokenAddress, signedOrder.maker, ); |