@sovryn-zero/lib-base 0.2.0 → 0.2.2

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.
Files changed (41) hide show
  1. package/dist/index.d.ts +13 -13
  2. package/dist/index.js +25 -25
  3. package/dist/src/Decimal.d.ts +88 -88
  4. package/dist/src/Decimal.js +360 -360
  5. package/dist/src/Fees.d.ts +81 -81
  6. package/dist/src/Fees.js +122 -122
  7. package/dist/src/LiquityStore.d.ts +206 -208
  8. package/dist/src/LiquityStore.d.ts.map +1 -1
  9. package/dist/src/LiquityStore.js +207 -208
  10. package/dist/src/LiquityStore.js.map +1 -1
  11. package/dist/src/ObservableLiquity.d.ts +14 -14
  12. package/dist/src/ObservableLiquity.js +2 -2
  13. package/dist/src/PopulatableLiquity.d.ts +124 -124
  14. package/dist/src/PopulatableLiquity.js +2 -2
  15. package/dist/src/ReadableLiquity.d.ts +151 -155
  16. package/dist/src/ReadableLiquity.d.ts.map +1 -1
  17. package/dist/src/ReadableLiquity.js +2 -2
  18. package/dist/src/SendableLiquity.d.ts +155 -155
  19. package/dist/src/SendableLiquity.js +19 -19
  20. package/dist/src/StabilityDeposit.d.ts +58 -58
  21. package/dist/src/StabilityDeposit.js +79 -79
  22. package/dist/src/TransactableLiquity.d.ts +413 -413
  23. package/dist/src/TransactableLiquity.js +17 -17
  24. package/dist/src/Trove.d.ts +366 -366
  25. package/dist/src/Trove.js +422 -422
  26. package/dist/src/ZEROStake.d.ts +51 -51
  27. package/dist/src/ZEROStake.js +73 -73
  28. package/dist/src/_CachedReadableLiquity.d.ts +53 -54
  29. package/dist/src/_CachedReadableLiquity.d.ts.map +1 -1
  30. package/dist/src/_CachedReadableLiquity.js +88 -92
  31. package/dist/src/_CachedReadableLiquity.js.map +1 -1
  32. package/dist/src/constants.d.ts +60 -60
  33. package/dist/src/constants.d.ts.map +1 -1
  34. package/dist/src/constants.js +63 -63
  35. package/dist/src/constants.js.map +1 -1
  36. package/etc/lib-base.api.md +0 -4
  37. package/package.json +1 -1
  38. package/src/LiquityStore.ts +0 -9
  39. package/src/ReadableLiquity.ts +0 -5
  40. package/src/_CachedReadableLiquity.ts +0 -7
  41. package/src/constants.ts +1 -1
