aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-17 19:16:47 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-17 19:16:47 +0800
commit6c2796b433257806efd294318e5f46c8a020184c (patch)
treee427088366e7e0776c221e183d00c626ea2509f8
parent82ad5f789721312577735fc3ac7227c672903849 (diff)
downloaddexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar.gz
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar.bz2
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar.lz
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar.xz
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.tar.zst
dexon-sol-tools-6c2796b433257806efd294318e5f46c8a020184c.zip
Rename decodeAssetData to decodeAssetDataOrThrow
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts2
-rw-r--r--packages/fill-scenarios/src/fill_scenarios.ts4
-rw-r--r--packages/order-utils/src/asset_proxy_utils.ts2
-rw-r--r--packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts2
-rw-r--r--packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts4
-rw-r--r--packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts6
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts4
7 files changed, 12 insertions, 12 deletions
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index d227420ee..2f41efd26 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -145,7 +145,7 @@ export class ForwarderWrapper {
feeProportion: number,
makerAssetFillAmount: BigNumber,
): Promise<BigNumber> {
- const makerAssetData = assetProxyUtils.decodeAssetData(orders[0].makerAssetData);
+ const makerAssetData = assetProxyUtils.decodeAssetDataOrThrow(orders[0].makerAssetData);
const makerAssetToken = makerAssetData.tokenAddress;
const params = formatters.createMarketBuyOrders(orders, makerAssetFillAmount);
diff --git a/packages/fill-scenarios/src/fill_scenarios.ts b/packages/fill-scenarios/src/fill_scenarios.ts
index 4905dd596..9f5218274 100644
--- a/packages/fill-scenarios/src/fill_scenarios.ts
+++ b/packages/fill-scenarios/src/fill_scenarios.ts
@@ -150,7 +150,7 @@ export class FillScenarios {
feeRecepientAddress: string,
expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
- const decodedMakerAssetData = assetProxyUtils.decodeAssetData(makerAssetData);
+ const decodedMakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
await this._increaseERC20BalanceAndAllowanceAsync(
decodedMakerAssetData.tokenAddress,
@@ -167,7 +167,7 @@ export class FillScenarios {
(decodedMakerAssetData as ERC721AssetData).tokenId,
);
}
- const decodedTakerAssetData = assetProxyUtils.decodeAssetData(takerAssetData);
+ const decodedTakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(takerAssetData);
if (decodedTakerAssetData.assetProxyId === AssetProxyId.ERC20) {
const takerTokenAddress = decodedTakerAssetData.tokenAddress;
await this._increaseERC20BalanceAndAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount);
diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts
index 8140ad89d..21acb065a 100644
--- a/packages/order-utils/src/asset_proxy_utils.ts
+++ b/packages/order-utils/src/asset_proxy_utils.ts
@@ -134,7 +134,7 @@ export const assetProxyUtils = {
const assetProxyId = assetProxyUtils.decodeAssetProxyId(encodedAssetProxyId);
return assetProxyId;
},
- decodeAssetData(assetData: string): ERC20AssetData | ERC721AssetData {
+ decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData {
const assetProxyId = assetProxyUtils.decodeAssetDataId(assetData);
switch (assetProxyId) {
case AssetProxyId.ERC20:
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..711bd2173 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
@@ -79,7 +79,7 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx
public deleteAllERC721ProxyAllowance(tokenAddress: string, userAddress: string): void {
for (const assetData in this._proxyAllowance) {
if (this._proxyAllowance.hasOwnProperty(assetData)) {
- const decodedAssetData = assetProxyUtils.decodeAssetData(assetData);
+ const decodedAssetData = assetProxyUtils.decodeAssetDataOrThrow(assetData);
if (
decodedAssetData.assetProxyId === AssetProxyId.ERC721 &&
decodedAssetData.tokenAddress === tokenAddress &&
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 b1c013928..bfa33c8b9 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
@@ -14,7 +14,7 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
this._stateLayer = stateLayer;
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
- const decodedAssetData = assetProxyUtils.decodeAssetData(assetData);
+ const decodedAssetData = assetProxyUtils.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.decodeAssetData(assetData);
+ const decodedAssetData = assetProxyUtils.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 ae7d5078c..d639242ac 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
@@ -54,7 +54,7 @@ export class DependentOrderHashesTracker {
return dependentOrderHashes;
}
public getDependentOrderHashesByAssetDataByMaker(makerAddress: string, assetData: string): string[] {
- const decodedAssetData = assetProxyUtils.decodeAssetData(assetData);
+ const decodedAssetData = assetProxyUtils.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.decodeAssetData(signedOrder.makerAssetData);
+ const decodedMakerAssetData = assetProxyUtils.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.decodeAssetData(signedOrder.makerAssetData);
+ const decodedMakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
this._removeFromERC20DependentOrderhashes(
signedOrder,
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index eaa177b6d..de0ff6b87 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -153,14 +153,14 @@ export class OrderWatcher {
this._orderByOrderHash[orderHash] = signedOrder;
this._dependentOrderHashesTracker.addToDependentOrderHashes(signedOrder);
- const decodedMakerAssetData = assetProxyUtils.decodeAssetData(signedOrder.makerAssetData);
+ const decodedMakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
this._collisionResistantAbiDecoder.addERC20Token(decodedMakerAssetData.tokenAddress);
} else if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC721) {
this._collisionResistantAbiDecoder.addERC721Token(decodedMakerAssetData.tokenAddress);
}
- const decodedTakerAssetData = assetProxyUtils.decodeAssetData(signedOrder.takerAssetData);
+ const decodedTakerAssetData = assetProxyUtils.decodeAssetDataOrThrow(signedOrder.takerAssetData);
if (decodedTakerAssetData.assetProxyId === AssetProxyId.ERC20) {
this._collisionResistantAbiDecoder.addERC20Token(decodedTakerAssetData.tokenAddress);
} else if (decodedTakerAssetData.assetProxyId === AssetProxyId.ERC721) {