@drift-labs/sdk 2.6.0-beta.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -252,13 +252,14 @@ class BigNum {
252
252
  if (rounded) {
253
253
  return this.toRounded(fixedPrecision).toPrecision(fixedPrecision, trailingZeroes);
254
254
  }
255
- const printString = this.print();
255
+ const isNeg = this.isNeg();
256
+ const printString = this.abs().print();
257
+ const thisString = this.abs().toString();
256
258
  let precisionPrintString = printString.slice(0, fixedPrecision + 1);
257
- const thisString = this.toString();
258
259
  if (!printString.includes(BigNum.delim) &&
259
260
  thisString.length < fixedPrecision) {
260
261
  const precisionMismatch = fixedPrecision - thisString.length;
261
- return BigNum.from(thisString + this.getZeroes(precisionMismatch), precisionMismatch).toPrecision(fixedPrecision, trailingZeroes);
262
+ return BigNum.from((isNeg ? '-' : '') + thisString + this.getZeroes(precisionMismatch), precisionMismatch).toPrecision(fixedPrecision, trailingZeroes);
262
263
  }
263
264
  if (!precisionPrintString.includes(BigNum.delim) ||
264
265
  precisionPrintString[precisionPrintString.length - 1] === BigNum.delim) {
@@ -298,7 +299,7 @@ class BigNum {
298
299
  }
299
300
  }
300
301
  }
301
- return precisionPrintString;
302
+ return `${isNeg ? '-' : ''}${precisionPrintString}`;
302
303
  }