@@ -1,61 +1,61 @@
1
- import { Decimal } from "./Decimal";
2
- /**
3
- * Total collateral ratio below which recovery mode is triggered.
4
- *
5
- * @public
6
- */
7
- export declare const CRITICAL_COLLATERAL_RATIO: Decimal;
8
- /**
9
- * Collateral ratio below which a Trove can be liquidated in normal mode.
10
- *
11
- * @public
12
- */
13
- export declare const MINIMUM_COLLATERAL_RATIO: Decimal;
14
- /**
15
- * Amount of ZUSD that's reserved for compensating the liquidator of a Trove.
16
- *
17
- * @public
18
- */
19
- export declare const ZUSD_LIQUIDATION_RESERVE: Decimal;
20
- /**
21
- * A Trove must always have at least this much debt on top of the
22
- * {@link ZUSD_LIQUIDATION_RESERVE | liquidation reserve}.
23
- *
24
- * @remarks
25
- * Any transaction that would result in a Trove with less net debt than this will be reverted.
26
- *
27
- * @public
28
- */
29
- export declare const ZUSD_MINIMUM_NET_DEBT: Decimal;
30
- /**
31
- * A Trove must always have at least this much debt.
32
- *
33
- * @remarks
34
- * Any transaction that would result in a Trove with less debt than this will be reverted.
35
- *
36
- * @public
37
- */
38
- export declare const ZUSD_MINIMUM_DEBT: Decimal;
39
- /**
40
- * Value that the {@link Fees.borrowingRate | borrowing rate} will never decay below.
41
- *
42
- * @remarks
43
- * Note that the borrowing rate can still be lower than this during recovery mode, when it's
44
- * overridden by zero.
45
- *
46
- * @public
47
- */
48
- export declare const MINIMUM_BORROWING_RATE: Decimal;
49
- /**
50
- * Value that the {@link Fees.borrowingRate | borrowing rate} will never exceed.
51
- *
52
- * @public
53
- */
54
- export declare const MAXIMUM_BORROWING_RATE: Decimal;
55
- /**
56
- * Value that the {@link Fees.redemptionRate | redemption rate} will never decay below.
57
- *
58
- * @public
59
- */
60
- export declare const MINIMUM_REDEMPTION_RATE: Decimal;
1
+ import { Decimal } from "./Decimal";
2
+ /**
3
+ * Total collateral ratio below which recovery mode is triggered.
4
+ *
5
+ * @public
6
+ */
7
+ export declare const CRITICAL_COLLATERAL_RATIO: Decimal;
8
+ /**
9
+ * Collateral ratio below which a Trove can be liquidated in normal mode.
10
+ *
11
+ * @public
12
+ */
13
+ export declare const MINIMUM_COLLATERAL_RATIO: Decimal;
14
+ /**
15
+ * Amount of ZUSD that's reserved for compensating the liquidator of a Trove.
16
+ *
17
+ * @public
18
+ */
19
+ export declare const ZUSD_LIQUIDATION_RESERVE: Decimal;
20
+ /**
21
+ * A Trove must always have at least this much debt on top of the
22
+ * {@link ZUSD_LIQUIDATION_RESERVE | liquidation reserve}.
23
+ *
24
+ * @remarks
25
+ * Any transaction that would result in a Trove with less net debt than this will be reverted.
26
+ *
27
+ * @public
28
+ */
29
+ export declare const ZUSD_MINIMUM_NET_DEBT: Decimal;
30
+ /**
31
+ * A Trove must always have at least this much debt.
32
+ *
33
+ * @remarks
34
+ * Any transaction that would result in a Trove with less debt than this will be reverted.
35
+ *
36
+ * @public
37
+ */
38
+ export declare const ZUSD_MINIMUM_DEBT: Decimal;
39
+ /**
40
+ * Value that the {@link Fees.borrowingRate | borrowing rate} will never decay below.
41
+ *
42
+ * @remarks
43
+ * Note that the borrowing rate can still be lower than this during recovery mode, when it's
44
+ * overridden by zero.
45
+ *
46
+ * @public
47
+ */
48
+ export declare const MINIMUM_BORROWING_RATE: Decimal;
49
+ /**
50
+ * Value that the {@link Fees.borrowingRate | borrowing rate} will never exceed.
51
+ *
52
+ * @public
53
+ */
54
+ export declare const MAXIMUM_BORROWING_RATE: Decimal;
55
+ /**
56
+ * Value that the {@link Fees.redemptionRate | redemption rate} will never decay below.
57
+ *
58
+ * @public
59
+ */
60
+ export declare const MINIMUM_REDEMPTION_RATE: Decimal;
61
61
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,SAAoB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,SAAoB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,SAAmB,CAAC;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,SAAoB,CAAC;AAEvD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,SAAsD,CAAC;AAErF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,SAAqB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,SAAsB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,SAAsB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,SAAoB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,SAAoB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,SAAmB,CAAC;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,SAAoB,CAAC;AAEvD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,SAAsD,CAAC;AAErF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,SAAqB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,SAAsB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,SAAqB,CAAC"}
@@ -1,64 +1,64 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MINIMUM_REDEMPTION_RATE = exports.MAXIMUM_BORROWING_RATE = exports.MINIMUM_BORROWING_RATE = exports.ZUSD_MINIMUM_DEBT = exports.ZUSD_MINIMUM_NET_DEBT = exports.ZUSD_LIQUIDATION_RESERVE = exports.MINIMUM_COLLATERAL_RATIO = exports.CRITICAL_COLLATERAL_RATIO = void 0;
4
- const Decimal_1 = require("./Decimal");
5
- /**
6
- * Total collateral ratio below which recovery mode is triggered.
7
- *
8
- * @public
9
- */
10
- exports.CRITICAL_COLLATERAL_RATIO = Decimal_1.Decimal.from(1.5);
11
- /**
12
- * Collateral ratio below which a Trove can be liquidated in normal mode.
13
- *
14
- * @public
15
- */
16
- exports.MINIMUM_COLLATERAL_RATIO = Decimal_1.Decimal.from(1.1);
17
- /**
18
- * Amount of ZUSD that's reserved for compensating the liquidator of a Trove.
19
- *
20
- * @public
21
- */
22
- exports.ZUSD_LIQUIDATION_RESERVE = Decimal_1.Decimal.from(20);
23
- /**
24
- * A Trove must always have at least this much debt on top of the
25
- * {@link ZUSD_LIQUIDATION_RESERVE | liquidation reserve}.
26
- *
27
- * @remarks
28
- * Any transaction that would result in a Trove with less net debt than this will be reverted.
29
- *
30
- * @public
31
- */
32
- exports.ZUSD_MINIMUM_NET_DEBT = Decimal_1.Decimal.from(180);
33
- /**
34
- * A Trove must always have at least this much debt.
35
- *
36
- * @remarks
37
- * Any transaction that would result in a Trove with less debt than this will be reverted.
38
- *
39
- * @public
40
- */
41
- exports.ZUSD_MINIMUM_DEBT = exports.ZUSD_LIQUIDATION_RESERVE.add(exports.ZUSD_MINIMUM_NET_DEBT);
42
- /**
43
- * Value that the {@link Fees.borrowingRate | borrowing rate} will never decay below.
44
- *
45
- * @remarks
46
- * Note that the borrowing rate can still be lower than this during recovery mode, when it's
47
- * overridden by zero.
48
- *
49
- * @public
50
- */
51
- exports.MINIMUM_BORROWING_RATE = Decimal_1.Decimal.from(0.05);
52
- /**
53
- * Value that the {@link Fees.borrowingRate | borrowing rate} will never exceed.
54
- *
55
- * @public
56
- */
57
- exports.MAXIMUM_BORROWING_RATE = Decimal_1.Decimal.from(0.075);
58
- /**
59
- * Value that the {@link Fees.redemptionRate | redemption rate} will never decay below.
60
- *
61
- * @public
62
- */
63
- exports.MINIMUM_REDEMPTION_RATE = Decimal_1.Decimal.from(0.019);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINIMUM_REDEMPTION_RATE = exports.MAXIMUM_BORROWING_RATE = exports.MINIMUM_BORROWING_RATE = exports.ZUSD_MINIMUM_DEBT = exports.ZUSD_MINIMUM_NET_DEBT = exports.ZUSD_LIQUIDATION_RESERVE = exports.MINIMUM_COLLATERAL_RATIO = exports.CRITICAL_COLLATERAL_RATIO = void 0;
4
+ const Decimal_1 = require("./Decimal");
5
+ /**
6
+ * Total collateral ratio below which recovery mode is triggered.
7
+ *
8
+ * @public
9
+ */
10
+ exports.CRITICAL_COLLATERAL_RATIO = Decimal_1.Decimal.from(1.5);
11
+ /**
12
+ * Collateral ratio below which a Trove can be liquidated in normal mode.
13
+ *
14
+ * @public
15
+ */
16
+ exports.MINIMUM_COLLATERAL_RATIO = Decimal_1.Decimal.from(1.1);
17
+ /**
18
+ * Amount of ZUSD that's reserved for compensating the liquidator of a Trove.
19
+ *
20
+ * @public
21
+ */
22
+ exports.ZUSD_LIQUIDATION_RESERVE = Decimal_1.Decimal.from(20);
23
+ /**
24
+ * A Trove must always have at least this much debt on top of the
25
+ * {@link ZUSD_LIQUIDATION_RESERVE | liquidation reserve}.
26
+ *
27
+ * @remarks
28
+ * Any transaction that would result in a Trove with less net debt than this will be reverted.
29
+ *
30
+ * @public
31
+ */
32
+ exports.ZUSD_MINIMUM_NET_DEBT = Decimal_1.Decimal.from(180);
33
+ /**
34
+ * A Trove must always have at least this much debt.
35
+ *
36
+ * @remarks
37
+ * Any transaction that would result in a Trove with less debt than this will be reverted.
38
+ *
39
+ * @public
40
+ */
41
+ exports.ZUSD_MINIMUM_DEBT = exports.ZUSD_LIQUIDATION_RESERVE.add(exports.ZUSD_MINIMUM_NET_DEBT);
42
+ /**
43
+ * Value that the {@link Fees.borrowingRate | borrowing rate} will never decay below.
44
+ *
45
+ * @remarks
46
+ * Note that the borrowing rate can still be lower than this during recovery mode, when it's
47
+ * overridden by zero.
48
+ *
49
+ * @public
50
+ */
51
+ exports.MINIMUM_BORROWING_RATE = Decimal_1.Decimal.from(0.05);
52
+ /**
53
+ * Value that the {@link Fees.borrowingRate | borrowing rate} will never exceed.
54
+ *
55
+ * @public
56
+ */
57
+ exports.MAXIMUM_BORROWING_RATE = Decimal_1.Decimal.from(0.075);
58
+ /**
59
+ * Value that the {@link Fees.redemptionRate | redemption rate} will never decay below.
60
+ *
61
+ * @public
62
+ */
63
+ exports.MINIMUM_REDEMPTION_RATE = Decimal_1.Decimal.from(0.01);
64
64
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEpC;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3D;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1D;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,iBAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACU,QAAA,qBAAqB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEvD;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,gCAAwB,CAAC,GAAG,CAAC,6BAAqB,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACU,QAAA,sBAAsB,GAAG,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzD;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,iBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE1D;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,iBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAEpC;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3D;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1D;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,iBAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACU,QAAA,qBAAqB,GAAG,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEvD;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,gCAAwB,CAAC,GAAG,CAAC,6BAAqB,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACU,QAAA,sBAAsB,GAAG,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzD;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,iBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE1D;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -18,8 +18,6 @@ export class _CachedReadableLiquity<T extends unknown[]> implements _ReadableLiq
18
18
  // (undocumented)
