aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/0x.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r--packages/0x.js/src/0x.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 596d6ffba..a18f1fc55 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -149,6 +149,10 @@ export class ZeroEx {
const unit = new BigNumber(10).pow(decimals);
const baseUnitAmount = amount.times(unit);
+ const hasDecimals = baseUnitAmount.decimalPlaces() !== 0;
+ if (hasDecimals) {
+ throw new Error(`Invalid unit amount: ${amount.toString()} - Too many decimal places`);
+ }
return baseUnitAmount;
}
/**