diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-18 17:49:30 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-18 17:49:30 +0800 |
commit | 12f02b98143513d8309a9df7d4dcab46d60352da (patch) | |
tree | e09c9b77de3c5737fd1936d484e010ba6e848fee | |
parent | 89313883098b545c2afe9c4d84bc02b8bc8fd370 (diff) | |
download | dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar.gz dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar.bz2 dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar.lz dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar.xz dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.tar.zst dexon-sol-tools-12f02b98143513d8309a9df7d4dcab46d60352da.zip |
Rename decodeAssetDataId to decodeAssetProxyId for consistency
5 files changed, 13 insertions, 13 deletions
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts index 4f83519d9..8cf973565 100644 --- a/packages/contracts/test/utils/asset_wrapper.ts +++ b/packages/contracts/test/utils/asset_wrapper.ts @@ -26,7 +26,7 @@ export class AssetWrapper { }); } public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { - const proxyId = assetDataUtils.decodeAssetDataId(assetData); + const proxyId = assetDataUtils.decodeAssetProxyId(assetData); switch (proxyId) { case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; @@ -49,7 +49,7 @@ export class AssetWrapper { } } public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> { - const proxyId = assetDataUtils.decodeAssetDataId(assetData); + const proxyId = assetDataUtils.decodeAssetProxyId(assetData); switch (proxyId) { case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; @@ -107,7 +107,7 @@ export class AssetWrapper { } } public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> { - const proxyId = assetDataUtils.decodeAssetDataId(assetData); + const proxyId = assetDataUtils.decodeAssetProxyId(assetData); switch (proxyId) { case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; @@ -141,7 +141,7 @@ export class AssetWrapper { assetData: string, desiredAllowance: BigNumber, ): Promise<void> { - const proxyId = assetDataUtils.decodeAssetDataId(assetData); + const proxyId = assetDataUtils.decodeAssetProxyId(assetData); switch (proxyId) { case AssetProxyId.ERC20: { const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper; diff --git a/packages/contracts/test/utils/core_combinatorial_utils.ts b/packages/contracts/test/utils/core_combinatorial_utils.ts index 766e48543..44a5199c0 100644 --- a/packages/contracts/test/utils/core_combinatorial_utils.ts +++ b/packages/contracts/test/utils/core_combinatorial_utils.ts @@ -598,8 +598,8 @@ export class CoreCombinatorialUtils { break; case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount: - const takerAssetProxyId = assetDataUtils.decodeAssetDataId(signedOrder.takerAssetData); - const makerAssetProxyId = assetDataUtils.decodeAssetDataId(signedOrder.makerAssetData); + const takerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.takerAssetData); + const makerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.makerAssetData); const isEitherAssetERC721 = takerAssetProxyId === AssetProxyId.ERC721 || makerAssetProxyId === AssetProxyId.ERC721; if (isEitherAssetERC721) { diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts index b2450b592..b60399a9c 100644 --- a/packages/contracts/test/utils/forwarder_wrapper.ts +++ b/packages/contracts/test/utils/forwarder_wrapper.ts @@ -24,7 +24,7 @@ export class ForwarderWrapper { private _zrxAddress: string; private static _createOptimizedSellOrders(signedOrders: SignedOrder[]): MarketSellOrders { const marketSellOrders = formatters.createMarketSellOrders(signedOrders, ZERO_AMOUNT); - const assetDataId = assetDataUtils.decodeAssetDataId(signedOrders[0].makerAssetData); + const assetDataId = assetDataUtils.decodeAssetProxyId(signedOrders[0].makerAssetData); // Contract will fill this in for us as all of the assetData is assumed to be the same for (let i = 0; i < signedOrders.length; i++) { if (i !== 0 && assetDataId === AssetProxyId.ERC20) { @@ -90,7 +90,7 @@ export class ForwarderWrapper { txData: TxDataPayable, opts: { feeProportion?: number; feeRecipient?: string } = {}, ): Promise<TransactionReceiptWithDecodedLogs> { - const assetDataId = assetDataUtils.decodeAssetDataId(orders[0].makerAssetData); + const assetDataId = assetDataUtils.decodeAssetProxyId(orders[0].makerAssetData); if (assetDataId !== AssetProxyId.ERC20) { throw new Error('Asset type not supported by marketSellEthForERC20'); } @@ -116,7 +116,7 @@ export class ForwarderWrapper { feeProportion: number, makerAssetFillAmount: BigNumber, ): Promise<BigNumber> { - const assetProxyId = assetDataUtils.decodeAssetDataId(orders[0].makerAssetData); + const assetProxyId = assetDataUtils.decodeAssetProxyId(orders[0].makerAssetData); switch (assetProxyId) { case AssetProxyId.ERC20: { const fillAmountWei = this._calculateMarketBuyERC20FillAmountAsync( diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts index 889bda5bf..ffec01714 100644 --- a/packages/contracts/test/utils/match_order_tester.ts +++ b/packages/contracts/test/utils/match_order_tester.ts @@ -233,7 +233,7 @@ export class MatchOrderTester { const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner); const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner); // Left Maker Asset (Right Taker Asset) - const makerAssetProxyIdLeft = assetDataUtils.decodeAssetDataId(signedOrderLeft.makerAssetData); + const makerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.makerAssetData); if (makerAssetProxyIdLeft === AssetProxyId.ERC20) { // Decode asset data const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData); @@ -268,7 +268,7 @@ export class MatchOrderTester { } // Left Taker Asset (Right Maker Asset) // Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset. - const takerAssetProxyIdLeft = assetDataUtils.decodeAssetDataId(signedOrderLeft.takerAssetData); + const takerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.takerAssetData); if (takerAssetProxyIdLeft === AssetProxyId.ERC20) { // Decode asset data const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData); diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index 732849f6f..68ce129ba 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -100,7 +100,7 @@ export const assetDataUtils = { * @param assetData Hex encoded assetData string to decode * @return The assetProxyId */ - decodeAssetDataId(assetData: string): AssetProxyId { + decodeAssetProxyId(assetData: string): AssetProxyId { const encodedAssetData = ethUtil.toBuffer(assetData); if (encodedAssetData.byteLength < constants.SELECTOR_LENGTH) { throw new Error( @@ -119,7 +119,7 @@ export const assetDataUtils = { * @return Either a ERC20 or ERC721 assetData object */ decodeAssetData(assetData: string): ERC20AssetData | ERC721AssetData { - const assetProxyId = assetDataUtils.decodeAssetDataId(assetData); + const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); switch (assetProxyId) { case AssetProxyId.ERC20: const erc20AssetData = assetDataUtils.decodeERC20AssetData(assetData); |