19
19
  getPrice(...extraParams: T): Promise<Decimal>;
20
20
  // (undocumented)
21
- getRemainingStabilityPoolZEROReward(...extraParams: T): Promise<Decimal>;
22
- // (undocumented)
23
21
  getStabilityDeposit(address?: string, ...extraParams: T): Promise<StabilityDeposit>;
24
22
  // (undocumented)
25
23
  getTotal(...extraParams: T): Promise<Trove>;
@@ -255,7 +253,6 @@ export interface LiquityStoreBaseState {
255
253
  numberOfTroves: number;
256
254
  ownFrontend: FrontendStatus;
257
255
  price: Decimal;
258
- remainingStabilityPoolZEROReward: Decimal;
259
256
  // @internal (undocumented)
260
257
  _riskiestTroveBeforeRedistribution: TroveWithPendingRedistribution;
261
258
  stabilityDeposit: StabilityDeposit;
@@ -428,7 +425,6 @@ export interface ReadableLiquity {
428
425
  getFrontendStatus(address?: string): Promise<FrontendStatus>;
429
426
  getNumberOfTroves(): Promise<number>;
430
427
  getPrice(): Promise<Decimal>;
431
- getRemainingStabilityPoolZEROReward(): Promise<Decimal>;
432
428
  getStabilityDeposit(address?: string): Promise<StabilityDeposit>;
433
429
  getTotal(): Promise<Trove>;
434
430
  getTotalRedistributed(): Promise<Trove>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sovryn-zero/lib-base",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Sovryn Zero SDK shared interfaces",
5
5
  "keywords": [
6
6
  "Sovryn",
@@ -72,9 +72,6 @@ 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
-
78
75
  /** @internal */
79
76
  _feesInNormalMode: Fees;
80
77
 
@@ -397,12 +394,6 @@ export abstract class LiquityStore<T = unknown> {
397
394
  baseStateUpdate.stabilityDeposit
398
395
  ),
399
396
 
400
- remainingStabilityPoolZEROReward: this._silentlyUpdateIfChanged(
401
- eq,
402
- baseState.remainingStabilityPoolZEROReward,
403
- baseStateUpdate.remainingStabilityPoolZEROReward
404
- ),
405
-
406
397
  _feesInNormalMode: this._silentlyUpdateIfChanged(
407
398
  equals,
408
399
  baseState._feesInNormalMode,
@@ -101,11 +101,6 @@ 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
-
109
104
  /**
110
105
  * Get the total amount of ZUSD currently deposited in the Stability Pool.
111
106
  */
@@ -101,13 +101,6 @@ 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
-
111
104
  async getZUSDInStabilityPool(...extraParams: T): Promise<Decimal> {
112
105
  return (
113
106
  this._cache.getZUSDInStabilityPool(...extraParams) ??
package/src/constants.ts CHANGED
@@ -65,4 +65,4 @@ export const MAXIMUM_BORROWING_RATE = Decimal.from(0.075);
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.01);