aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/asset_proxy_utils.ts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-02 05:17:13 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:38:48 +0800
commite4e36760952287a84f8991df8589c183036383db (patch)
tree83c5ba694848232f6d3b01a72dc8c3d94cb9d071 /packages/order-utils/src/asset_proxy_utils.ts
parent3ed13150e106c19563c8e9b06621be3d44d66b6c (diff)
downloaddexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.gz
dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.zst
dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.zip
Fixed up after rebasing. Contracts build and tests pass
Diffstat (limited to 'packages/order-utils/src/asset_proxy_utils.ts')
-rw-r--r--packages/order-utils/src/asset_proxy_utils.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts
index 1f1e49f0f..a12be83a3 100644
--- a/packages/order-utils/src/asset_proxy_utils.ts
+++ b/packages/order-utils/src/asset_proxy_utils.ts
@@ -79,13 +79,14 @@ export const assetProxyUtils = {
const encodedAssetProxyId = assetProxyUtils.encodeAssetProxyId(AssetProxyId.ERC721);
const encodedAddress = assetProxyUtils.encodeAddress(tokenAddress);
const encodedTokenId = assetProxyUtils.encodeUint256(tokenId);
- const encodedMetadata = Buffer.concat([encodedAddress, encodedTokenId, encodedAssetProxyId]);
+ let encodedMetadata = Buffer.concat([encodedAddress, encodedTokenId]);
if (!_.isUndefined(data)) {
const encodedData = ethUtil.toBuffer(data);
const dataLength = new BigNumber(encodedData.byteLength);
const encodedDataLength = assetProxyUtils.encodeUint256(dataLength);
encodedMetadata = Buffer.concat([encodedMetadata, encodedDataLength, encodedData]);
}
+ encodedMetadata = Buffer.concat([encodedMetadata, encodedAssetProxyId]);
const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
return encodedMetadataHex;
},
@@ -116,7 +117,7 @@ export const assetProxyUtils = {
const nullData = '0x';
let data = nullData;
if (encodedAssetData.byteLength > 53) {
- const encodedDataLength = encodedAssetData.slice(53, 85);
+ const encodedDataLength = encodedAssetData.slice(52, 84);
const dataLength = assetProxyUtils.decodeUint256(encodedDataLength);
const expectedDataLength = new BigNumber(encodedAssetData.byteLength - 85);
if (!dataLength.equals(expectedDataLength)) {
@@ -124,7 +125,7 @@ export const assetProxyUtils = {
`Data length (${dataLength}) does not match actual length of data (${expectedDataLength})`,
);
}
- const encodedData = encodedAssetData.slice(85);
+ const encodedData = encodedAssetData.slice(84, expectedDataLength.toNumber() + 84);
data = ethUtil.bufferToHex(encodedData);
}
const erc721AssetData: ERC721AssetData = {