Skip to content

Commit

Permalink
Merge pull request #191 from bancorprotocol/fix/decimal-override
Browse files Browse the repository at this point in the history
cloned decimal ctor
  • Loading branch information
zavelevsky authored Dec 11, 2024
2 parents dda64d7 + 574282c commit 692d6a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@bancor/carbon-sdk",
"type": "module",
"source": "src/index.ts",
"version": "0.0.102-DEV",
"version": "0.0.103-DEV",
"description": "The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfill trades",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand Down
4 changes: 3 additions & 1 deletion src/utils/numerics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
parseUnits as _parseUnits,
formatUnits as _formatUnits,
} from '@ethersproject/units';
import Decimal from 'decimal.js';
import DecimalJS from 'decimal.js';

const Decimal = DecimalJS.clone();
Decimal.set({
precision: 100,
rounding: Decimal.ROUND_HALF_DOWN,
Expand All @@ -13,6 +14,7 @@ Decimal.set({
});

export { Decimal, BigNumber, BigNumberish };
export type Decimal = DecimalJS;

export const BigNumberMin = (a: BigNumber, b: BigNumber) => (a.lt(b) ? a : b);
export const BigNumberMax = (a: BigNumber, b: BigNumber) => (a.gt(b) ? a : b);
Expand Down

0 comments on commit 692d6a3

Please sign in to comment.