303
304
  toTradePrecision(rounded = false) {
304
305
  return this.toPrecision(6, true, rounded);
@@ -333,7 +334,8 @@ class BigNum {
333
334
  if (rounded) {
334
335
  return this.toRounded(precision).toMillified(precision);
335
336
  }
336
- const stringVal = this.print();
337
+ const isNeg = this.isNeg();
338
+ const stringVal = this.abs().print();
337
339
  const [leftSide] = stringVal.split(BigNum.delim);
338
340
  if (!leftSide) {
339
341
  return this.shift(new anchor_1.BN(precision)).toPrecision(precision, true);
@@ -362,7 +364,7 @@ class BigNum {
362
364
  else {
363
365
  leadString = `${leadDigits.slice(0, decimalLocation)}${BigNum.delim}${leadDigits.slice(decimalLocation)}`;
364
366
  }
365
- return `${leadString}${unit}`;
367
+ return `${isNeg ? '-' : ''}${leadString}${unit}`;
366
368
  }
367
369
  toJSON() {
368
370
  return {
@@ -426,7 +428,7 @@ class BigNum {
426
428
  }
427
429
  const sides = val.split(BigNum.delim);
428
430
  const rightSide = sides[1];
429
- const leftSide = sides[0].replace(/\D/g, '');
431
+ const leftSide = sides[0].replace(/\s/g, '');
430
432
  const bnInput = `${leftSide !== null && leftSide !== void 0 ? leftSide : ''}${rightSide !== null && rightSide !== void 0 ? rightSide : ''}`;
431
433
  const rawBn = new anchor_1.BN(bnInput);
432
434
  const rightSideLength = (_a = rightSide === null || rightSide === void 0 ? void 0 : rightSide.length) !== null && _a !== void 0 ? _a : 0;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.0-beta.1",
2
+ "version": "2.7.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.6.0-beta.1",
3
+ "version": "2.7.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -385,11 +385,12 @@ export class BigNum {
385
385
  );
386
386
  }
387
387
 
388
- const printString = this.print();
388
+ const isNeg = this.isNeg();
389
389
 
390
- let precisionPrintString = printString.slice(0, fixedPrecision + 1);
390
+ const printString = this.abs().print();
391
+ const thisString = this.abs().toString();
391
392
 
392
- const thisString = this.toString();
393
+ let precisionPrintString = printString.slice(0, fixedPrecision + 1);
393
394
 
394
395
  if (
395
396
  !printString.includes(BigNum.delim) &&
@@ -397,7 +398,7 @@ export class BigNum {
397
398
  ) {
398
399
  const precisionMismatch = fixedPrecision - thisString.length;
399
400
  return BigNum.from(
400
- thisString + this.getZeroes(precisionMismatch),
401
+ (isNeg ? '-' : '') + thisString + this.getZeroes(precisionMismatch),
401
402
  precisionMismatch
402
403
  ).toPrecision(fixedPrecision, trailingZeroes);
403
404
  }
@@ -455,7 +456,7 @@ export class BigNum {
455
456
  }
456
457
  }
457
458
 
458
- return precisionPrintString;
459
+ return `${isNeg ? '-' : ''}${precisionPrintString}`;
459
460
  }
460
461
 
461
462
  public toTradePrecision(rounded = false): string {
@@ -501,7 +502,9 @@ export class BigNum {
501
502
  return this.toRounded(precision).toMillified(precision);
502
503
  }
503
504
 
504
- const stringVal = this.print();
505
+ const isNeg = this.isNeg();
506
+
507
+ const stringVal = this.abs().print();
505
508
 
506
509
  const [leftSide] = stringVal.split(BigNum.delim);
507
510
 
@@ -542,7 +545,7 @@ export class BigNum {
542
545
  }${leadDigits.slice(decimalLocation)}`;
543
546
  }
544
547
 
545
- return `${leadString}${unit}`;
548
+ return `${isNeg ? '-' : ''}${leadString}${unit}`;
546
549
  }
547
550
 
548
551
  public toJSON() {
@@ -618,7 +621,7 @@ export class BigNum {
618
621
 
619
622
  const sides = val.split(BigNum.delim);
620
623
  const rightSide = sides[1];
621
- const leftSide = sides[0].replace(/\D/g, '');
624
+ const leftSide = sides[0].replace(/\s/g, '');
622
625
  const bnInput = `${leftSide ?? ''}${rightSide ?? ''}`;
623
626
 
624
627
  const rawBn = new BN(bnInput);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.0-beta.1",
2
+ "version": "2.7.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
package/tests/amm/test.ts CHANGED
@@ -1,193 +1,196 @@
1
1
  import {
2
- BN,
3
- PEG_PRECISION, PRICE_PRECISION,
2
+ BN,
3
+ PEG_PRECISION,
4
+ PRICE_PRECISION,
4
5
  AMM_RESERVE_PRECISION,
5
6
  QUOTE_PRECISION,
6
7
  calculateSpreadBN,
7
- ZERO,
8
- calculateLiveOracleStd,
9
- calculateLiveOracleTwap
8
+ ZERO,
9
+ calculateLiveOracleStd,
10
+ calculateLiveOracleTwap,
10
11
  } from '../../src';
11
- import {
12
- mockPerpMarkets,
13
- } from '../dlob/helpers';
12
+ import { mockPerpMarkets } from '../dlob/helpers';
14
13
 
15
14
  import { assert } from '../../src/assert/assert';
16
15
 
17
16
  class AMMSpreadTerms {
18
- longVolSpread: number;
19
- shortVolSpread: number;
20
- longSpreadwPS: number;
21
- shortSpreadwPS: number;
22
- maxTargetSpread: number;
23
- inventorySpreadScale: number;
24
- longSpreadwInvScale: number;
25
- shortSpreadwInvScale: number;
26
- effectiveLeverage: number;
27
- effectiveLeverageCapped: number;
28
- longSpreadwEL: number;
29
- shortSpreadwEL: number;
30
- revenueRetreatAmount: number;
31
- halfRevenueRetreatAmount: number;
32
- longSpreadwRevRetreat: number;
33
- shortSpreadwRevRetreat: number;
34
- totalSpread: number;
35
- longSpread: number;
36
- shortSpread: number;
17
+ longVolSpread: number;
18
+ shortVolSpread: number;
19
+ longSpreadwPS: number;
20
+ shortSpreadwPS: number;
21
+ maxTargetSpread: number;
22
+ inventorySpreadScale: number;
23
+ longSpreadwInvScale: number;
24
+ shortSpreadwInvScale: number;
25
+ effectiveLeverage: number;
26
+ effectiveLeverageCapped: number;
27
+ longSpreadwEL: number;
28
+ shortSpreadwEL: number;
29
+ revenueRetreatAmount: number;
30
+ halfRevenueRetreatAmount: number;
31
+ longSpreadwRevRetreat: number;
32
+ shortSpreadwRevRetreat: number;
33
+ totalSpread: number;
34
+ longSpread: number;
35
+ shortSpread: number;
37
36
  }
38
37
 
39
38
  describe('AMM Tests', () => {
40
39
  it('Various Spreads', () => {
41
-
42
- const baseSpread: number = .025 * 1e6;
43
- const lastOracleReservePriceSpreadPct: BN = ZERO;
44
- const lastOracleConfPct: BN = ZERO;
45
- const maxSpread: number = .03 * 1e6;
46
- const quoteAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 100);
47
- const terminalQuoteAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 100);
48
- const pegMultiplier: BN = new BN(13.455 * PEG_PRECISION.toNumber());
49
- const baseAssetAmountWithAmm: BN = ZERO;
50
- const reservePrice: BN = new BN(13.455 * PRICE_PRECISION.toNumber());
51
- const totalFeeMinusDistributions: BN = new BN(1);
52
- const netRevenueSinceLastFunding: BN = new BN(QUOTE_PRECISION.toNumber() * 2);
53
- const baseAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 100);
54
- const minBaseAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 90);
55
- const maxBaseAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 110);
56
- const markStd: BN = new BN(.45 * PRICE_PRECISION.toNumber());
57
- const oracleStd: BN = new BN(.55 * PRICE_PRECISION.toNumber());
58
- const longIntensity: BN = new BN(QUOTE_PRECISION.toNumber() * 20);
59
- const shortIntensity: BN =new BN(QUOTE_PRECISION.toNumber() * 2);
60
- const volume24H: BN = new BN(QUOTE_PRECISION.toNumber() * 25);
61
-
62
- const spreads = calculateSpreadBN(
63
- baseSpread,
64
- lastOracleReservePriceSpreadPct,
65
- lastOracleConfPct,
66
- maxSpread,
67
- quoteAssetReserve,
68
- terminalQuoteAssetReserve,
69
- pegMultiplier,
70
- baseAssetAmountWithAmm,
71
- reservePrice,
72
- totalFeeMinusDistributions,
73
- netRevenueSinceLastFunding,
74
- baseAssetReserve,
75
- minBaseAssetReserve,
76
- maxBaseAssetReserve,
77
- markStd,
78
- oracleStd,
79
- longIntensity,
80
- shortIntensity,
81
- volume24H,
82
- );
83
- const l1 = spreads[0];
84
- const s1 = spreads[1];
85
-
86
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
40
+ const baseSpread: number = 0.025 * 1e6;
41
+ const lastOracleReservePriceSpreadPct: BN = ZERO;
42
+ const lastOracleConfPct: BN = ZERO;
43
+ const maxSpread: number = 0.03 * 1e6;
44
+ const quoteAssetReserve: BN = new BN(
45
+ AMM_RESERVE_PRECISION.toNumber() * 100
46
+ );
47
+ const terminalQuoteAssetReserve: BN = new BN(
48
+ AMM_RESERVE_PRECISION.toNumber() * 100
49
+ );
50
+ const pegMultiplier: BN = new BN(13.455 * PEG_PRECISION.toNumber());
51
+ const baseAssetAmountWithAmm: BN = ZERO;
52
+ const reservePrice: BN = new BN(13.455 * PRICE_PRECISION.toNumber());
53
+ const totalFeeMinusDistributions: BN = new BN(1);
54
+ const netRevenueSinceLastFunding: BN = new BN(
55
+ QUOTE_PRECISION.toNumber() * 2
56
+ );
57
+ const baseAssetReserve: BN = new BN(AMM_RESERVE_PRECISION.toNumber() * 100);
58
+ const minBaseAssetReserve: BN = new BN(
59
+ AMM_RESERVE_PRECISION.toNumber() * 90
60
+ );
61
+ const maxBaseAssetReserve: BN = new BN(
62
+ AMM_RESERVE_PRECISION.toNumber() * 110
63
+ );
64
+ const markStd: BN = new BN(0.45 * PRICE_PRECISION.toNumber());
65
+ const oracleStd: BN = new BN(0.55 * PRICE_PRECISION.toNumber());
66
+ const longIntensity: BN = new BN(QUOTE_PRECISION.toNumber() * 20);
67
+ const shortIntensity: BN = new BN(QUOTE_PRECISION.toNumber() * 2);
68
+ const volume24H: BN = new BN(QUOTE_PRECISION.toNumber() * 25);
69
+
70
+ const spreads = calculateSpreadBN(
71
+ baseSpread,
72
+ lastOracleReservePriceSpreadPct,
73
+ lastOracleConfPct,
74
+ maxSpread,
75
+ quoteAssetReserve,
76
+ terminalQuoteAssetReserve,
77
+ pegMultiplier,
78
+ baseAssetAmountWithAmm,
79
+ reservePrice,
80
+ totalFeeMinusDistributions,
81
+ netRevenueSinceLastFunding,
82
+ baseAssetReserve,
83
+ minBaseAssetReserve,
84
+ maxBaseAssetReserve,
85
+ markStd,
86
+ oracleStd,
87
+ longIntensity,
88
+ shortIntensity,
89
+ volume24H
90
+ );
91
+ const l1 = spreads[0];
92
+ const s1 = spreads[1];
93
+
94
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
95
  // @ts-ignore
88
- const terms1: AMMSpreadTerms = calculateSpreadBN(
89
- baseSpread,
90
- lastOracleReservePriceSpreadPct,
91
- lastOracleConfPct,
92
- maxSpread,
93
- quoteAssetReserve,
94
- terminalQuoteAssetReserve,
95
- pegMultiplier,
96
- baseAssetAmountWithAmm,
97
- reservePrice,
98
- totalFeeMinusDistributions,
99
- netRevenueSinceLastFunding,
100
- baseAssetReserve,
101
- minBaseAssetReserve,
102
- maxBaseAssetReserve,
103
- markStd,
104
- oracleStd,
105
- longIntensity,
106
- shortIntensity,
107
- volume24H,
108
- true
109
- );
110
- console.log(terms1);
111
-
112
- console.log('long/short spread:', l1, s1);
113
- assert(l1==14864);
114
- assert(s1==12500);
115
- assert(l1==terms1.longSpread);
116
- assert(s1==terms1.shortSpread);
117
-
118
-
119
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
96
+ const terms1: AMMSpreadTerms = calculateSpreadBN(
97
+ baseSpread,
98
+ lastOracleReservePriceSpreadPct,
99
+ lastOracleConfPct,
100
+ maxSpread,
101
+ quoteAssetReserve,
102
+ terminalQuoteAssetReserve,
103
+ pegMultiplier,
104
+ baseAssetAmountWithAmm,
105
+ reservePrice,
106
+ totalFeeMinusDistributions,
107
+ netRevenueSinceLastFunding,
108
+ baseAssetReserve,
109
+ minBaseAssetReserve,
110
+ maxBaseAssetReserve,
111
+ markStd,
112
+ oracleStd,
113
+ longIntensity,
114
+ shortIntensity,
115
+ volume24H,
116
+ true
117
+ );
118
+ console.log(terms1);
119
+
120
+ console.log('long/short spread:', l1, s1);
121
+ assert(l1 == 14864);
122
+ assert(s1 == 12500);
123
+ assert(l1 == terms1.longSpread);
124
+ assert(s1 == terms1.shortSpread);
125
+
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
120
127
  // @ts-ignore
121
- const terms2: AMMSpreadTerms = calculateSpreadBN(
122
- 300,
123
- new BN(0),
124
- new BN(484),
125
- 47500,
126
- new BN(923807816209694),
127
- new BN(925117623772584),
128
- new BN(13731157),
129
- new BN(-1314027016625),
130
- new BN(13667686),
131
- new BN(115876379475),
132
- new BN(91316628),
133
- new BN(928097825691666),
134
- new BN(907979542352912),
135
- new BN(945977491145601),
136
- new BN(161188),
137
- new BN(1459632439),
138
- new BN(12358265776),
139
- new BN(72230366233),
140
- new BN(432067603632),
141
- true
142
- );
143
-
144
- console.log(terms2);
145
- assert(terms2.effectiveLeverageCapped>=1.0002);
146
- assert(terms2.inventorySpreadScale==10);
147
- assert(terms2.longSpread==798);
148
- assert(terms2.shortSpread==46702);
149
-
150
- });
151
-
152
- it('Corner Case Spreads', () => {
153
-
154
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
128
+ const terms2: AMMSpreadTerms = calculateSpreadBN(
129
+ 300,
130
+ new BN(0),
131
+ new BN(484),
132
+ 47500,
133
+ new BN(923807816209694),
134
+ new BN(925117623772584),
135
+ new BN(13731157),
136
+ new BN(-1314027016625),
137
+ new BN(13667686),
138
+ new BN(115876379475),
139
+ new BN(91316628),
140
+ new BN(928097825691666),
141
+ new BN(907979542352912),
142
+ new BN(945977491145601),
143
+ new BN(161188),
144
+ new BN(1459632439),
145
+ new BN(12358265776),
146
+ new BN(72230366233),
147
+ new BN(432067603632),
148
+ true
149
+ );
150
+
151
+ console.log(terms2);
152
+ assert(terms2.effectiveLeverageCapped >= 1.0002);
153
+ assert(terms2.inventorySpreadScale == 10);
154
+ assert(terms2.longSpread == 798);
155
+ assert(terms2.shortSpread == 46702);
156
+ });
157
+
158
+ it('Corner Case Spreads', () => {
159
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
155
160
  // @ts-ignore
156
- const terms2: AMMSpreadTerms = calculateSpreadBN(
157
- 1000,
158
- new BN(5555),
159
- new BN(1131),
160
- 20000,
161
- new BN(1009967115003047),
162
- new BN(1009811402660255),
163
- new BN(13460124),
164
- new BN(15328930153),
165
- new BN(13667686),
166
- new BN(1235066973),
167
- new BN(88540713),
168
- new BN(994097717724176),
169
- new BN(974077854655784),
170
- new BN(1014841945381208),
171
- new BN(103320),
172
- new BN(59975),
173
- new BN(768323534),
174
- new BN(243875031),
175
- new BN(130017761029),
176
- true
177
- );
178
-
179
- console.log(terms2);
180
- assert(terms2.effectiveLeverageCapped<=1.000001);
181
- assert(terms2.inventorySpreadScale==1.117371);
182
- assert(terms2.longSpread==1263);
183
- assert(terms2.shortSpread==6686);
184
- });
185
-
186
-
187
- it('live update functions', () => {
188
-
189
- const mockAmm = mockPerpMarkets[0].amm;
190
- const now = new BN(new Date().getTime() / 1000); //todo
161
+ const terms2: AMMSpreadTerms = calculateSpreadBN(
162
+ 1000,
163
+ new BN(5555),
164
+ new BN(1131),
165
+ 20000,
166
+ new BN(1009967115003047),
167
+ new BN(1009811402660255),
168
+ new BN(13460124),
169
+ new BN(15328930153),
170
+ new BN(13667686),
171
+ new BN(1235066973),
172
+ new BN(88540713),
173
+ new BN(994097717724176),
174
+ new BN(974077854655784),
175
+ new BN(1014841945381208),
176
+ new BN(103320),
177
+ new BN(59975),
178
+ new BN(768323534),
179
+ new BN(243875031),
180
+ new BN(130017761029),
181
+ true
182
+ );
183
+
184
+ console.log(terms2);
185
+ assert(terms2.effectiveLeverageCapped <= 1.000001);
186
+ assert(terms2.inventorySpreadScale == 1.117371);
187
+ assert(terms2.longSpread == 1263);
188
+ assert(terms2.shortSpread == 6686);
189
+ });
190
+
191
+ it('live update functions', () => {
192
+ const mockAmm = mockPerpMarkets[0].amm;
193
+ const now = new BN(new Date().getTime() / 1000); //todo
191
194
 
192
195
  const oraclePriceData = {
193
196
  price: new BN(13.553 * PRICE_PRECISION.toNumber()),
@@ -195,19 +198,23 @@ describe('AMM Tests', () => {
195
198
  confidence: new BN(1),
196
199
  hasSufficientNumberOfDataPoints: true,
197
200
  };
198
- mockAmm.oracleStd = new BN(.18 * PRICE_PRECISION.toNumber());
199
- mockAmm.fundingPeriod = new BN(3600);
200
- mockAmm.historicalOracleData.lastOraclePriceTwap = oraclePriceData.price.mul(new BN(999)).div(new BN(1000));
201
- mockAmm.historicalOracleData.lastOraclePriceTwapTs = now.sub(new BN(11));
202
-
203
-
204
- const liveOracleTwap = calculateLiveOracleTwap(mockAmm, oraclePriceData, now);
205
- console.log('liveOracleTwap:', liveOracleTwap.toNumber());
206
- assert(liveOracleTwap.eq(new BN(13539488)));
207
-
208
-
209
- const liveOracleStd = calculateLiveOracleStd(mockAmm, oraclePriceData, now);
210
- console.log('liveOracleStd:', liveOracleStd.toNumber());
211
- assert(liveOracleStd.eq(new BN(192962)));
212
- });
213
- });
201
+ mockAmm.oracleStd = new BN(0.18 * PRICE_PRECISION.toNumber());
202
+ mockAmm.fundingPeriod = new BN(3600);
203
+ mockAmm.historicalOracleData.lastOraclePriceTwap = oraclePriceData.price
204
+ .mul(new BN(999))
205
+ .div(new BN(1000));
206
+ mockAmm.historicalOracleData.lastOraclePriceTwapTs = now.sub(new BN(11));
207
+
208
+ const liveOracleTwap = calculateLiveOracleTwap(
209
+ mockAmm,
210
+ oraclePriceData,
211
+ now
212
+ );
213
+ console.log('liveOracleTwap:', liveOracleTwap.toNumber());
214
+ assert(liveOracleTwap.eq(new BN(13539488)));
215
+
216
+ const liveOracleStd = calculateLiveOracleStd(mockAmm, oraclePriceData, now);
217
+ console.log('liveOracleStd:', liveOracleStd.toNumber());
218
+ assert(liveOracleStd.eq(new BN(192962)));
219
+ });
220
+ });
package/tests/bn/test.ts CHANGED
@@ -128,6 +128,16 @@ describe('BigNum Tests', () => {
128
128
  expect(BigNum.fromPrint('12345678').toMillified(5)).to.equal('12.345M');
129
129
  expect(BigNum.fromPrint('123456789').toMillified(5)).to.equal('123.45M');
130
130
 
131
+ expect(BigNum.fromPrint('-1').toMillified(5)).to.equal('-1.0000');
132
+ expect(BigNum.fromPrint('-12').toMillified(5)).to.equal('-12.000');
133
+ expect(BigNum.fromPrint('-123').toMillified(5)).to.equal('-123.00');
134
+ expect(BigNum.fromPrint('-1234').toMillified(5)).to.equal('-1234.0');
135
+ expect(BigNum.fromPrint('-12345').toMillified(5)).to.equal('-12345');
136
+ expect(BigNum.fromPrint('-123456').toMillified(5)).to.equal('-123.45K');
137
+ expect(BigNum.fromPrint('-1234567').toMillified(5)).to.equal('-1.2345M');
138
+ expect(BigNum.fromPrint('-12345678').toMillified(5)).to.equal('-12.345M');
139
+ expect(BigNum.fromPrint('-123456789').toMillified(5)).to.equal('-123.45M');
140
+
131
141
  expect(BigNum.from(-95, 2).print()).to.equal('-0.95');
132
142
 
133
143
  // Case 6 strange numbers