@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.
- package/README.md +5 -19
- package/etc/lib-base.api.md +9 -0
- package/package.json +10 -38
- package/src/Decimal.ts +2 -2
- package/src/Fees.ts +3 -3
- package/src/LiquityStore.ts +12 -3
- package/src/ObservableLiquity.ts +1 -0
- package/src/PopulatableLiquity.ts +2 -2
- package/src/ReadableLiquity.ts +16 -4
- package/src/SendableLiquity.ts +2 -2
- package/src/TransactableLiquity.ts +2 -2
- package/src/Trove.ts +3 -3
- package/src/_CachedReadableLiquity.ts +14 -0
- package/src/constants.ts +3 -3
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/src/Decimal.d.ts +0 -89
- package/dist/src/Decimal.d.ts.map +0 -1
- package/dist/src/Decimal.js +0 -361
- package/dist/src/Decimal.js.map +0 -1
- package/dist/src/Fees.d.ts +0 -82
- package/dist/src/Fees.d.ts.map +0 -1
- package/dist/src/Fees.js +0 -123
- package/dist/src/Fees.js.map +0 -1
- package/dist/src/LiquityStore.d.ts +0 -207
- package/dist/src/LiquityStore.d.ts.map +0 -1
- package/dist/src/LiquityStore.js +0 -208
- package/dist/src/LiquityStore.js.map +0 -1
- package/dist/src/ObservableLiquity.d.ts +0 -15
- package/dist/src/ObservableLiquity.d.ts.map +0 -1
- package/dist/src/ObservableLiquity.js +0 -3
- package/dist/src/ObservableLiquity.js.map +0 -1
- package/dist/src/PopulatableLiquity.d.ts +0 -125
- package/dist/src/PopulatableLiquity.d.ts.map +0 -1
- package/dist/src/PopulatableLiquity.js +0 -3
- package/dist/src/PopulatableLiquity.js.map +0 -1
- package/dist/src/ReadableLiquity.d.ts +0 -152
- package/dist/src/ReadableLiquity.d.ts.map +0 -1
- package/dist/src/ReadableLiquity.js +0 -3
- package/dist/src/ReadableLiquity.js.map +0 -1
- package/dist/src/SendableLiquity.d.ts +0 -156
- package/dist/src/SendableLiquity.d.ts.map +0 -1
- package/dist/src/SendableLiquity.js +0 -20
- package/dist/src/SendableLiquity.js.map +0 -1
- package/dist/src/StabilityDeposit.d.ts +0 -59
- package/dist/src/StabilityDeposit.d.ts.map +0 -1
- package/dist/src/StabilityDeposit.js +0 -80
- package/dist/src/StabilityDeposit.js.map +0 -1
- package/dist/src/TransactableLiquity.d.ts +0 -414
- package/dist/src/TransactableLiquity.d.ts.map +0 -1
- package/dist/src/TransactableLiquity.js +0 -18
- package/dist/src/TransactableLiquity.js.map +0 -1
- package/dist/src/Trove.d.ts +0 -367
- package/dist/src/Trove.d.ts.map +0 -1
- package/dist/src/Trove.js +0 -423
- package/dist/src/Trove.js.map +0 -1
- package/dist/src/ZEROStake.d.ts +0 -52
- package/dist/src/ZEROStake.d.ts.map +0 -1
- package/dist/src/ZEROStake.js +0 -74
- package/dist/src/ZEROStake.js.map +0 -1
- package/dist/src/_CachedReadableLiquity.d.ts +0 -54
- package/dist/src/_CachedReadableLiquity.d.ts.map +0 -1
- package/dist/src/_CachedReadableLiquity.js +0 -89
- package/dist/src/_CachedReadableLiquity.js.map +0 -1
- package/dist/src/constants.d.ts +0 -61
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -64
- package/dist/src/constants.js.map +0 -1
- package/dist/tsdoc-metadata.json +0 -11
@@ -1,152 +0,0 @@
|
|
1
|
-
import { Decimal } from "./Decimal";
|
2
|
-
import { Trove, TroveWithPendingRedistribution, UserTrove } from "./Trove";
|
3
|
-
import { StabilityDeposit } from "./StabilityDeposit";
|
4
|
-
import { Fees } from "./Fees";
|
5
|
-
import { ZEROStake } from "./ZEROStake";
|
6
|
-
/**
|
7
|
-
* Represents whether an address has been registered as a Zero frontend.
|
8
|
-
*
|
9
|
-
* @remarks
|
10
|
-
* Returned by the {@link ReadableLiquity.getFrontendStatus | getFrontendStatus()} function.
|
11
|
-
*
|
12
|
-
* When `status` is `"registered"`, `kickbackRate` gives the frontend's kickback rate as a
|
13
|
-
* {@link Decimal} between 0 and 1.
|
14
|
-
*
|
15
|
-
* @public
|
16
|
-
*/
|
17
|
-
export declare type FrontendStatus = {
|
18
|
-
status: "unregistered";
|
19
|
-
} | {
|
20
|
-
status: "registered";
|
21
|
-
kickbackRate: Decimal;
|
22
|
-
};
|
23
|
-
/**
|
24
|
-
* Parameters of the {@link ReadableLiquity.(getTroves:2) | getTroves()} function.
|
25
|
-
*
|
26
|
-
* @public
|
27
|
-
*/
|
28
|
-
export interface TroveListingParams {
|
29
|
-
/** Number of Troves to retrieve. */
|
30
|
-
readonly first: number;
|
31
|
-
/** How the Troves should be sorted. */
|
32
|
-
readonly sortedBy: "ascendingCollateralRatio" | "descendingCollateralRatio";
|
33
|
-
/** Index of the first Trove to retrieve from the sorted list. */
|
34
|
-
readonly startingAt?: number;
|
35
|
-
/**
|
36
|
-
* When set to `true`, the retrieved Troves won't include the liquidation shares received since
|
37
|
-
* the last time they were directly modified.
|
38
|
-
*
|
39
|
-
* @remarks
|
40
|
-
* Changes the type of returned Troves to {@link TroveWithPendingRedistribution}.
|
41
|
-
*/
|
42
|
-
readonly beforeRedistribution?: boolean;
|
43
|
-
}
|
44
|
-
/**
|
45
|
-
* Read the state of the Zero protocol.
|
46
|
-
*
|
47
|
-
* @remarks
|
48
|
-
* Implemented by {@link @sovryn-zero/lib-ethers#EthersLiquity}.
|
49
|
-
*
|
50
|
-
* @public
|
51
|
-
*/
|
52
|
-
export interface ReadableLiquity {
|
53
|
-
/**
|
54
|
-
* Get the total collateral and debt per stake that has been liquidated through redistribution.
|
55
|
-
*
|
56
|
-
* @remarks
|
57
|
-
* Needed when dealing with instances of {@link @sovryn-zero/lib-base#TroveWithPendingRedistribution}.
|
58
|
-
*/
|
59
|
-
getTotalRedistributed(): Promise<Trove>;
|
60
|
-
/**
|
61
|
-
* Get a Trove in its state after the last direct modification.
|
62
|
-
*
|
63
|
-
* @param address - Address that owns the Trove.
|
64
|
-
*
|
65
|
-
* @remarks
|
66
|
-
* The current state of a Trove can be fetched using
|
67
|
-
* {@link @sovryn-zero/lib-base#ReadableLiquity.getTrove | getTrove()}.
|
68
|
-
*/
|
69
|
-
getTroveBeforeRedistribution(address?: string): Promise<TroveWithPendingRedistribution>;
|
70
|
-
/**
|
71
|
-
* Get the current state of a Trove.
|
72
|
-
*
|
73
|
-
* @param address - Address that owns the Trove.
|
74
|
-
*/
|
75
|
-
getTrove(address?: string): Promise<UserTrove>;
|
76
|
-
/**
|
77
|
-
* Get number of Troves that are currently open.
|
78
|
-
*/
|
79
|
-
getNumberOfTroves(): Promise<number>;
|
80
|
-
/**
|
81
|
-
* Get the current price of the native currency (e.g. Ether) in USD.
|
82
|
-
*/
|
83
|
-
getPrice(): Promise<Decimal>;
|
84
|
-
/**
|
85
|
-
* Get the total amount of collateral and debt in the Zero system.
|
86
|
-
*/
|
87
|
-
getTotal(): Promise<Trove>;
|
88
|
-
/**
|
89
|
-
* Get the current state of a Stability Deposit.
|
90
|
-
*
|
91
|
-
* @param address - Address that owns the Stability Deposit.
|
92
|
-
*/
|
93
|
-
getStabilityDeposit(address?: string): Promise<StabilityDeposit>;
|
94
|
-
/**
|
95
|
-
* Get the total amount of ZUSD currently deposited in the Stability Pool.
|
96
|
-
*/
|
97
|
-
getZUSDInStabilityPool(): Promise<Decimal>;
|
98
|
-
/**
|
99
|
-
* Get the amount of ZUSD held by an address.
|
100
|
-
*
|
101
|
-
* @param address - Address whose balance should be retrieved.
|
102
|
-
*/
|
103
|
-
getZUSDBalance(address?: string): Promise<Decimal>;
|
104
|
-
/**
|
105
|
-
* Get the amount of ZERO held by an address.
|
106
|
-
*
|
107
|
-
* @param address - Address whose balance should be retrieved.
|
108
|
-
*/
|
109
|
-
getZEROBalance(address?: string): Promise<Decimal>;
|
110
|
-
/**
|
111
|
-
* Get the amount of leftover collateral available for withdrawal by an address.
|
112
|
-
*
|
113
|
-
* @remarks
|
114
|
-
* When a Trove gets liquidated or redeemed, any collateral it has above 110% (in case of
|
115
|
-
* liquidation) or 100% collateralization (in case of redemption) gets sent to a pool, where it
|
116
|
-
* can be withdrawn from using
|
117
|
-
* {@link @sovryn-zero/lib-base#TransactableLiquity.claimCollateralSurplus | claimCollateralSurplus()}.
|
118
|
-
*/
|
119
|
-
getCollateralSurplusBalance(address?: string): Promise<Decimal>;
|
120
|
-
/** @internal */
|
121
|
-
getTroves(params: TroveListingParams & {
|
122
|
-
beforeRedistribution: true;
|
123
|
-
}): Promise<TroveWithPendingRedistribution[]>;
|
124
|
-
/**
|
125
|
-
* Get a slice from the list of Troves.
|
126
|
-
*
|
127
|
-
* @param params - Controls how the list is sorted, and where the slice begins and ends.
|
128
|
-
* @returns Pairs of owner addresses and their Troves.
|
129
|
-
*/
|
130
|
-
getTroves(params: TroveListingParams): Promise<UserTrove[]>;
|
131
|
-
/**
|
132
|
-
* Get a calculator for current fees.
|
133
|
-
*/
|
134
|
-
getFees(): Promise<Fees>;
|
135
|
-
/**
|
136
|
-
* Get the current state of an ZERO Stake.
|
137
|
-
*
|
138
|
-
* @param address - Address that owns the ZERO Stake.
|
139
|
-
*/
|
140
|
-
getZEROStake(address?: string): Promise<ZEROStake>;
|
141
|
-
/**
|
142
|
-
* Get the total amount of ZERO currently staked.
|
143
|
-
*/
|
144
|
-
getTotalStakedZERO(): Promise<Decimal>;
|
145
|
-
/**
|
146
|
-
* Check whether an address is registered as a Zero frontend, and what its kickback rate is.
|
147
|
-
*
|
148
|
-
* @param address - Address to check.
|
149
|
-
*/
|
150
|
-
getFrontendStatus(address?: string): Promise<FrontendStatus>;
|
151
|
-
}
|
152
|
-
//# sourceMappingURL=ReadableLiquity.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ReadableLiquity.d.ts","sourceRoot":"","sources":["../../src/ReadableLiquity.ts"],"names":[],"mappings":"AAAA,OAA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CAAC;IAE3B;;;;OAIG;IACH,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjE;;OAEG;IACH,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3C;;;;OAIG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD;;;;OAIG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD;;;;;;;;OAQG;IACH,2BAA2B,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhE,gBAAgB;IAChB,SAAS,CACP,MAAM,EAAE,kBAAkB,GAAG;QAAE,oBAAoB,EAAE,IAAI,CAAA;KAAE,GAC1D,OAAO,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAE5D;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;;OAIG;IACH,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEnD;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvC;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ReadableLiquity.js","sourceRoot":"","sources":["../../src/ReadableLiquity.ts"],"names":[],"mappings":""}
|
@@ -1,156 +0,0 @@
|
|
1
|
-
import { Decimalish } from "./Decimal";
|
2
|
-
import { TroveAdjustmentParams, TroveCreationParams } from "./Trove";
|
3
|
-
import { CollateralGainTransferDetails, LiquidationDetails, RedemptionDetails, StabilityDepositChangeDetails, StabilityPoolGainsWithdrawalDetails, TransactableLiquity, TroveAdjustmentDetails, TroveClosureDetails, TroveCreationDetails } from "./TransactableLiquity";
|
4
|
-
/**
|
5
|
-
* A transaction that has already been sent.
|
6
|
-
*
|
7
|
-
* @remarks
|
8
|
-
* Implemented by {@link @sovryn-zero/lib-ethers#SentEthersLiquityTransaction}.
|
9
|
-
*
|
10
|
-
* @public
|
11
|
-
*/
|
12
|
-
export interface SentLiquityTransaction<S = unknown, T extends LiquityReceipt = LiquityReceipt> {
|
13
|
-
/** Implementation-specific sent transaction object. */
|
14
|
-
readonly rawSentTransaction: S;
|
15
|
-
/**
|
16
|
-
* Check whether the transaction has been mined, and whether it was successful.
|
17
|
-
*
|
18
|
-
* @remarks
|
19
|
-
* Unlike {@link @sovryn-zero/lib-base#SentLiquityTransaction.waitForReceipt | waitForReceipt()},
|
20
|
-
* this function doesn't wait for the transaction to be mined.
|
21
|
-
*/
|
22
|
-
getReceipt(): Promise<T>;
|
23
|
-
/**
|
24
|
-
* Wait for the transaction to be mined, and check whether it was successful.
|
25
|
-
*
|
26
|
-
* @returns Either a {@link @sovryn-zero/lib-base#FailedReceipt} or a
|
27
|
-
* {@link @sovryn-zero/lib-base#SuccessfulReceipt}.
|
28
|
-
*/
|
29
|
-
waitForReceipt(): Promise<Extract<T, MinedReceipt>>;
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Indicates that the transaction hasn't been mined yet.
|
33
|
-
*
|
34
|
-
* @remarks
|
35
|
-
* Returned by {@link SentLiquityTransaction.getReceipt}.
|
36
|
-
*
|
37
|
-
* @public
|
38
|
-
*/
|
39
|
-
export declare type PendingReceipt = {
|
40
|
-
status: "pending";
|
41
|
-
};
|
42
|
-
/** @internal */
|
43
|
-
export declare const _pendingReceipt: PendingReceipt;
|
44
|
-
/**
|
45
|
-
* Indicates that the transaction has been mined, but it failed.
|
46
|
-
*
|
47
|
-
* @remarks
|
48
|
-
* The `rawReceipt` property is an implementation-specific transaction receipt object.
|
49
|
-
*
|
50
|
-
* Returned by {@link SentLiquityTransaction.getReceipt} and
|
51
|
-
* {@link SentLiquityTransaction.waitForReceipt}.
|
52
|
-
*
|
53
|
-
* @public
|
54
|
-
*/
|
55
|
-
export declare type FailedReceipt<R = unknown> = {
|
56
|
-
status: "failed";
|
57
|
-
rawReceipt: R;
|
58
|
-
};
|
59
|
-
/** @internal */
|
60
|
-
export declare const _failedReceipt: <R>(rawReceipt: R) => FailedReceipt<R>;
|
61
|
-
/**
|
62
|
-
* Indicates that the transaction has succeeded.
|
63
|
-
*
|
64
|
-
* @remarks
|
65
|
-
* The `rawReceipt` property is an implementation-specific transaction receipt object.
|
66
|
-
*
|
67
|
-
* The `details` property may contain more information about the transaction.
|
68
|
-
* See the return types of {@link TransactableLiquity} functions for the exact contents of `details`
|
69
|
-
* for each type of Zero transaction.
|
70
|
-
*
|
71
|
-
* Returned by {@link SentLiquityTransaction.getReceipt} and
|
72
|
-
* {@link SentLiquityTransaction.waitForReceipt}.
|
73
|
-
*
|
74
|
-
* @public
|
75
|
-
*/
|
76
|
-
export declare type SuccessfulReceipt<R = unknown, D = unknown> = {
|
77
|
-
status: "succeeded";
|
78
|
-
rawReceipt: R;
|
79
|
-
details: D;
|
80
|
-
};
|
81
|
-
/** @internal */
|
82
|
-
export declare const _successfulReceipt: <R, D>(rawReceipt: R, details: D, toString?: (() => string) | undefined) => SuccessfulReceipt<R, D>;
|
83
|
-
/**
|
84
|
-
* Either a {@link FailedReceipt} or a {@link SuccessfulReceipt}.
|
85
|
-
*
|
86
|
-
* @public
|
87
|
-
*/
|
88
|
-
export declare type MinedReceipt<R = unknown, D = unknown> = FailedReceipt<R> | SuccessfulReceipt<R, D>;
|
89
|
-
/**
|
90
|
-
* One of either a {@link PendingReceipt}, a {@link FailedReceipt} or a {@link SuccessfulReceipt}.
|
91
|
-
*
|
92
|
-
* @public
|
93
|
-
*/
|
94
|
-
export declare type LiquityReceipt<R = unknown, D = unknown> = PendingReceipt | MinedReceipt<R, D>;
|
95
|
-
/** @internal */
|
96
|
-
export declare type _SendableFrom<T, R, S> = {
|
97
|
-
[M in keyof T]: T[M] extends (...args: infer A) => Promise<infer D> ? (...args: A) => Promise<SentLiquityTransaction<S, LiquityReceipt<R, D>>> : never;
|
98
|
-
};
|
99
|
-
/**
|
100
|
-
* Send Zero transactions.
|
101
|
-
*
|
102
|
-
* @remarks
|
103
|
-
* The functions return an object implementing {@link SentLiquityTransaction}, which can be used
|
104
|
-
* to monitor the transaction and get its details when it succeeds.
|
105
|
-
*
|
106
|
-
* Implemented by {@link @sovryn-zero/lib-ethers#SendableEthersLiquity}.
|
107
|
-
*
|
108
|
-
* @public
|
109
|
-
*/
|
110
|
-
export interface SendableLiquity<R = unknown, S = unknown> extends _SendableFrom<TransactableLiquity, R, S> {
|
111
|
-
/** {@inheritDoc TransactableLiquity.openTrove} */
|
112
|
-
openTrove(params: TroveCreationParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveCreationDetails>>>;
|
113
|
-
/** {@inheritDoc TransactableLiquity.closeTrove} */
|
114
|
-
closeTrove(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveClosureDetails>>>;
|
115
|
-
/** {@inheritDoc TransactableLiquity.adjustTrove} */
|
116
|
-
adjustTrove(params: TroveAdjustmentParams<Decimalish>, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
|
117
|
-
/** {@inheritDoc TransactableLiquity.depositCollateral} */
|
118
|
-
depositCollateral(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
|
119
|
-
/** {@inheritDoc TransactableLiquity.withdrawCollateral} */
|
120
|
-
withdrawCollateral(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
|
121
|
-
/** {@inheritDoc TransactableLiquity.borrowZUSD} */
|
122
|
-
borrowZUSD(amount: Decimalish, maxBorrowingRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
|
123
|
-
/** {@inheritDoc TransactableLiquity.repayZUSD} */
|
124
|
-
repayZUSD(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, TroveAdjustmentDetails>>>;
|
125
|
-
/** @internal */
|
126
|
-
setPrice(price: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
127
|
-
/** {@inheritDoc TransactableLiquity.liquidate} */
|
128
|
-
liquidate(address: string | string[]): Promise<SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>;
|
129
|
-
/** {@inheritDoc TransactableLiquity.liquidateUpTo} */
|
130
|
-
liquidateUpTo(maximumNumberOfTrovesToLiquidate: number): Promise<SentLiquityTransaction<S, LiquityReceipt<R, LiquidationDetails>>>;
|
131
|
-
/** {@inheritDoc TransactableLiquity.depositZUSDInStabilityPool} */
|
132
|
-
depositZUSDInStabilityPool(amount: Decimalish, frontendTag?: string): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>;
|
133
|
-
/** {@inheritDoc TransactableLiquity.withdrawZUSDFromStabilityPool} */
|
134
|
-
withdrawZUSDFromStabilityPool(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityDepositChangeDetails>>>;
|
135
|
-
/** {@inheritDoc TransactableLiquity.withdrawGainsFromStabilityPool} */
|
136
|
-
withdrawGainsFromStabilityPool(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, StabilityPoolGainsWithdrawalDetails>>>;
|
137
|
-
/** {@inheritDoc TransactableLiquity.transferCollateralGainToTrove} */
|
138
|
-
transferCollateralGainToTrove(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, CollateralGainTransferDetails>>>;
|
139
|
-
/** {@inheritDoc TransactableLiquity.sendZUSD} */
|
140
|
-
sendZUSD(toAddress: string, amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
141
|
-
/** {@inheritDoc TransactableLiquity.sendZERO} */
|
142
|
-
sendZERO(toAddress: string, amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
143
|
-
/** {@inheritDoc TransactableLiquity.redeemZUSD} */
|
144
|
-
redeemZUSD(amount: Decimalish, maxRedemptionRate?: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, RedemptionDetails>>>;
|
145
|
-
/** {@inheritDoc TransactableLiquity.claimCollateralSurplus} */
|
146
|
-
claimCollateralSurplus(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
147
|
-
/** {@inheritDoc TransactableLiquity.stakeZERO} */
|
148
|
-
stakeZERO(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
149
|
-
/** {@inheritDoc TransactableLiquity.unstakeZERO} */
|
150
|
-
unstakeZERO(amount: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
151
|
-
/** {@inheritDoc TransactableLiquity.withdrawGainsFromStaking} */
|
152
|
-
withdrawGainsFromStaking(): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
153
|
-
/** {@inheritDoc TransactableLiquity.registerFrontend} */
|
154
|
-
registerFrontend(kickbackRate: Decimalish): Promise<SentLiquityTransaction<S, LiquityReceipt<R, void>>>;
|
155
|
-
}
|
156
|
-
//# sourceMappingURL=SendableLiquity.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"SendableLiquity.d.ts","sourceRoot":"","sources":["../../src/SendableLiquity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAErE,OAAO,EACL,6BAA6B,E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B,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3F,oDAAoD;IACpD,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7F,iEAAiE;IACjE,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,yDAAyD;IACzD,gBAAgB,CACd,YAAY,EAAE,UAAU,GACvB,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CAChE"}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports._successfulReceipt = exports._failedReceipt = exports._pendingReceipt = void 0;
|
4
|
-
/** @internal */
|
5
|
-
exports._pendingReceipt = { status: "pending" };
|
6
|
-
/** @internal */
|
7
|
-
const _failedReceipt = (rawReceipt) => ({
|
8
|
-
status: "failed",
|
9
|
-
rawReceipt
|
10
|
-
});
|
11
|
-
exports._failedReceipt = _failedReceipt;
|
12
|
-
/** @internal */
|
13
|
-
const _successfulReceipt = (rawReceipt, details, toString) => ({
|
14
|
-
status: "succeeded",
|
15
|
-
rawReceipt,
|
16
|
-
details,
|
17
|
-
...(toString ? { toString } : {})
|
18
|
-
});
|
19
|
-
exports._successfulReceipt = _successfulReceipt;
|
20
|
-
//# sourceMappingURL=SendableLiquity.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"SendableLiquity.js","sourceRoot":"","sources":["../../src/SendableLiquity.ts"],"names":[],"mappings":";;;AAuDA,gBAAgB;AACH,QAAA,eAAe,GAAmB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAerE,gBAAgB;AACT,MAAM,cAAc,GAAG,CAAI,UAAa,EAAoB,EAAE,CAAC,CAAC;IACrE,MAAM,EAAE,QAAQ;IAChB,UAAU;CACX,CAAC,CAAC;AAHU,QAAA,cAAc,kBAGxB;AAuBH,gBAAgB;AACT,MAAM,kBAAkB,GAAG,CAChC,UAAa,EACb,OAAU,EACV,QAAuB,EACE,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,WAAW;IACnB,UAAU;IACV,OAAO;IACP,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAClC,CAAC,CAAC;AATU,QAAA,kBAAkB,sBAS5B"}
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { Decimal, Decimalish } from "./Decimal";
|
2
|
-
/**
|
3
|
-
* Represents the change between two Stability Deposit states.
|
4
|
-
*
|
5
|
-
* @public
|
6
|
-
*/
|
7
|
-
export declare type StabilityDepositChange<T> = {
|
8
|
-
depositZUSD: T;
|
9
|
-
withdrawZUSD?: undefined;
|
10
|
-
} | {
|
11
|
-
depositZUSD?: undefined;
|
12
|
-
withdrawZUSD: T;
|
13
|
-
withdrawAllZUSD: boolean;
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* A Stability Deposit and its accrued gains.
|
17
|
-
*
|
18
|
-
* @public
|
19
|
-
*/
|
20
|
-
export declare class StabilityDeposit {
|
21
|
-
/** Amount of ZUSD in the Stability Deposit at the time of the last direct modification. */
|
22
|
-
readonly initialZUSD: Decimal;
|
23
|
-
/** Amount of ZUSD left in the Stability Deposit. */
|
24
|
-
readonly currentZUSD: Decimal;
|
25
|
-
/** Amount of native currency (e.g. Ether) received in exchange for the used-up ZUSD. */
|
26
|
-
readonly collateralGain: Decimal;
|
27
|
-
/** Amount of ZERO rewarded since the last modification of the Stability Deposit. */
|
28
|
-
readonly zeroReward: Decimal;
|
29
|
-
/**
|
30
|
-
* Address of frontend through which this Stability Deposit was made.
|
31
|
-
*
|
32
|
-
* @remarks
|
33
|
-
* If the Stability Deposit was made through a frontend that doesn't tag deposits, this will be
|
34
|
-
* the zero-address.
|
35
|
-
*/
|
36
|
-
readonly frontendTag: string;
|
37
|
-
/** @internal */
|
38
|
-
constructor(initialZUSD: Decimal, currentZUSD: Decimal, collateralGain: Decimal, zeroReward: Decimal, frontendTag: string);
|
39
|
-
get isEmpty(): boolean;
|
40
|
-
/** @internal */
|
41
|
-
toString(): string;
|
42
|
-
/**
|
43
|
-
* Compare to another instance of `StabilityDeposit`.
|
44
|
-
*/
|
45
|
-
equals(that: StabilityDeposit): boolean;
|
46
|
-
/**
|
47
|
-
* Calculate the difference between the `currentZUSD` in this Stability Deposit and `thatZUSD`.
|
48
|
-
*
|
49
|
-
* @returns An object representing the change, or `undefined` if the deposited amounts are equal.
|
50
|
-
*/
|
51
|
-
whatChanged(thatZUSD: Decimalish): StabilityDepositChange<Decimal> | undefined;
|
52
|
-
/**
|
53
|
-
* Apply a {@link StabilityDepositChange} to this Stability Deposit.
|
54
|
-
*
|
55
|
-
* @returns The new deposited ZUSD amount.
|
56
|
-
*/
|
57
|
-
apply(change: StabilityDepositChange<Decimalish> | undefined): Decimal;
|
58
|
-
}
|
59
|
-
//# sourceMappingURL=StabilityDeposit.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"StabilityDeposit.d.ts","sourceRoot":"","sources":["../../src/StabilityDeposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;GAIG;AACH,oBAAY,sBAAsB,CAAC,CAAC,IAChC;IAAE,WAAW,EAAE,CAAC,CAAC;IAAC,YAAY,CAAC,EAAE,SAAS,CAAA;CAAE,GAC5C;IAAE,WAAW,CAAC,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,CAAC,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3E;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,wFAAwF;IACxF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,gBAAgB;gBAEd,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO,EACpB,cAAc,EAAE,OAAO,EACvB,UAAU,EAAE,OAAO,EACnB,WAAW,EAAE,MAAM;IAarB,IAAI,OAAO,IAAI,OAAO,CAOrB;IAED,gBAAgB;IAChB,QAAQ,IAAI,MAAM;IAUlB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO;IAUvC;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,SAAS;IAY9E;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,sBAAsB,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,OAAO;CAavE"}
|
@@ -1,80 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.StabilityDeposit = void 0;
|
4
|
-
const Decimal_1 = require("./Decimal");
|
5
|
-
/**
|
6
|
-
* A Stability Deposit and its accrued gains.
|
7
|
-
*
|
8
|
-
* @public
|
9
|
-
*/
|
10
|
-
class StabilityDeposit {
|
11
|
-
/** @internal */
|
12
|
-
constructor(initialZUSD, currentZUSD, collateralGain, zeroReward, frontendTag) {
|
13
|
-
this.initialZUSD = initialZUSD;
|
14
|
-
this.currentZUSD = currentZUSD;
|
15
|
-
this.collateralGain = collateralGain;
|
16
|
-
this.zeroReward = zeroReward;
|
17
|
-
this.frontendTag = frontendTag;
|
18
|
-
if (this.currentZUSD.gt(this.initialZUSD)) {
|
19
|
-
throw new Error("currentZUSD can't be greater than initialZUSD");
|
20
|
-
}
|
21
|
-
}
|
22
|
-
get isEmpty() {
|
23
|
-
return (this.initialZUSD.isZero &&
|
24
|
-
this.currentZUSD.isZero &&
|
25
|
-
this.collateralGain.isZero &&
|
26
|
-
this.zeroReward.isZero);
|
27
|
-
}
|
28
|
-
/** @internal */
|
29
|
-
toString() {
|
30
|
-
return (`{ initialZUSD: ${this.initialZUSD}` +
|
31
|
-
`, currentZUSD: ${this.currentZUSD}` +
|
32
|
-
`, collateralGain: ${this.collateralGain}` +
|
33
|
-
`, zeroReward: ${this.zeroReward}` +
|
34
|
-
`, frontendTag: "${this.frontendTag}" }`);
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* Compare to another instance of `StabilityDeposit`.
|
38
|
-
*/
|
39
|
-
equals(that) {
|
40
|
-
return (this.initialZUSD.eq(that.initialZUSD) &&
|
41
|
-
this.currentZUSD.eq(that.currentZUSD) &&
|
42
|
-
this.collateralGain.eq(that.collateralGain) &&
|
43
|
-
this.zeroReward.eq(that.zeroReward) &&
|
44
|
-
this.frontendTag === that.frontendTag);
|
45
|
-
}
|
46
|
-
/**
|
47
|
-
* Calculate the difference between the `currentZUSD` in this Stability Deposit and `thatZUSD`.
|
48
|
-
*
|
49
|
-
* @returns An object representing the change, or `undefined` if the deposited amounts are equal.
|
50
|
-
*/
|
51
|
-
whatChanged(thatZUSD) {
|
52
|
-
thatZUSD = Decimal_1.Decimal.from(thatZUSD);
|
53
|
-
if (thatZUSD.lt(this.currentZUSD)) {
|
54
|
-
return { withdrawZUSD: this.currentZUSD.sub(thatZUSD), withdrawAllZUSD: thatZUSD.isZero };
|
55
|
-
}
|
56
|
-
if (thatZUSD.gt(this.currentZUSD)) {
|
57
|
-
return { depositZUSD: thatZUSD.sub(this.currentZUSD) };
|
58
|
-
}
|
59
|
-
}
|
60
|
-
/**
|
61
|
-
* Apply a {@link StabilityDepositChange} to this Stability Deposit.
|
62
|
-
*
|
63
|
-
* @returns The new deposited ZUSD amount.
|
64
|
-
*/
|
65
|
-
apply(change) {
|
66
|
-
if (!change) {
|
67
|
-
return this.currentZUSD;
|
68
|
-
}
|
69
|
-
if (change.withdrawZUSD !== undefined) {
|
70
|
-
return change.withdrawAllZUSD || this.currentZUSD.lte(change.withdrawZUSD)
|
71
|
-
? Decimal_1.Decimal.ZERO
|
72
|
-
: this.currentZUSD.sub(change.withdrawZUSD);
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
return this.currentZUSD.add(change.depositZUSD);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
exports.StabilityDeposit = StabilityDeposit;
|
80
|
-
//# sourceMappingURL=StabilityDeposit.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"StabilityDeposit.js","sourceRoot":"","sources":["../../src/StabilityDeposit.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAWhD;;;;GAIG;AACH,MAAa,gBAAgB;IAsB3B,gBAAgB;IAChB,YACE,WAAoB,EACpB,WAAoB,EACpB,cAAuB,EACvB,UAAmB,EACnB,WAAmB;QAEnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;IACH,CAAC;IAED,IAAI,OAAO;QACT,OAAO,CACL,IAAI,CAAC,WAAW,CAAC,MAAM;YACvB,IAAI,CAAC,WAAW,CAAC,MAAM;YACvB,IAA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