aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert/src
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-01-18 15:17:22 +0800
committerJacob Evans <jacob@dekz.net>2018-01-19 07:31:06 +0800
commitcfc868bf4dc371b299801dd24917a695387546e2 (patch)
treed4385425a85a1ef669ad1b58d71b3ad20b97a2b7 /packages/assert/src
parent7b4e2257d8316ea12c1874b03d148a458318dbc1 (diff)
downloaddexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar.gz
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar.bz2
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar.lz
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar.xz
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.tar.zst
dexon-sol-tools-cfc868bf4dc371b299801dd24917a695387546e2.zip
Reject negative amounts in isValidBaseUnitAmount
Diffstat (limited to 'packages/assert/src')
-rw-r--r--packages/assert/src/index.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 56f663780..015ffe579 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -12,6 +12,8 @@ export const assert = {
},
isValidBaseUnitAmount(variableName: string, value: BigNumber) {
assert.isBigNumber(variableName, value);
+ const isNegative = value.lessThan(0);
+ this.assert(!isNegative, `${variableName} should not be a negative number, found value: ${value.toNumber()}` );
const hasDecimals = value.decimalPlaces() !== 0;
this.assert(
!hasDecimals,