Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed Aug 15, 2024
1 parent 0744fcb commit 938abf7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/trade-matcher/trade.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MAX_UINT128, MAX_UINT256, uint128, add, sub, mul, mulDivF, mulDivC, minFactor } from './utils';
import { ONE_48, Decimal, BigNumber, BigNumberMax } from '../utils/numerics';
import { BigNumber, BigNumberMax, Decimal, ONE_48 } from '../utils/numerics';
import { EncodedOrder, DecodedOrder } from '../common/types';
import { decodeFloatInitialRate } from '../utils/encoders';
import { getRuntimeConfig } from '../runtime-config';
Expand Down
2 changes: 1 addition & 1 deletion src/trade-matcher/trade_gradient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MAX_UINT128, uint128, add, mul, mulDivF, mulDivC, minFactor } from './utils';
import { ONE_48, ONE_24, BigNumber } from '../utils/numerics';
import { BigNumber, ONE_48, ONE_24 } from '../utils/numerics';

const EXP_ONE = BigNumber.from("0x0080000000000000000000000000000000"); // 1
const EXP_MID = BigNumber.from("0x0400000000000000000000000000000000"); // 8
Expand Down
6 changes: 1 addition & 5 deletions src/utils/numerics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ export const BigNumberMax = (a: BigNumber, b: BigNumber) => (a.gt(b) ? a : b);

export const ONE_48 = 2 ** 48;
export const ONE_24 = 2 ** 24;
export const TEN = new Decimal(10);

export const tenPow = (dec0: number, dec1: number) => {
const diff = dec0 - dec1;
return TEN.pow(diff);
};
export const tenPow = (dec0: number, dec1: number) => new Decimal(10).pow(dec0 - dec1);

export const BnToDec = (x: BigNumber) => new Decimal(x.toString());
export const DecToBn = (x: Decimal) => BigNumber.from(x.toFixed());
Expand Down

0 comments on commit 938abf7

Please sign in to comment.