aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-18 21:48:23 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-18 22:31:17 +0800
commita1acf19ff3c1948214dde05a91eb3fbeac728d2c (patch)
tree44789fff181ec24846728d885ba541c23f682321 /packages/order-watcher
parent5044fe4fe4486f67408572cf6807482aecf7f6c9 (diff)
downloaddexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar.gz
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar.bz2
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar.lz
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar.xz
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.tar.zst
dexon-sol-tools-a1acf19ff3c1948214dde05a91eb3fbeac728d2c.zip
Fix a bad merge
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts6
-rw-r--r--packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts14
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts18
-rw-r--r--packages/order-watcher/test/expiration_watcher_test.ts6
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts10
5 files changed, 27 insertions, 27 deletions
diff --git a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
index bfa33c8b9..a1de22a5e 100644
--- a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
@@ -1,6 +1,6 @@
// tslint:disable:no-unnecessary-type-assertion
import { BlockParamLiteral, ERC20TokenWrapper, ERC721TokenWrapper } from '@0xproject/contract-wrappers';
-import { AbstractBalanceAndProxyAllowanceFetcher, assetProxyUtils } from '@0xproject/order-utils';
+import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0xproject/order-utils';
import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
@@ -14,7 +14,7 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
this._stateLayer = stateLayer;
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
- const decodedAssetData = assetProxyUtils.decodeAssetDataOrThrow(assetData);
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
@@ -35,7 +35,7 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
}
}
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
- const decodedAssetData = assetProxyUtils.decodeAssetDataOrThrow(assetData);
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
diff --git a/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts b/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
index d639242ac..cc70bd5d7 100644
--- a/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
+++ b/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
@@ -1,5 +1,5 @@
// tslint:disable:no-unnecessary-type-assertion
-import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { AssetProxyId, ERC20AssetData, ERC721AssetData, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
@@ -54,7 +54,7 @@ export class DependentOrderHashesTracker {
return dependentOrderHashes;
}
public getDependentOrderHashesByAssetDataByMaker(makerAddress: string, assetData: string): string[] {
- const decodedAssetData = assetProxyUtils.decodeAssetDataOrThrow(assetData);
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
const dependentOrderHashes =
decodedAssetData.assetProxyId === AssetProxyId.ERC20
? this._getDependentOrderHashesByERC20AssetData(makerAddress, assetData)
@@ -62,7 +62,7 @@ export class DependentOrderHashesTracker {
return dependentOrderHashes;
}
public addToDependentOrderHashes(signedOrder: SignedOrder): void {
- const decodedMakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
+ const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
this._addToERC20DependentOrderHashes(signedOrder, (decodedMakerAssetData as ERC20AssetData).tokenAddress);
} else {
@@ -76,7 +76,7 @@ export class DependentOrderHashesTracker {
this._addToMakerDependentOrderHashes(signedOrder);
}
public removeFromDependentOrderHashes(signedOrder: SignedOrder): void {
- const decodedMakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
+ const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
this._removeFromERC20DependentOrderhashes(
signedOrder,
@@ -93,7 +93,7 @@ export class DependentOrderHashesTracker {
this._removeFromMakerDependentOrderhashes(signedOrder);
}
private _getDependentOrderHashesByERC20AssetData(makerAddress: string, erc20AssetData: string): string[] {
- const tokenAddress = assetProxyUtils.decodeERC20AssetData(erc20AssetData).tokenAddress;
+ const tokenAddress = assetDataUtils.decodeERC20AssetData(erc20AssetData).tokenAddress;
let dependentOrderHashes: string[] = [];
if (
!_.isUndefined(this._orderHashesByERC20ByMakerAddress[makerAddress]) &&
@@ -104,8 +104,8 @@ export class DependentOrderHashesTracker {
return dependentOrderHashes;
}
private _getDependentOrderHashesByERC721AssetData(makerAddress: string, erc721AssetData: string): string[] {
- const tokenAddress = assetProxyUtils.decodeERC721AssetData(erc721AssetData).tokenAddress;
- const tokenId = assetProxyUtils.decodeERC721AssetData(erc721AssetData).tokenId;
+ const tokenAddress = assetDataUtils.decodeERC721AssetData(erc721AssetData).tokenAddress;
+ const tokenId = assetDataUtils.decodeERC721AssetData(erc721AssetData).tokenId;
let dependentOrderHashes: string[] = [];
if (
!_.isUndefined(this._orderHashesByERC721AddressByTokenIdByMakerAddress[makerAddress]) &&
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index afc854445..2dfbd4230 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -22,7 +22,7 @@ import {
} from '@0xproject/contract-wrappers';
import { schemas } from '@0xproject/json-schemas';
import {
- assetProxyUtils,
+ assetDataUtils,
BalanceAndProxyAllowanceLazyStore,
OrderFilledCancelledLazyStore,
orderHashUtils,
@@ -125,7 +125,7 @@ export class OrderWatcher {
config.orderExpirationCheckingIntervalMs,
);
this._cleanupJobInterval = config.cleanupJobIntervalMs;
- const zrxTokenAddress = assetProxyUtils.decodeERC20AssetData(orderFilledCancelledFetcher.getZRXAssetData())
+ const zrxTokenAddress = assetDataUtils.decodeERC20AssetData(orderFilledCancelledFetcher.getZRXAssetData())
.tokenAddress;
this._dependentOrderHashesTracker = new DependentOrderHashesTracker(zrxTokenAddress);
}
@@ -147,7 +147,7 @@ export class OrderWatcher {
const orderAssetDatas = [signedOrder.makerAssetData, signedOrder.takerAssetData];
_.each(orderAssetDatas, assetData => {
- const decodedAssetData = assetProxyUtils.decodeAssetDataOrThrow(assetData);
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
this._collisionResistantAbiDecoder.addERC20Token(decodedAssetData.tokenAddress);
} else if (decodedAssetData.assetProxyId === AssetProxyId.ERC721) {
@@ -277,7 +277,7 @@ export class OrderWatcher {
// ERC20
// Invalidate cache
const args = decodedLog.args as ERC20TokenApprovalEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC20AssetData(decodedLog.address);
+ const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
@@ -290,7 +290,7 @@ export class OrderWatcher {
// ERC721
// Invalidate cache
const args = decodedLog.args as ERC721TokenApprovalEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
+ const tokenAssetData = assetDataUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
@@ -308,7 +308,7 @@ export class OrderWatcher {
// ERC20
// Invalidate cache
const args = decodedLog.args as ERC20TokenTransferEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC20AssetData(decodedLog.address);
+ const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._to);
// Revalidate orders
@@ -322,7 +322,7 @@ export class OrderWatcher {
// ERC721
// Invalidate cache
const args = decodedLog.args as ERC721TokenTransferEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
+ const tokenAssetData = assetDataUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._to);
// Revalidate orders
@@ -350,7 +350,7 @@ export class OrderWatcher {
case WETH9Events.Deposit: {
// Invalidate cache
const args = decodedLog.args as WETH9DepositEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC20AssetData(decodedLog.address);
+ const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
@@ -363,7 +363,7 @@ export class OrderWatcher {
case WETH9Events.Withdrawal: {
// Invalidate cache
const args = decodedLog.args as WETH9WithdrawalEventArgs;
- const tokenAssetData = assetProxyUtils.encodeERC20AssetData(decodedLog.address);
+ const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
diff --git a/packages/order-watcher/test/expiration_watcher_test.ts b/packages/order-watcher/test/expiration_watcher_test.ts
index f765e8278..ea9923487 100644
--- a/packages/order-watcher/test/expiration_watcher_test.ts
+++ b/packages/order-watcher/test/expiration_watcher_test.ts
@@ -2,7 +2,7 @@ import { ContractWrappers } from '@0xproject/contract-wrappers';
import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
-import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { DoneCallback } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -56,8 +56,8 @@ describe('ExpirationWatcher', () => {
[coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses;
const [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
[makerAssetData, takerAssetData] = [
- assetProxyUtils.encodeERC20AssetData(makerTokenAddress),
- assetProxyUtils.encodeERC20AssetData(takerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(makerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(takerTokenAddress),
];
});
after(async () => {
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts
index 2363bb544..00962bed0 100644
--- a/packages/order-watcher/test/order_watcher_test.ts
+++ b/packages/order-watcher/test/order_watcher_test.ts
@@ -1,9 +1,9 @@
// tslint:disable:no-unnecessary-type-assertion
-import { BlockParamLiteral, ContractWrappers } from '@0xproject/contract-wrappers';
+import { ContractWrappers } from '@0xproject/contract-wrappers';
import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
-import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import {
DoneCallback,
ExchangeContractErrs,
@@ -71,8 +71,8 @@ describe('OrderWatcher', () => {
[coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
[makerAssetData, takerAssetData] = [
- assetProxyUtils.encodeERC20AssetData(makerTokenAddress),
- assetProxyUtils.encodeERC20AssetData(takerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(makerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(takerTokenAddress),
];
const orderWatcherConfig = {};
orderWatcher = new OrderWatcher(provider, networkId, orderWatcherConfig);
@@ -539,7 +539,7 @@ describe('OrderWatcher', () => {
let makerErc721TokenAddress: string;
const tokenId = new BigNumber(42);
[makerErc721TokenAddress] = tokenUtils.getDummyERC721TokenAddresses();
- makerErc721AssetData = assetProxyUtils.encodeERC721AssetData(makerErc721TokenAddress, tokenId);
+ makerErc721AssetData = assetDataUtils.encodeERC721AssetData(makerErc721TokenAddress, tokenId);
const fillableErc721Amount = new BigNumber(1);
it('should emit orderStateInvalid when maker allowance set to 0 for watched order', (done: DoneCallback) => {
(async () => {