aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-05 13:34:04 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:39:40 +0800
commit774d831fae5809408f9ddfcf9393d579416b1bfb (patch)
tree6ea66da84f218b54263aaec1d5c6f8a5b064abc6 /packages/order-utils
parenta1b49d8389844c9b2d62ded91b76a23deb060ab6 (diff)
downloaddexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.gz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.bz2
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.lz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.xz
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.tar.zst
dexon-sol-tools-774d831fae5809408f9ddfcf9393d579416b1bfb.zip
Style updates to ERC721 onReceiver
Diffstat (limited to 'packages/order-utils')
-rw-r--r--packages/order-utils/src/asset_proxy_utils.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts
index 61a9b12e9..c7b301c1a 100644
--- a/packages/order-utils/src/asset_proxy_utils.ts
+++ b/packages/order-utils/src/asset_proxy_utils.ts
@@ -119,10 +119,12 @@ export const assetProxyUtils = {
const tokenId = assetProxyUtils.decodeUint256(encodedTokenId);
const nullData = '0x';
let receiverData = nullData;
- if (encodedAssetData.byteLength > receiverDataLengthOffset + 1) {
+ const lengthUpToReceiverDataLength = receiverDataLengthOffset + 1;
+ if (encodedAssetData.byteLength > lengthUpToReceiverDataLength) {
const encodedReceiverDataLength = encodedAssetData.slice(receiverDataLengthOffset, receiverDataOffset);
const receiverDataLength = assetProxyUtils.decodeUint256(encodedReceiverDataLength);
- const expectedReceiverDataLength = new BigNumber(encodedAssetData.byteLength - (receiverDataOffset + 1));
+ const lengthUpToReceiverData = receiverDataOffset + 1;
+ const expectedReceiverDataLength = new BigNumber(encodedAssetData.byteLength - lengthUpToReceiverData);
if (!receiverDataLength.equals(expectedReceiverDataLength)) {
throw new Error(
`Data length (${receiverDataLength}) does not match actual length of data (${expectedReceiverDataLength})`,
@@ -167,12 +169,12 @@ export const assetProxyUtils = {
return generalizedERC20AssetData;
case AssetProxyId.ERC721:
const erc721AssetData = assetProxyUtils.decodeERC721AssetData(assetData);
- const generaliedERC721AssetData = {
+ const generalizedERC721AssetData = {
assetProxyId,
tokenAddress: erc721AssetData.tokenAddress,
data: erc721AssetData.tokenId,
};
- return generaliedERC721AssetData;
+ return generalizedERC721AssetData;
default:
throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`);
}