aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-17 21:26:55 +0800
committerFabio Berger <me@fabioberger.com>2018-07-17 21:26:55 +0800
commitf8dbf57582189315566704ca64e36e9c5d07014f (patch)
tree7fc07498c5ae807b1de283a0d564bdb291d9fe2d /packages/contracts/test/utils
parent15e92958d6e908fde7dabb92aa596adfaeb0eece (diff)
downloaddexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar.gz
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar.bz2
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar.lz
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar.xz
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.tar.zst
dexon-sol-tools-f8dbf57582189315566704ca64e36e9c5d07014f.zip
Rename assetProxyUtils to assetDataUtils
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r--packages/contracts/test/utils/asset_wrapper.ts18
-rw-r--r--packages/contracts/test/utils/core_combinatorial_utils.ts8
-rw-r--r--packages/contracts/test/utils/erc20_wrapper.ts4
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts10
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts14
-rw-r--r--packages/contracts/test/utils/order_factory_from_scenario.ts18
6 files changed, 36 insertions, 36 deletions
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts
index f291170a2..4f83519d9 100644
--- a/packages/contracts/test/utils/asset_wrapper.ts
+++ b/packages/contracts/test/utils/asset_wrapper.ts
@@ -1,4 +1,4 @@
-import { assetProxyUtils } from '@0xproject/order-utils';
+import { assetDataUtils } from '@0xproject/order-utils';
import { AssetProxyId } from '@0xproject/types';
import { BigNumber, errorUtils } from '@0xproject/utils';
import * as _ from 'lodash';
@@ -26,7 +26,7 @@ export class AssetWrapper {
});
}
public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const proxyId = assetProxyUtils.decodeAssetDataId(assetData);
+ const proxyId = assetDataUtils.decodeAssetDataId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
@@ -35,7 +35,7 @@ export class AssetWrapper {
}
case AssetProxyId.ERC721: {
const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData);
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const isOwner = await assetWrapper.isOwnerAsync(
userAddress,
assetProxyData.tokenAddress,
@@ -49,7 +49,7 @@ export class AssetWrapper {
}
}
public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> {
- const proxyId = assetProxyUtils.decodeAssetDataId(assetData);
+ const proxyId = assetDataUtils.decodeAssetDataId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
@@ -61,7 +61,7 @@ export class AssetWrapper {
throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`);
}
const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData);
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const doesTokenExist = erc721Wrapper.doesTokenExistAsync(
assetProxyData.tokenAddress,
assetProxyData.tokenId,
@@ -107,7 +107,7 @@ export class AssetWrapper {
}
}
public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const proxyId = assetProxyUtils.decodeAssetDataId(assetData);
+ const proxyId = assetDataUtils.decodeAssetDataId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
@@ -116,7 +116,7 @@ export class AssetWrapper {
}
case AssetProxyId.ERC721: {
const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const erc721ProxyData = assetProxyUtils.decodeERC721AssetData(assetData);
+ const erc721ProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync(
userAddress,
erc721ProxyData.tokenAddress,
@@ -141,7 +141,7 @@ export class AssetWrapper {
assetData: string,
desiredAllowance: BigNumber,
): Promise<void> {
- const proxyId = assetProxyUtils.decodeAssetDataId(assetData);
+ const proxyId = assetDataUtils.decodeAssetDataId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
@@ -159,7 +159,7 @@ export class AssetWrapper {
);
}
const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetProxyUtils.decodeERC721AssetData(assetData);
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const doesTokenExist = await erc721Wrapper.doesTokenExistAsync(
assetProxyData.tokenAddress,
diff --git a/packages/contracts/test/utils/core_combinatorial_utils.ts b/packages/contracts/test/utils/core_combinatorial_utils.ts
index 7c16ef201..766e48543 100644
--- a/packages/contracts/test/utils/core_combinatorial_utils.ts
+++ b/packages/contracts/test/utils/core_combinatorial_utils.ts
@@ -1,5 +1,5 @@
import {
- assetProxyUtils,
+ assetDataUtils,
BalanceAndProxyAllowanceLazyStore,
ExchangeTransferSimulator,
orderHashUtils,
@@ -72,7 +72,7 @@ export async function coreCombinatorialUtilsFactoryAsync(
erc20EighteenDecimalTokenB,
zrxToken,
] = await erc20Wrapper.deployDummyTokensAsync(erc20EighteenDecimalTokenCount, eighteenDecimals);
- const zrxAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const erc20FiveDecimalTokenCount = 2;
const fiveDecimals = new BigNumber(5);
@@ -598,8 +598,8 @@ export class CoreCombinatorialUtils {
break;
case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount:
- const takerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.takerAssetData);
- const makerAssetProxyId = assetProxyUtils.decodeAssetDataId(signedOrder.makerAssetData);
+ const takerAssetProxyId = assetDataUtils.decodeAssetDataId(signedOrder.takerAssetData);
+ const makerAssetProxyId = assetDataUtils.decodeAssetDataId(signedOrder.makerAssetData);
const isEitherAssetERC721 =
takerAssetProxyId === AssetProxyId.ERC721 || makerAssetProxyId === AssetProxyId.ERC721;
if (isEitherAssetERC721) {
diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts
index cf1433791..171757a72 100644
--- a/packages/contracts/test/utils/erc20_wrapper.ts
+++ b/packages/contracts/test/utils/erc20_wrapper.ts
@@ -1,4 +1,4 @@
-import { assetProxyUtils } from '@0xproject/order-utils';
+import { assetDataUtils } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Provider } from 'ethereum-types';
@@ -154,7 +154,7 @@ export class ERC20Wrapper {
return tokenAddresses;
}
private _getTokenContractFromAssetData(assetData: string): DummyERC20TokenContract {
- const erc20ProxyData = assetProxyUtils.decodeERC20AssetData(assetData);
+ const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
const tokenAddress = erc20ProxyData.tokenAddress;
const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
if (_.isUndefined(tokenContractIfExists)) {
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index d227420ee..b2450b592 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -1,4 +1,4 @@
-import { assetProxyUtils } from '@0xproject/order-utils';
+import { assetDataUtils } from '@0xproject/order-utils';
import { AssetProxyId, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -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 = assetProxyUtils.decodeAssetDataId(signedOrders[0].makerAssetData);
+ const assetDataId = assetDataUtils.decodeAssetDataId(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 = assetProxyUtils.decodeAssetDataId(orders[0].makerAssetData);
+ const assetDataId = assetDataUtils.decodeAssetDataId(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 = assetProxyUtils.decodeAssetDataId(orders[0].makerAssetData);
+ const assetProxyId = assetDataUtils.decodeAssetDataId(orders[0].makerAssetData);
switch (assetProxyId) {
case AssetProxyId.ERC20: {
const fillAmountWei = this._calculateMarketBuyERC20FillAmountAsync(
@@ -145,7 +145,7 @@ export class ForwarderWrapper {
feeProportion: number,
makerAssetFillAmount: BigNumber,
): Promise<BigNumber> {
- const makerAssetData = assetProxyUtils.decodeAssetData(orders[0].makerAssetData);
+ const makerAssetData = assetDataUtils.decodeAssetData(orders[0].makerAssetData);
const makerAssetToken = makerAssetData.tokenAddress;
const params = formatters.createMarketBuyOrders(orders, makerAssetFillAmount);
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index 6145779b0..889bda5bf 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -1,4 +1,4 @@
-import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { AssetProxyId, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -233,10 +233,10 @@ export class MatchOrderTester {
const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner);
const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner);
// Left Maker Asset (Right Taker Asset)
- const makerAssetProxyIdLeft = assetProxyUtils.decodeAssetDataId(signedOrderLeft.makerAssetData);
+ const makerAssetProxyIdLeft = assetDataUtils.decodeAssetDataId(signedOrderLeft.makerAssetData);
if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const erc20AssetData = assetProxyUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData);
+ const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData);
const makerAssetAddressLeft = erc20AssetData.tokenAddress;
const takerAssetAddressRight = makerAssetAddressLeft;
// Left Maker
@@ -255,7 +255,7 @@ export class MatchOrderTester {
][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
} else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- const erc721AssetData = assetProxyUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
+ const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
const makerAssetAddressLeft = erc721AssetData.tokenAddress;
const makerAssetIdLeft = erc721AssetData.tokenId;
const takerAssetAddressRight = makerAssetAddressLeft;
@@ -268,10 +268,10 @@ 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 = assetProxyUtils.decodeAssetDataId(signedOrderLeft.takerAssetData);
+ const takerAssetProxyIdLeft = assetDataUtils.decodeAssetDataId(signedOrderLeft.takerAssetData);
if (takerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const erc20AssetData = assetProxyUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData);
+ const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData);
const takerAssetAddressLeft = erc20AssetData.tokenAddress;
const makerAssetAddressRight = takerAssetAddressLeft;
// Left Maker
@@ -286,7 +286,7 @@ export class MatchOrderTester {
);
} else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- const erc721AssetData = assetProxyUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
+ const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
const makerAssetAddressRight = erc721AssetData.tokenAddress;
const makerAssetIdRight = erc721AssetData.tokenId;
const takerAssetAddressLeft = makerAssetAddressRight;
diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts
index 526505871..6e1b6c67d 100644
--- a/packages/contracts/test/utils/order_factory_from_scenario.ts
+++ b/packages/contracts/test/utils/order_factory_from_scenario.ts
@@ -1,4 +1,4 @@
-import { assetProxyUtils, generatePseudoRandomSalt } from '@0xproject/order-utils';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0xproject/order-utils';
import { Order } from '@0xproject/types';
import { BigNumber, errorUtils } from '@0xproject/utils';
@@ -75,18 +75,18 @@ export class OrderFactoryFromScenario {
switch (orderScenario.makerAssetDataScenario) {
case AssetDataScenario.ZRXFeeToken:
- makerAssetData = assetProxyUtils.encodeERC20AssetData(this._zrxAddress);
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
break;
case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- makerAssetData = assetProxyUtils.encodeERC20AssetData(
+ makerAssetData = assetDataUtils.encodeERC20AssetData(
this._nonZrxERC20EighteenDecimalTokenAddresses[0],
);
break;
case AssetDataScenario.ERC20FiveDecimals:
- makerAssetData = assetProxyUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[0]);
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[0]);
break;
case AssetDataScenario.ERC721:
- makerAssetData = assetProxyUtils.encodeERC721AssetData(
+ makerAssetData = assetDataUtils.encodeERC721AssetData(
this._erc721Token.address,
erc721MakerAssetIds[0],
);
@@ -97,18 +97,18 @@ export class OrderFactoryFromScenario {
switch (orderScenario.takerAssetDataScenario) {
case AssetDataScenario.ZRXFeeToken:
- takerAssetData = assetProxyUtils.encodeERC20AssetData(this._zrxAddress);
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
break;
case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- takerAssetData = assetProxyUtils.encodeERC20AssetData(
+ takerAssetData = assetDataUtils.encodeERC20AssetData(
this._nonZrxERC20EighteenDecimalTokenAddresses[1],
);
break;
case AssetDataScenario.ERC20FiveDecimals:
- takerAssetData = assetProxyUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[1]);
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[1]);
break;
case AssetDataScenario.ERC721:
- takerAssetData = assetProxyUtils.encodeERC721AssetData(
+ takerAssetData = assetDataUtils.encodeERC721AssetData(
this._erc721Token.address,
erc721TakerAssetIds[0],
);