aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-05-17 08:55:50 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-05-19 08:01:06 +0800
commit2eb5819851252eb90207765ed64a119ad138c0ad (patch)
treebbc49596d4d60d0a5b40cff207e527f71ab99e41 /packages/contracts/test/utils
parente748e1891b6af5c5f60f5c1fc45482ace6a3b2ad (diff)
downloaddexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar.gz
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar.bz2
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar.lz
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar.xz
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.tar.zst
dexon-sol-tools-2eb5819851252eb90207765ed64a119ad138c0ad.zip
Cleaned up interface for decoding proxy data. Added a general decoder, which should be useful for the forwarding contract code.
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts22
1 files changed, 10 insertions, 12 deletions
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index 467b65927..2e15b5e1e 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -73,7 +73,8 @@ export class MatchOrderTester {
const makerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.makerAssetData);
if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const makerAssetAddressLeft = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.makerAssetData);
+ const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc20ProxyData.tokenAddress;
const takerAssetAddressRight = makerAssetAddressLeft;
// Left Maker
expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
@@ -91,11 +92,9 @@ export class MatchOrderTester {
][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
} else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- let makerAssetAddressLeft;
- let makerAssetIdLeft;
- [makerAssetAddressLeft, makerAssetIdLeft] = assetProxyUtils.decodeERC721ProxyData(
- signedOrderLeft.makerAssetData,
- );
+ const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc721ProxyData.tokenAddress;
+ const makerAssetIdLeft = erc721ProxyData.tokenId;
const takerAssetAddressRight = makerAssetAddressLeft;
const takerAssetIdRight = makerAssetIdLeft;
// Left Maker
@@ -109,7 +108,8 @@ export class MatchOrderTester {
const takerAssetProxyIdLeft = assetProxyUtils.decodeProxyDataId(signedOrderLeft.takerAssetData);
if (takerAssetProxyIdLeft === AssetProxyId.ERC20) {
// Decode asset data
- const takerAssetAddressLeft = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.takerAssetData);
+ const erc20ProxyData = assetProxyUtils.decodeERC20ProxyData(signedOrderLeft.takerAssetData);
+ const takerAssetAddressLeft = erc20ProxyData.tokenAddress;
const makerAssetAddressRight = takerAssetAddressLeft;
// Left Maker
expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
@@ -123,11 +123,9 @@ export class MatchOrderTester {
);
} else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) {
// Decode asset data
- let makerAssetAddressRight;
- let makerAssetIdRight;
- [makerAssetAddressRight, makerAssetIdRight] = assetProxyUtils.decodeERC721ProxyData(
- signedOrderRight.makerAssetData,
- );
+ const erc721ProxyData = assetProxyUtils.decodeERC721ProxyData(signedOrderRight.makerAssetData);
+ const makerAssetAddressRight = erc721ProxyData.tokenAddress;
+ const makerAssetIdRight = erc721ProxyData.tokenId;
const takerAssetAddressLeft = makerAssetAddressRight;
const takerAssetIdLeft = makerAssetIdRight;
// Right Maker