@sovryn-zero/lib-base 1.0.1-early.access.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

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
@@ -1,207 +0,0 @@
1
- import { Decimal } from "./Decimal";
2
- import { StabilityDeposit } from "./StabilityDeposit";
3
- import { Trove, TroveWithPendingRedistribution, UserTrove } from "./Trove";
4
- import { Fees } from "./Fees";
5
- import { ZEROStake } from "./ZEROStake";
6
- import { FrontendStatus } from "./ReadableLiquity";
7
- /**
8
- * State variables read from the blockchain.
9
- *
10
- * @public
11
- */
12
- export interface LiquityStoreBaseState {
13
- /** Status of currently used frontend. */
14
- frontend: FrontendStatus;
15
- /** Status of user's own frontend. */
16
- ownFrontend: FrontendStatus;
17
- /** Number of Troves that are currently open. */
18
- numberOfTroves: number;
19
- /** User's native currency balance (e.g. Ether). */
20
- accountBalance: Decimal;
21
- /** User's ZUSD token balance. */
22
- zusdBalance: Decimal;
23
- /** User's NUE token balance. */
24
- nueBalance: Decimal;
25
- /** User's ZERO token balance. */
26
- zeroBalance: Decimal;
27
- /**
28
- * Amount of leftover collateral available for withdrawal to the user.
29
- *
30
- * @remarks
31
- * See {@link ReadableLiquity.getCollateralSurplusBalance | getCollateralSurplusBalance()} for
32
- * more information.
33
- */
34
- collateralSurplusBalance: Decimal;
35
- /** Current price of the native currency (e.g. Ether) in USD. */
36
- price: Decimal;
37
- /** Total amount of ZUSD currently deposited in the Stability Pool. */
38
- zusdInStabilityPool: Decimal;
39
- /** Total collateral and debt in the Zero system. */
40
- total: Trove;
41
- /**
42
- * Total collateral and debt per stake that has been liquidated through redistribution.
43
- *
44
- * @remarks
45
- * Needed when dealing with instances of {@link TroveWithPendingRedistribution}.
46
- */
47
- totalRedistributed: Trove;
48
- /**
49
- * User's Trove in its state after the last direct modification.
50
- *
51
- * @remarks
52
- * The current state of the user's Trove can be found as
53
- * {@link LiquityStoreDerivedState.trove | trove}.
54
- */
55
- troveBeforeRedistribution: TroveWithPendingRedistribution;
56
- /** User's stability deposit. */
57
- stabilityDeposit: StabilityDeposit;
58
- /** @internal */
59
- _feesInNormalMode: Fees;
60
- /** User's ZERO stake. */
61
- zeroStake: ZEROStake;
62
- /** Total amount of ZERO currently staked. */
63
- totalStakedZERO: Decimal;
64
- /** @internal */
65
- _riskiestTroveBeforeRedistribution: TroveWithPendingRedistribution;
66
- }
67
- /**
68
- * State variables derived from {@link LiquityStoreBaseState}.
69
- *
70
- * @public
71
- */
72
- export interface LiquityStoreDerivedState {
73
- /** Current state of user's Trove */
74
- trove: UserTrove;
75
- /** Calculator for current fees. */
76
- fees: Fees;
77
- /**
78
- * Current borrowing rate.
79
- *
80
- * @remarks
81
- * A value between 0 and 1.
82
- *
83
- * @example
84
- * For example a value of 0.01 amounts to a borrowing fee of 1% of the borrowed amount.
85
- */
86
- borrowingRate: Decimal;
87
- /**
88
- * Current redemption rate.
89
- *
90
- * @remarks
91
- * Note that the actual rate paid by a redemption transaction will depend on the amount of ZUSD
92
- * being redeemed.
93
- *
94
- * Use {@link Fees.redemptionRate} to calculate a precise redemption rate.
95
- */
96
- redemptionRate: Decimal;
97
- /**
98
- * Whether there are any Troves with collateral ratio below the
99
- * {@link MINIMUM_COLLATERAL_RATIO | minimum}.
100
- */
101
- haveUndercollateralizedTroves: boolean;
102
- }
103
- /**
104
- * Type of {@link LiquityStore}'s {@link LiquityStore.state | state}.
105
- *
106
- * @remarks
107
- * It combines all properties of {@link LiquityStoreBaseState} and {@link LiquityStoreDerivedState}
108
- * with optional extra state added by the particular `LiquityStore` implementation.
109
- *
110
- * The type parameter `T` may be used to type the extra state.
111
- *
112
- * @public
113
- */
114
- export declare type LiquityStoreState<T = unknown> = LiquityStoreBaseState & LiquityStoreDerivedState & T;
115
- /**
116
- * Parameters passed to {@link LiquityStore} listeners.
117
- *
118
- * @remarks
119
- * Use the {@link LiquityStore.subscribe | subscribe()} function to register a listener.
120
-
121
- * @public
122
- */
123
- export interface LiquityStoreListenerParams<T = unknown> {
124
- /** The entire previous state. */
125
- newState: LiquityStoreState<T>;
126
- /** The entire new state. */
127
- oldState: LiquityStoreState<T>;
128
- /** Only the state variables that have changed. */
129
- stateChange: Partial<LiquityStoreState<T>>;
130
- }
131
- /**
132
- * Abstract base class of Zero data store implementations.
133
- *
134
- * @remarks
135
- * The type parameter `T` may be used to type extra state added to {@link LiquityStoreState} by the
136
- * subclass.
137
- *
138
- * Implemented by {@link @sovryn-zero/lib-ethers#BlockPolledLiquityStore}.
139
- *
140
- * @public
141
- */
142
- export declare abstract class LiquityStore<T = unknown> {
143
- /** Turn console logging on/off. */
144
- logging: boolean;
145
- /**
146
- * Called after the state is fetched for the first time.
147
- *
148
- * @remarks
149
- * See {@link LiquityStore.start | start()}.
150
- */
151
- onLoaded?: () => void;
152
- /** @internal */
153
- protected _loaded: boolean;
154
- private _baseState?;
155
- private _derivedState?;
156
- private _extraState?;
157
- private _updateTimeoutId;
158
- private _listeners;
159
- /**
160
- * The current store state.
161
- *
162
- * @remarks
163
- * Should not be accessed before the store is loaded. Assign a function to
164
- * {@link LiquityStore.onLoaded | onLoaded} to get a callback when this happens.
165
- *
166
- * See {@link LiquityStoreState} for the list of properties returned.
167
- */
168
- get state(): LiquityStoreState<T>;
169
- /** @internal */
170
- protected abstract _doStart(): () => void;
171
- /**
172
- * Start monitoring the blockchain for Zero state changes.
173
- *
174
- * @remarks
175
- * The {@link LiquityStore.onLoaded | onLoaded} callback will be called after the state is fetched
176
- * for the first time.
177
- *
178
- * Use the {@link LiquityStore.subscribe | subscribe()} function to register listeners.
179
- *
180
- * @returns Function to stop the monitoring.
181
- */
182
- start(): () => void;
183
- private _cancelUpdateIfScheduled;
184
- private _scheduleUpdate;
185
- private _logUpdate;
186
- private _updateIfChanged;
187
- private _silentlyUpdateIfChanged;
188
- private _updateFees;
189
- private _reduce;
190
- private _derive;
191
- private _reduceDerived;
192
- /** @internal */
193
- protected abstract _reduceExtra(extraState: T, extraStateUpdate: Partial<T>): T;
194
- private _notify;
195
- /**
196
- * Register a state change listener.
197
- *
198
- * @param listener - Function that will be called whenever state changes.
199
- * @returns Function to unregister this listener.
200
- */
201
- subscribe(listener: (params: LiquityStoreListenerParams<T>) => void): () => void;
202
- /** @internal */
203
- protected _load(baseState: LiquityStoreBaseState, extraState?: T): void;
204
- /** @internal */
205
- protected _update(baseStateUpdate?: Partial<LiquityStoreBaseState>, extraStateUpdate?: Partial<T>): void;
206
- }
207
- //# sourceMappingURL=LiquitySt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AAC,CAEhC;IAED,gBAAgB;IAChB,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM,IAAI;IAEzC;;;;;;;;;;OAUG;IACH,KAAK,IAAI,MAAM,IAAI;IAUnB,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,OAAO;IA2Hf,OAAO,CAAC,OAAO;IAqBf,OAAO,CAAC,cAAc;IA8BtB,gBAAgB;IAChB,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAE/E,OAAO,CAAC,OAAO;IAcf;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAUhF,gBAAgB;IAChB,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI;IAevE,gBAAgB;IAChB,SAAS,CAAC,OAAO,CACf,eAAe,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAChD,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAC5B,IAAI;CAyBR"}
@@ -1,208 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LiquityStore = void 0;
7
- const assert_1 = __importDefault(require("assert"));
8
- const strictEquals = (a, b) => a === b;
9
- const eq = (a, b) => a.eq(b);
10
- const equals = (a, b) => a.equals(b);
11
- const frontendStatusEquals = (a, b) => a.status === "unregistered"
12
- ? b.status === "unregistered"
13
- : b.status === "registered" && a.kickbackRate.eq(b.kickbackRate);
14
- const showFrontendStatus = (x) => x.status === "unregistered"
15
- ? '{ status: "unregistered" }'
16
- : `{ status: "registered", kickbackRate: ${x.kickbackRate} }`;
17
- const wrap = (f) => (...args) => f(...args);
18
- const difference = (a, b) => Object.fromEntries(Object.entries(a).filter(([key, value]) => value !== b[key]));
19
- /**
20
- * Abstract base class of Zero data store implementations.
21
- *
22
- * @remarks
23
- * The type parameter `T` may be used to type extra state added to {@link LiquityStoreState} by the
24
- * subclass.
25
- *
26
- * Implemented by {@link @sovryn-zero/lib-ethers#BlockPolledLiquityStore}.
27
- *
28
- * @public
29
- */
30
- class LiquityStore {
31
- constructor() {
32
- /** Turn console logging on/off. */
33
- this.logging = false;
34
- /** @internal */
35
- this._loaded = false;
36
- this._listeners = new Set();
37
- }
38
- /**
39
- * The current store state.
40
- *
41
- * @remarks
42
- * Should not be accessed before the store is loaded. Assign a function to
43
- * {@link LiquityStore.onLoaded | onLoaded} to get a callback when this happens.
44
- *
45
- * See {@link LiquityStoreState} for the list of properties returned.
46
- */
47
- get state() {
48
- return Object.assign({}, this._baseState, this._derivedState, this._extraState);
49
- }
50
- /**
51
- * Start monitoring the blockchain for Zero state changes.
52
- *
53
- * @remarks
54
- * The {@link LiquityStore.onLoaded | onLoaded} callback will be called after the state is fetched
55
- * for the first time.
56
- *
57
- * Use the {@link LiquityStore.subscribe | subscribe()} function to register listeners.
58
- *
59
- * @returns Function to stop the monitoring.
60
- */
61
- start() {
62
- const doStop = this._doStart();
63
- return () => {
64
- doStop();
65
- this._cancelUpdateIfScheduled();
66
- };
67
- }
68
- _cancelUpdateIfScheduled() {
69
- if (this._updateTimeoutId !== undefined) {
70
- clearTimeout(this._updateTimeoutId);
71
- }
72
- }
73
- _scheduleUpdate() {
74
- this._cancelUpdateIfScheduled();
75
- this._updateTimeoutId = setTimeout(() => {
76
- this._updateTimeoutId = undefined;
77
- this._update();
78
- }, 30000);
79
- }
80
- _logUpdate(name, next, show) {
81
- if (this.logging) {
82
- console.log(`${name} updated to ${show ? show(next) : next}`);
83
- }
84
- return next;
85
- }
86
- _updateIfChanged(equals, name, prev, next, show) {
87
- return next !== undefined && !equals(prev, next) ? this._logUpdate(name, next, show) : prev;
88
- }
89
- _silentlyUpdateIfChanged(equals, prev, next) {
90
- return next !== undefined && !equals(prev, next) ? next : prev;
91
- }
92
- _updateFees(name, prev, next) {
93
- if (next && !next.equals(prev)) {
94
- // Filter out fee update spam that happens on every new block by only logging when string
95
- // representation changes.
96
- if (`${next}` !== `${prev}`) {
97
- this._logUpdate(name, next);
98
- }
99
- return next;
100
- }
101
- else {
102
- return prev;
103
- }
104
- }
105
- _reduce(baseState, baseStateUpdate) {
106
- return {
107
- frontend: this._updateIfChanged(frontendStatusEquals, "frontend", baseState.frontend, baseStateUpdate.frontend, showFrontendStatus),
108
- ownFrontend: this._updateIfChanged(frontendStatusEquals, "ownFrontend", baseState.ownFrontend, baseStateUpdate.ownFrontend, showFrontendStatus),
109
- numberOfTroves: this._updateIfChanged(strictEquals, "numberOfTroves", baseState.numberOfTroves, baseStateUpdate.numberOfTroves),
110
- accountBalance: this._updateIfChanged(eq, "accountBalance", baseState.accountBalance, baseStateUpdate.accountBalance),
111
- zusdBalance: this._updateIfChanged(eq, "zusdBalance", baseState.zusdBalance, baseStateUpdate.zusdBalance),
112
- nueBalance: this._updateIfChanged(eq, "nueBalance", baseState.nueBalance, baseStateUpdate.nueBalance),
113
- zeroBalance: this._updateIfChanged(eq, "zeroBalance", baseState.zeroBalance, baseStateUpdate.zeroBalance),
114
- collateralSurplusBalance: this._updateIfChanged(eq, "collateralSurplusBalance", baseState.collateralSurplusBalance, baseStateUpdate.collateralSurplusBalance),
115
- price: this._updateIfChanged(eq, "price", baseState.price, baseStateUpdate.price),
116
- zusdInStabilityPool: this._updateIfChanged(eq, "zusdInStabilityPool", baseState.zusdInStabilityPool, baseStateUpdate.zusdInStabilityPool),
117
- total: this._updateIfChanged(equals, "total", baseState.total, baseStateUpdate.total),
118
- totalRedistributed: this._updateIfChanged(equals, "totalRedistributed", baseState.totalRedistributed, baseStateUpdate.totalRedistributed),
119
- troveBeforeRedistribution: this._updateIfChanged(equals, "troveBeforeRedistribution", baseState.troveBeforeRedistribution, baseStateUpdate.troveBeforeRedistribution),
120
- stabilityDeposit: this._updateIfChanged(equals, "stabilityDeposit", baseState.stabilityDeposit, baseStateUpdate.stabilityDeposit),
121
- _feesInNormalMode: this._silentlyUpdateIfChanged(equals, baseState._feesInNormalMode, baseStateUpdate._feesInNormalMode),
122
- zeroStake: this._updateIfChanged(equals, "zeroStake", baseState.zeroStake, baseStateUpdate.zeroStake),
123
- totalStakedZERO: this._updateIfChanged(eq, "totalStakedZERO", baseState.totalStakedZERO, baseStateUpdate.totalStakedZERO),
124
- _riskiestTroveBeforeRedistribution: this._silentlyUpdateIfChanged(equals, baseState._riskiestTroveBeforeRedistribution, baseStateUpdate._riskiestTroveBeforeRedistribution)
125
- };
126
- }
127
- _derive({ troveBeforeRedistribution, totalRedistributed, _feesInNormalMode, total, price, _riskiestTroveBeforeRedistribution }) {
128
- const fees = _feesInNormalMode._setRecoveryMode(total.collateralRatioIsBelowCritical(price));
129
- return {
130
- trove: troveBeforeRedistribution.applyRedistribution(totalRedistributed),
131
- fees,
132
- borrowingRate: fees.borrowingRate(),
133
- redemptionRate: fees.redemptionRate(),
134
- haveUndercollateralizedTroves: _riskiestTroveBeforeRedistribution
135
- .applyRedistribution(totalRedistributed)
136
- .collateralRatioIsBelowMinimum(price)
137
- };
138
- }
139
- _reduceDerived(derivedState, derivedStateUpdate) {
140
- return {
141
- fees: this._updateFees("fees", derivedState.fees, derivedStateUpdate.fees),
142
- trove: this._updateIfChanged(equals, "trove", derivedState.trove, derivedStateUpdate.trove),
143
- borrowingRate: this._silentlyUpdateIfChanged(eq, derivedState.borrowingRate, derivedStateUpdate.borrowingRate),
144
- redemptionRate: this._silentlyUpdateIfChanged(eq, derivedState.redemptionRate, derivedStateUpdate.redemptionRate),
145
- haveUndercollateralizedTroves: this._updateIfChanged(strictEquals, "haveUndercollateralizedTroves", derivedState.haveUndercollateralizedTroves, derivedStateUpdate.haveUndercollateralizedTroves)
146
- };
147
- }
148
- _notify(params) {
149
- // Iterate on a copy of `_listeners`, to avoid notifying any new listeners subscribed by
150
- // existing listeners, as that could result in infinite loops.
151
- //
152
- // Before calling a listener from our copy of `_listeners`, check if it has been removed from
153
- // the original set. This way we avoid calling listeners that have already been unsubscribed
154
- // by an earlier listener callback.
155
- [...this._listeners].forEach(listener => {
156
- if (this._listeners.has(listener)) {
157
- listener(params);
158
- }
159
- });
160
- }
161
- /**
162
- * Register a state change listener.
163
- *
164
- * @param listener - Function that will be called whenever state changes.
165
- * @returns Function to unregister this listener.
166
- */
167
- subscribe(listener) {
168
- const uniqueListener = wrap(listener);
169
- this._listeners.add(uniqueListener);
170
- return () => {
171
- this._listeners.delete(uniqueListener);
172
- };
173
- }
174
- /** @internal */
175
- _load(baseState, extraState) {
176
- assert_1.default(!this._loaded);
177
- this._baseState = baseState;
178
- this._derivedState = this._derive(baseState);
179
- this._extraState = extraState;
180
- this._loaded = true;
181
- this._scheduleUpdate();
182
- if (this.onLoaded) {
183
- this.onLoaded();
184
- }
185
- }
186
- /** @internal */
187
- _update(baseStateUpdate, extraStateUpdate) {
188
- assert_1.default(this._baseState && this._derivedState);
189
- const oldState = this.state;
190
- if (baseStateUpdate) {
191
- this._baseState = this._reduce(this._baseState, baseStateUpdate);
192
- }
193
- // Always running this lets us derive state based on passage of time, like baseRate decay
194
- this._derivedState = this._reduceDerived(this._derivedState, this._derive(this._baseState));
195
- if (extraStateUpdate) {
196
- assert_1.default(this._extraState);
197
- this._extraState = this._reduceExtra(this._extraState, extraStateUpdate);
198
- }
199
- this._scheduleUpdate();
200
- this._notify({
201
- newState: this.state,
202
- oldState,
203
- stateChange: difference(this.state, oldState)
204
- });
205
- }
206
- }
207
- exports.LiquityStore = LiquityStore;
208
- //# sourceMappingUR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+0,0 @@
1
- import { Decimal } from "./Decimal";
2
- import { Trove, TroveWithPendingRedistribution } from "./Trove";
3
- import { StabilityDeposit } from "./StabilityDeposit";
4
- /** @alpha */
5
- export interface ObservableLiquity {
6
- watchTotalRedistributed(onTotalRedistributedChanged: (totalRedistributed: Trove) => void): () => void;
7
- watchTroveWithoutRewards(onTroveChanged: (trove: TroveWithPendingRedistribution) => void, address?: string): () => void;
8
- watchNumberOfTroves(onNumberOfTrovesChanged: (numberOfTroves: number) => void): () => void;
9
- watchPrice(onPriceChanged: (price: Decimal) => void): () => void;
10
- watchTotal(onTotalChanged: (total: Trove) => void): () => void;
11
- watchStabilityDeposit(onStabilityDepositChanged: (stabilityDeposit: StabilityDeposit) => void, address?: string): () => void;
12
- watchZUSDInStabilityPool(onZUSDInStabilityPoolChanged: (zusdInStabilityPool: Decimal) => void): () => void;
13
- watchZUSDBalance(onZUSDBalanceChanged: (balance: Decimal) => void, address?: string): () => void;
14
- }
15
- //# sourceMappingURL=ObservableLiquity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObservableLiquity.d.ts","sourceRoot":"","sources":["../../src/ObservableLiquity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,aAAa;AACb,MAAM,WAAW,iBAAiB;IAChC,uBAAuB,CACrB,2BAA2B,EAAE,CAAC,kBAAkB,EAAE,KAAK,KAAK,IAAI,GAC/D,MAAM,IAAI,CAAC;IAEd,wBAAwB,CACtB,cAAc,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,EAC/D,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,IAAI,CAAC;IAEd,mBAAmB,CAAC,uBAAuB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE3F,UAAU,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAEjE,UAAU,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE/D,qBAAqB,CACnB,yBAAyB,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,IAAI,EACvE,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,IAAI,CAAC;IAEd,wBAAwB,CACtB,4BAA4B,EAAE,CAAC,mBAAmB,EAAE,OAAO,KAAK,IAAI,GACnE,MAAM,IAAI,CAAC;IAEd,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAAC;CAClG"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ObservableLiquity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObservableLiquity.js","sourceRoot":"","sources":["../../src/ObservableLiquity.ts"],"names":[],"mappings":""}
@@ -1,125 +0,0 @@
1
- import { Decimal, Decimalish } from "./Decimal";
2
- import { TroveAdjustmentParams, TroveCreationParams } from "./Trove";
3
- import { LiquityReceipt, SendableLiquity, SentLiquityTransaction } from "./SendableLiquity";
4
- import { CollateralGainTransferDetails, LiquidationDetails, RedemptionDetails, StabilityDepositChangeDetails, StabilityPoolGainsWithdrawalDetails, TroveAdjustmentDetails, TroveClosureDetails, TroveCreationDetails } from "./TransactableLiquity";
5
- /**
6
- * A transaction that has been prepared for sending.
7
- *
8
- * @remarks
9
- * Implemented by {@link @sovryn-zero/lib-ethers#PopulatedEthersLiquityTransaction}.
10
- *
11
- * @public
12
- */
13
- export interface PopulatedLiquityTransaction<P = unknown, T extends SentLiquityTransaction = SentLiquityTransaction> {
14
- /** Implementation-specific populated transaction object. */
15
- readonly rawPopulatedTransaction: P;
16
- /**
17
- * Send the transaction.
18
- *
19
- * @returns An object that implements {@link @sovryn-zero/lib-base#SentLiquityTransaction}.
20
- */
21
- send(): Promise<T>;
22
- }
23
- /**
24
- * A redemption transaction that has been prepared for sending.
25
- *
26
- * @remarks
27
- * The Zero protocol fulfills redemptions by repaying the debt of Troves in ascending order of
28
- * their collateralization ratio, and taking a portion of their collateral in exchange. Due to the
29
- * {@link @sovryn-zero/lib-base#ZUSD_MINIMUM_DEBT | minimum debt} requirement that Troves must fulfill,
30
- * some ZUSD amounts are not possible to redeem exactly.
31
- *
32
- * When {@link @sovryn-zero/lib-base#PopulatableLiquity.redeemZUSD | redeemZUSD()} is called with an
33
- * amount that can't be fully redeemed, the amount will be truncated (see the `redeemableZUSDAmount`
34
- * property). When this happens, the redeemer can either redeem the truncated amount by sending the
35
- * transaction unchanged, or prepare a new transaction by
36
- * {@link @sovryn-zero/lib-base#PopulatedRedemption.increaseAmountByMinimumNetDebt | increasing the amount}
37
- * to the next lowest possible value, which is the sum of the truncated amount and
38
- * {@link @sovryn-zero/lib-base#ZUSD_MINIMUM_NET_DEBT}.
39
- *
40
- * @public
41
- */
42
- export interface PopulatedRedemption<P = unknown, S = unknown, R = unknown> extends PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, RedemptionDetails>>> {
43
- /** Amount of ZUSD the redeemer is trying to redeem. */
44
- readonly attemptedZUSDAmount: Decimal;
45
- /** Maximum amount of ZUSD that is currently redeemable from `attemptedZUSDAmount`. */
46
- readonly redeemableZUSDAmount: Decimal;
47
- /** Whether `redeemableZUSDAmount` is less than `attemptedZUSDAmount`. */
48
- readonly isTruncated: boolean;
49
- /**
50
- * Prepare a new transaction by increasing the attempted amount to the next lowest redeemable
51
- * value.
52
- *
53
- * @param maxRedemptionRate - Maximum acceptable
54
- * {@link @sovryn-zero/lib-base#Fees.redemptionRate | redemption rate} to
55
- * use in the new transaction.
56
- *
57
- * @remarks
58
- * If `maxRedemptionRate` is omitted, the original transaction's `maxRedemptionRate` is reused
59
- * unless that was also omitted, in which case the current redemption rate (based on the increased
60
- * amount) plus 0.1% is used as maximum acceptable rate.
61
- */
62
- increaseAmountByMinimumNetDebt(maxRedemptionRate?: Decimalish): Promise<PopulatedRedemption<P, S, R>>;
63
- }
64
- /** @internal */
65
- export declare type _PopulatableFrom<T, P> = {
66
- [M in keyof T]: T[M] extends (...args: infer A) => Promise<infer U> ? U extends SentLiquityTransaction ? (...args: A) => Promise<PopulatedLiquityTransaction<P, U>> : never : never;
67
- };
68
- /**
69
- * Prepare Zero transactions for sending.
70
- *
71
- * @remarks
72
- * The functions return an object implementing {@link PopulatedLiquityTransaction}, which can be
73
- * used to send the transaction and get a {@link SentLiquityTransaction}.
74
- *
75
- * Implemented by {@link @sovryn-zero/lib-ethers#PopulatableEthersLiquity}.
76
- *
77
- * @public
78
- */
79
- export interface PopulatableLiquity<R = unknown, S = unknown, P = unknown> extends _PopulatableFrom<SendableLiquity<R, S>, P> {
80
- /** {@inheritDoc TransactableLiquity.openTrove} */
81
- openTrove(params: TroveCreationParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveCreationDetails>>>>;
82
- /** {@inheritDoc TransactableLiquity.closeTrove} */
83
- closeTrove(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveClosureDetails>>>>;
84
- /** {@inheritDoc TransactableLiquity.adjustTrove} */
85
- adjustTrove(params: TroveAdjustmentParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
86
- /** {@inheritDoc TransactableLiquity.depositCollateral} */
87
- depositCollateral(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
88
- /** {@inheritDoc TransactableLiquity.withdrawCollateral} */
89
- withdrawCollateral(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
90
- /** {@inheritDoc TransactableLiquity.borrowZUSD} */
91
- borrowZUSD(amount: Decimalish, maxBorrowingRate?: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
92
- /** {@inheritDoc TransactableLiquity.repayZUSD} */
93
- repayZUSD(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>>;
94
- /** @internal */
95
- setPrice(price: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
96
- /** {@inheritDoc TransactableLiquity.liquidate} */
97
- liquidate(address: string | string[]): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>>;
98
- /** {@inheritDoc TransactableLiquity.liquidateUpTo} */
99
- liquidateUpTo(maximumNumberOfTrovesToLiquidate: number): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>>;
100
- /** {@inheritDoc TransactableLiquity.depositZUSDInStabilityPool} */
101
- depositZUSDInStabilityPool(amount: Decimalish, frontendTag?: string): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>>;
102
- /** {@inheritDoc TransactableLiquity.withdrawZUSDFromStabilityPool} */
103
- withdrawZUSDFromStabilityPool(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>>;
104
- /** {@inheritDoc TransactableLiquity.withdrawGainsFromStabilityPool} */
105
- withdrawGainsFromStabilityPool(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, StabilityPoolGainsWithdrawalDetails>>>>;
106
- /** {@inheritDoc TransactableLiquity.transferCollateralGainToTrove} */
107
- transferCollateralGainToTrove(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, CollateralGainTransferDetails>>>>;
108
- /** {@inheritDoc TransactableLiquity.sendZUSD} */
109
- sendZUSD(toAddress: string, amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
110
- /** {@inheritDoc TransactableLiquity.sendZERO} */
111
- sendZERO(toAddress: string, amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
112
- /** {@inheritDoc TransactableLiquity.redeemZUSD} */
113
- redeemZUSD(amount: Decimalish, maxRedemptionRate?: Decimalish): Promise<PopulatedRedemption<P, S, R>>;
114
- /** {@inheritDoc TransactableLiquity.claimCollateralSurplus} */
115
- claimCollateralSurplus(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
116
- /** {@inheritDoc TransactableLiquity.stakeZERO} */
117
- stakeZERO(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
118
- /** {@inheritDoc TransactableLiquity.unstakeZERO} */
119
- unstakeZERO(amount: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
120
- /** {@inheritDoc TransactableLiquity.withdrawGainsFromStaking} */
121
- withdrawGainsFromStaking(): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
122
- /** {@inheritDoc TransactableLiquity.registerFrontend} */
123
- registerFrontend(kickbackRate: Decimalish): Promise<PopulatedLiquityTransaction<P, SentLiquityTransaction<S, LiquityReceipt<R, void>>>>;
124
- }
125
- //# sourceMappingURL=PopulatableLiquity.d.ts.map
@@ -1 +0,0 @@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;IAE/F,mDAAmD;IACnD,UAAU,CACR,MAAM,EAAE,UAAU,EAClB,iBAAiB,CAAC,EAAE,UAAU,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzC,+DAA+D;IAC/D,sBAAsB,IAAI,OAAO,CAC/B,2BAA2B,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CACnF,CAAC;IAEF,kDAAkD;IAClD,SAAS,CACP,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,2BAA2B,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/F,oDAAoD;IACpD,WAAW,CACT,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,2BAA2B,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/F,iEAAiE;IACjE,wBAAwB,IAAI,OAAO,CACjC,2BAA2B,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CACnF,CAAC;IAEF,yDAAyD;IACzD,gBAAgB,CACd,YAAY,EAAE,UAAU,GACvB,OAAO,CAAC,2BAA2B,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;CAChG"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PopulatableLiquity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopulatableLiquity.js","sourceRoot":"","sources":["../../src/PopulatableLiquity.ts"],"names":[],"mappings":""}