aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 20:22:52 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 23:25:26 +0800
commit17f313658d308f9a0f1ea502f83313b34c62e28d (patch)
tree4807875eac4389703c7f03e01c3e82e5b5cc7a27 /packages/utils/src
parentd304c062eb429d144c0f961864d185cde85a27e5 (diff)
downloaddexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar.gz
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar.bz2
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar.lz
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar.xz
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.tar.zst
dexon-sol-tools-17f313658d308f9a0f1ea502f83313b34c62e28d.zip
Add a NAN check when parsing BigNumber candidate
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/utils/math.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/utils/src/abi_encoder/utils/math.ts b/packages/utils/src/abi_encoder/utils/math.ts
index b2fa5fe7d..dd45ea05c 100644
--- a/packages/utils/src/abi_encoder/utils/math.ts
+++ b/packages/utils/src/abi_encoder/utils/math.ts
@@ -1,7 +1,7 @@
-import BigNumber from 'bignumber.js';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
+import { BigNumber } from '../../configured_bignumber';
import { constants } from '../utils/constants';
function sanityCheckBigNumberRange(
@@ -14,6 +14,8 @@ function sanityCheckBigNumberRange(
throw new Error(`Tried to assign value of ${value}, which exceeds max value of ${maxValue}`);
} else if (value.isLessThan(minValue)) {
throw new Error(`Tried to assign value of ${value}, which exceeds min value of ${minValue}`);
+ } else if (value.isNaN) {
+ throw new Error(`Tried to assign NaN value`);
}
}
function bigNumberToPaddedBuffer(value: BigNumber): Buffer {