Skip to content

Commit

Permalink
Merge pull request #784 from gnosis/hotfix_assert
Browse files Browse the repository at this point in the history
use JS assert and bump version
  • Loading branch information
bh2smith authored May 20, 2020
2 parents 1969fd4 + a51c0d1 commit 06ee9c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/dex-contracts",
"version": "0.3.1",
"version": "0.3.2",
"description": "Contracts for dFusion multi-token batch auction exchange",
"main": "build/common/src/index.js",
"types": "build/common/src/index.d.ts",
Expand Down
14 changes: 4 additions & 10 deletions src/amounts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BN from "bn.js";
import { assert } from "chai";
import assert from "assert";
import { Fraction } from "./fraction";

const MAX128 = new BN(2).pow(new BN(128)).subn(1);
Expand All @@ -19,14 +19,8 @@ export function getUnitPrice(
sellTokenDecimals: number,
buyTokenDecimals: number,
): Fraction {
assert.isTrue(
sellTokenDecimals >= 0,
"sell token decimals must be non-negative",
);
assert.isTrue(
buyTokenDecimals >= 0,
"buy token decimals must be non-negative",
);
assert(sellTokenDecimals >= 0, "sell token decimals must be non-negative");
assert(buyTokenDecimals >= 0, "buy token decimals must be non-negative");

return Fraction.fromNumber(price).mul(
new Fraction(
Expand Down Expand Up @@ -83,7 +77,7 @@ export function getUnlimitedOrderAmounts(
buyTokenDecimals,
sellTokenDecimals,
);
assert.isTrue(
assert(
buyAmount.gte(sellAmount),
"Error: unable to create unlimited order",
);
Expand Down

0 comments on commit 06ee9c3

Please sign in to comment.