@morpho-org/blue-sdk 3.0.0-next.10 → 3.0.0-next.11
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.
- package/lib/errors.d.ts +4 -0
- package/lib/errors.js +10 -1
- package/lib/position/Position.d.ts +13 -12
- package/lib/position/Position.js +43 -40
- package/lib/position/PreLiquidationPosition.d.ts +39 -60
- package/lib/position/PreLiquidationPosition.js +69 -125
- package/lib/preLiquidation.d.ts +15 -0
- package/lib/preLiquidation.js +85 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/errors.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export declare class UnsupportedChainIdError extends Error {
|
|
|
21
21
|
readonly chainId: number;
|
|
22
22
|
constructor(chainId: number);
|
|
23
23
|
}
|
|
24
|
+
export declare class UnsupportedPreLiquidationParamsError extends Error {
|
|
25
|
+
readonly lltv: bigint;
|
|
26
|
+
constructor(lltv: bigint);
|
|
27
|
+
}
|
|
24
28
|
export declare namespace BlueErrors {
|
|
25
29
|
class InvalidInterestAccrual extends Error {
|
|
26
30
|
readonly marketId: MarketId;
|
package/lib/errors.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlueErrors = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
|
|
3
|
+
exports.BlueErrors = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
|
|
4
4
|
exports._try = _try;
|
|
5
|
+
const viem_1 = require("viem");
|
|
5
6
|
class UnknownDataError extends Error {
|
|
6
7
|
}
|
|
7
8
|
exports.UnknownDataError = UnknownDataError;
|
|
@@ -45,6 +46,14 @@ class UnsupportedChainIdError extends Error {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
exports.UnsupportedChainIdError = UnsupportedChainIdError;
|
|
49
|
+
class UnsupportedPreLiquidationParamsError extends Error {
|
|
50
|
+
lltv;
|
|
51
|
+
constructor(lltv) {
|
|
52
|
+
super(`unsupported pre liquidation params for lltv ${(0, viem_1.formatUnits)(lltv, 16)}%`);
|
|
53
|
+
this.lltv = lltv;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.UnsupportedPreLiquidationParamsError = UnsupportedPreLiquidationParamsError;
|
|
48
57
|
var BlueErrors;
|
|
49
58
|
(function (BlueErrors) {
|
|
50
59
|
class InvalidInterestAccrual extends Error {
|
|
@@ -33,46 +33,47 @@ export declare class Position implements IPosition {
|
|
|
33
33
|
export interface IAccrualPosition extends Omit<IPosition, "marketId"> {
|
|
34
34
|
}
|
|
35
35
|
export declare class AccrualPosition extends Position implements IAccrualPosition {
|
|
36
|
+
protected readonly _market: Market;
|
|
37
|
+
constructor(position: IAccrualPosition, market: IMarket);
|
|
36
38
|
/**
|
|
37
39
|
* The market on which this position is held.
|
|
38
40
|
*/
|
|
39
|
-
|
|
40
|
-
constructor(position: IAccrualPosition, market: IMarket);
|
|
41
|
+
get market(): Market;
|
|
41
42
|
get supplyAssets(): bigint;
|
|
42
43
|
get borrowAssets(): bigint;
|
|
43
44
|
/**
|
|
44
45
|
* The value of this position's collateral quoted in loan assets.
|
|
45
|
-
* `undefined`
|
|
46
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
46
47
|
*/
|
|
47
48
|
get collateralValue(): bigint | undefined;
|
|
48
49
|
/**
|
|
49
50
|
* The maximum amount of loan assets that can be borrowed against this position's collateral.
|
|
50
|
-
* `undefined`
|
|
51
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
51
52
|
*/
|
|
52
53
|
get maxBorrowAssets(): bigint | undefined;
|
|
53
54
|
/**
|
|
54
55
|
* The maximum additional amount of assets that can be borrowed against this position's collateral.
|
|
55
|
-
* `undefined`
|
|
56
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
56
57
|
*/
|
|
57
58
|
get maxBorrowableAssets(): bigint | undefined;
|
|
58
59
|
/**
|
|
59
60
|
* The maximum amount of collateral that can be seized in exchange for the outstanding debt.
|
|
60
|
-
* `undefined`
|
|
61
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
61
62
|
*/
|
|
62
63
|
get seizableCollateral(): bigint | undefined;
|
|
63
64
|
/**
|
|
64
65
|
* The maximum amount of collateral that can be withdrawn.
|
|
65
|
-
* `undefined`
|
|
66
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
66
67
|
*/
|
|
67
68
|
get withdrawableCollateral(): bigint | undefined;
|
|
68
69
|
/**
|
|
69
70
|
* Whether this position is healthy.
|
|
70
|
-
* `undefined`
|
|
71
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
71
72
|
*/
|
|
72
73
|
get isHealthy(): boolean | undefined;
|
|
73
74
|
/**
|
|
74
75
|
* Whether this position can be liquidated.
|
|
75
|
-
* `undefined`
|
|
76
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
76
77
|
*/
|
|
77
78
|
get isLiquidatable(): boolean | undefined;
|
|
78
79
|
/**
|
|
@@ -83,20 +84,20 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
|
|
|
83
84
|
/**
|
|
84
85
|
* The price variation required for the position to reach its liquidation threshold (scaled by WAD).
|
|
85
86
|
* Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
|
|
86
|
-
* `undefined`
|
|
87
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
87
88
|
* `null` if the position is not a borrow.
|
|
88
89
|
*/
|
|
89
90
|
get priceVariationToLiquidationPrice(): bigint | null | undefined;
|
|
90
91
|
/**
|
|
91
92
|
* This position's Loan-To-Value (debt over collateral power, scaled by WAD).
|
|
92
93
|
* If the collateral price is 0, LTV is `MaxUint256`.
|
|
93
|
-
* `undefined`
|
|
94
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
94
95
|
*/
|
|
95
96
|
get ltv(): bigint | undefined;
|
|
96
97
|
/**
|
|
97
98
|
* This position's health factor (collateral power over debt, scaled by WAD).
|
|
98
99
|
* If the debt is 0, health factor is `MaxUint256`.
|
|
99
|
-
* `undefined`
|
|
100
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
100
101
|
*/
|
|
101
102
|
get healthFactor(): bigint | undefined;
|
|
102
103
|
/**
|
package/lib/position/Position.js
CHANGED
|
@@ -35,38 +35,41 @@ class Position {
|
|
|
35
35
|
}
|
|
36
36
|
exports.Position = Position;
|
|
37
37
|
class AccrualPosition extends Position {
|
|
38
|
-
|
|
39
|
-
* The market on which this position is held.
|
|
40
|
-
*/
|
|
41
|
-
market;
|
|
38
|
+
_market;
|
|
42
39
|
constructor(position, market) {
|
|
43
40
|
const _market = new index_js_1.Market(market);
|
|
44
41
|
super({ ...position, marketId: _market.id });
|
|
45
|
-
this.
|
|
42
|
+
this._market = _market;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The market on which this position is held.
|
|
46
|
+
*/
|
|
47
|
+
get market() {
|
|
48
|
+
return this._market;
|
|
46
49
|
}
|
|
47
50
|
get supplyAssets() {
|
|
48
|
-
return this.
|
|
51
|
+
return this._market.toSupplyAssets(this.supplyShares);
|
|
49
52
|
}
|
|
50
53
|
get borrowAssets() {
|
|
51
|
-
return this.
|
|
54
|
+
return this._market.toBorrowAssets(this.borrowShares);
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
57
|
* The value of this position's collateral quoted in loan assets.
|
|
55
|
-
* `undefined`
|
|
58
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
56
59
|
*/
|
|
57
60
|
get collateralValue() {
|
|
58
|
-
return this.
|
|
61
|
+
return this._market.getCollateralValue(this.collateral);
|
|
59
62
|
}
|
|
60
63
|
/**
|
|
61
64
|
* The maximum amount of loan assets that can be borrowed against this position's collateral.
|
|
62
|
-
* `undefined`
|
|
65
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
63
66
|
*/
|
|
64
67
|
get maxBorrowAssets() {
|
|
65
|
-
return this.
|
|
68
|
+
return this._market.getMaxBorrowAssets(this.collateral);
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
71
|
* The maximum additional amount of assets that can be borrowed against this position's collateral.
|
|
69
|
-
* `undefined`
|
|
72
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
70
73
|
*/
|
|
71
74
|
get maxBorrowableAssets() {
|
|
72
75
|
const { maxBorrowAssets } = this;
|
|
@@ -76,33 +79,33 @@ class AccrualPosition extends Position {
|
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* The maximum amount of collateral that can be seized in exchange for the outstanding debt.
|
|
79
|
-
* `undefined`
|
|
82
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
80
83
|
*/
|
|
81
84
|
get seizableCollateral() {
|
|
82
|
-
return this.
|
|
85
|
+
return this._market.getSeizableCollateral(this);
|
|
83
86
|
}
|
|
84
87
|
/**
|
|
85
88
|
* The maximum amount of collateral that can be withdrawn.
|
|
86
|
-
* `undefined`
|
|
89
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
87
90
|
*/
|
|
88
91
|
get withdrawableCollateral() {
|
|
89
|
-
return this.
|
|
92
|
+
return this._market.getWithdrawableCollateral(this);
|
|
90
93
|
}
|
|
91
94
|
/**
|
|
92
95
|
* Whether this position is healthy.
|
|
93
|
-
* `undefined`
|
|
96
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
94
97
|
*/
|
|
95
98
|
get isHealthy() {
|
|
96
|
-
return this.
|
|
99
|
+
return this._market.isHealthy(this);
|
|
97
100
|
}
|
|
98
101
|
/**
|
|
99
102
|
* Whether this position can be liquidated.
|
|
100
|
-
* `undefined`
|
|
103
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
101
104
|
*/
|
|
102
105
|
get isLiquidatable() {
|
|
103
|
-
const isHealthy = this.
|
|
106
|
+
const isHealthy = this._market.isHealthy(this);
|
|
104
107
|
if (isHealthy == null)
|
|
105
|
-
return
|
|
108
|
+
return;
|
|
106
109
|
return !isHealthy;
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
@@ -110,63 +113,63 @@ class AccrualPosition extends Position {
|
|
|
110
113
|
* `null` if the position has no borrow.
|
|
111
114
|
*/
|
|
112
115
|
get liquidationPrice() {
|
|
113
|
-
return this.
|
|
116
|
+
return this._market.getLiquidationPrice(this);
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
116
119
|
* The price variation required for the position to reach its liquidation threshold (scaled by WAD).
|
|
117
120
|
* Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
|
|
118
|
-
* `undefined`
|
|
121
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
119
122
|
* `null` if the position is not a borrow.
|
|
120
123
|
*/
|
|
121
124
|
get priceVariationToLiquidationPrice() {
|
|
122
|
-
return this.
|
|
125
|
+
return this._market.getPriceVariationToLiquidationPrice(this);
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
128
|
* This position's Loan-To-Value (debt over collateral power, scaled by WAD).
|
|
126
129
|
* If the collateral price is 0, LTV is `MaxUint256`.
|
|
127
|
-
* `undefined`
|
|
130
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
128
131
|
*/
|
|
129
132
|
get ltv() {
|
|
130
|
-
return this.
|
|
133
|
+
return this._market.getLtv(this);
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
136
|
* This position's health factor (collateral power over debt, scaled by WAD).
|
|
134
137
|
* If the debt is 0, health factor is `MaxUint256`.
|
|
135
|
-
* `undefined`
|
|
138
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
136
139
|
*/
|
|
137
140
|
get healthFactor() {
|
|
138
|
-
return this.
|
|
141
|
+
return this._market.getHealthFactor(this);
|
|
139
142
|
}
|
|
140
143
|
/**
|
|
141
144
|
* The percentage of this position's borrow power currently used (scaled by WAD).
|
|
142
145
|
* If the collateral price is 0, usage is `MaxUint256`.
|
|
143
146
|
*/
|
|
144
147
|
get borrowCapacityUsage() {
|
|
145
|
-
return this.
|
|
148
|
+
return this._market.getBorrowCapacityUsage(this);
|
|
146
149
|
}
|
|
147
150
|
/**
|
|
148
151
|
* Returns the maximum amount of loan assets that can be withdrawn given a certain supply position
|
|
149
152
|
* and a balance of loan assets, and the reason for the limit.
|
|
150
153
|
*/
|
|
151
154
|
get withdrawCapacityLimit() {
|
|
152
|
-
return this.
|
|
155
|
+
return this._market.getWithdrawCapacityLimit(this);
|
|
153
156
|
}
|
|
154
157
|
/**
|
|
155
158
|
* Returns a new position derived from this position, whose interest has been accrued up to the given timestamp.
|
|
156
159
|
* @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the market's `lastUpdate`.
|
|
157
160
|
*/
|
|
158
161
|
accrueInterest(timestamp) {
|
|
159
|
-
return new AccrualPosition(this, this.
|
|
162
|
+
return new AccrualPosition(this, this._market.accrueInterest(timestamp));
|
|
160
163
|
}
|
|
161
164
|
supply(assets, shares, timestamp) {
|
|
162
|
-
let { market } = this;
|
|
165
|
+
let { _market: market } = this;
|
|
163
166
|
({ market, assets, shares } = market.supply(assets, shares, timestamp));
|
|
164
167
|
const position = new AccrualPosition(this, market);
|
|
165
168
|
position.supplyShares += shares;
|
|
166
169
|
return { position, assets, shares };
|
|
167
170
|
}
|
|
168
171
|
withdraw(assets, shares, timestamp) {
|
|
169
|
-
let { market } = this;
|
|
172
|
+
let { _market: market } = this;
|
|
170
173
|
({ market, assets, shares } = market.withdraw(assets, shares, timestamp));
|
|
171
174
|
const position = new AccrualPosition(this, market);
|
|
172
175
|
position.supplyShares -= shares;
|
|
@@ -176,10 +179,10 @@ class AccrualPosition extends Position {
|
|
|
176
179
|
}
|
|
177
180
|
supplyCollateral(assets) {
|
|
178
181
|
this.collateral += assets;
|
|
179
|
-
return new AccrualPosition(this, new index_js_1.Market(this.
|
|
182
|
+
return new AccrualPosition(this, new index_js_1.Market(this._market));
|
|
180
183
|
}
|
|
181
184
|
withdrawCollateral(assets, timestamp) {
|
|
182
|
-
if (this.
|
|
185
|
+
if (this._market.price == null)
|
|
183
186
|
throw new errors_js_1.BlueErrors.UnknownOraclePrice(this.marketId);
|
|
184
187
|
const position = this.accrueInterest(timestamp);
|
|
185
188
|
position.collateral -= assets;
|
|
@@ -190,7 +193,7 @@ class AccrualPosition extends Position {
|
|
|
190
193
|
return position;
|
|
191
194
|
}
|
|
192
195
|
borrow(assets, shares, timestamp) {
|
|
193
|
-
let { market } = this;
|
|
196
|
+
let { _market: market } = this;
|
|
194
197
|
if (market.price == null)
|
|
195
198
|
throw new errors_js_1.BlueErrors.UnknownOraclePrice(market.id);
|
|
196
199
|
({ market, assets, shares } = market.borrow(assets, shares, timestamp));
|
|
@@ -201,7 +204,7 @@ class AccrualPosition extends Position {
|
|
|
201
204
|
return { position, assets, shares };
|
|
202
205
|
}
|
|
203
206
|
repay(assets, shares, timestamp) {
|
|
204
|
-
let { market } = this;
|
|
207
|
+
let { _market: market } = this;
|
|
205
208
|
({ market, assets, shares } = market.repay(assets, shares, timestamp));
|
|
206
209
|
const position = new AccrualPosition(this, market);
|
|
207
210
|
position.borrowShares -= shares;
|
|
@@ -210,13 +213,13 @@ class AccrualPosition extends Position {
|
|
|
210
213
|
return { position, assets, shares };
|
|
211
214
|
}
|
|
212
215
|
getBorrowCapacityLimit(options) {
|
|
213
|
-
return this.
|
|
216
|
+
return this._market.getBorrowCapacityLimit(this, options);
|
|
214
217
|
}
|
|
215
218
|
getWithdrawCollateralCapacityLimit(options) {
|
|
216
|
-
return this.
|
|
219
|
+
return this._market.getWithdrawCollateralCapacityLimit(this, options);
|
|
217
220
|
}
|
|
218
221
|
getRepayCapacityLimit(loanTokenBalance) {
|
|
219
|
-
return this.
|
|
222
|
+
return this._market.getRepayCapacityLimit(this.borrowShares, loanTokenBalance);
|
|
220
223
|
}
|
|
221
224
|
getMaxCapacities(loanTokenBalance, collateralTokenBalance, options) {
|
|
222
225
|
return {
|
|
@@ -1,81 +1,60 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import { type
|
|
2
|
+
import { type IMarket, Market } from "../market";
|
|
3
|
+
import type { BigIntish } from "../types";
|
|
3
4
|
import { AccrualPosition, type IAccrualPosition } from "./Position";
|
|
4
|
-
export interface
|
|
5
|
-
preLltv:
|
|
6
|
-
preLCF1:
|
|
7
|
-
preLCF2:
|
|
8
|
-
preLIF1:
|
|
9
|
-
preLIF2:
|
|
5
|
+
export interface IPreLiquidationParams {
|
|
6
|
+
preLltv: BigIntish;
|
|
7
|
+
preLCF1: BigIntish;
|
|
8
|
+
preLCF2: BigIntish;
|
|
9
|
+
preLIF1: BigIntish;
|
|
10
|
+
preLIF2: BigIntish;
|
|
10
11
|
preLiquidationOracle: Address;
|
|
11
12
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export declare class PreLiquidationParams implements IPreLiquidationParams {
|
|
14
|
+
readonly preLltv: bigint;
|
|
15
|
+
readonly preLCF1: bigint;
|
|
16
|
+
readonly preLCF2: bigint;
|
|
17
|
+
readonly preLIF1: bigint;
|
|
18
|
+
readonly preLIF2: bigint;
|
|
19
|
+
readonly preLiquidationOracle: `0x${string}`;
|
|
20
|
+
constructor({ preLltv, preLCF1, preLCF2, preLIF1, preLIF2, preLiquidationOracle, }: IPreLiquidationParams);
|
|
21
|
+
getCloseFactor(quotient: BigIntish): bigint;
|
|
22
|
+
getIncentiveFactor(quotient: BigIntish): bigint;
|
|
16
23
|
}
|
|
17
|
-
export
|
|
24
|
+
export interface IPreLiquidationPosition extends IAccrualPosition {
|
|
18
25
|
/**
|
|
19
26
|
* The pre-liquidation parameters of the associated PreLiquidation contract.
|
|
20
27
|
*/
|
|
21
|
-
|
|
28
|
+
preLiquidationParams: IPreLiquidationParams;
|
|
22
29
|
/**
|
|
23
30
|
* The address of the PreLiquidation contract this position is associated to.
|
|
24
31
|
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Whether the PreLiquidation contract is authorized to manage this position.
|
|
28
|
-
*/
|
|
29
|
-
readonly isPreLiquidationAuthorized: boolean;
|
|
30
|
-
constructor(position: IPreLiquidationPosition, market: Market);
|
|
32
|
+
preLiquidation: Address;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
* `undefined`
|
|
34
|
+
* The price of the collateral quoted in loan assets used by the PreLiquidation contract.
|
|
35
|
+
* `undefined` if the oracle reverts.
|
|
34
36
|
*/
|
|
35
|
-
|
|
37
|
+
preLiquidationOraclePrice?: BigIntish;
|
|
38
|
+
}
|
|
39
|
+
export declare class PreLiquidationPosition extends AccrualPosition implements IPreLiquidationPosition {
|
|
40
|
+
readonly preLiquidationParams: PreLiquidationParams;
|
|
41
|
+
readonly preLiquidation: `0x${string}`;
|
|
42
|
+
readonly preLiquidationOraclePrice?: bigint;
|
|
43
|
+
protected readonly _baseMarket: Market;
|
|
44
|
+
constructor({ preLiquidationParams, preLiquidation, preLiquidationOraclePrice, ...position }: IPreLiquidationPosition, market: IMarket);
|
|
45
|
+
get market(): Market;
|
|
46
|
+
protected get _lltv(): bigint;
|
|
36
47
|
/**
|
|
37
|
-
*
|
|
38
|
-
* `undefined`
|
|
48
|
+
* @inheritdoc `undefined` if the pre-liquidation's oracle reverts.
|
|
49
|
+
* `undefined` if it may be liquidatable on Morpho.
|
|
39
50
|
*/
|
|
40
51
|
get isHealthy(): boolean | undefined;
|
|
41
52
|
/**
|
|
42
|
-
*
|
|
43
|
-
* `null` if the position has no borrow.
|
|
44
|
-
*/
|
|
45
|
-
get preLiquidationPrice(): bigint | null;
|
|
46
|
-
/**
|
|
47
|
-
* The price variation required for the position to reach its pre-liquidation threshold (scaled by WAD).
|
|
48
|
-
* Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
|
|
49
|
-
* `undefined` iff the market's oracle is undefined or reverts.
|
|
50
|
-
* `null` if the position is not a borrow.
|
|
51
|
-
*/
|
|
52
|
-
get priceVariationToLiquidationPrice(): bigint | null | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* The maximum amount of loan assets that can be borrowed against this position's collateral.
|
|
55
|
-
* `undefined` iff the market's oracle is undefined or reverts.
|
|
56
|
-
*/
|
|
57
|
-
get maxBorrowAssets(): bigint | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* The maximum amount of collateral that can be withdrawn.
|
|
60
|
-
* `undefined` iff the market's oracle is undefined or reverts.
|
|
61
|
-
*/
|
|
62
|
-
get withdrawableCollateral(): bigint | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* The maximum amount of collateral that can be seized in exchange for the outstanding debt in the context of pre-liquidation.
|
|
65
|
-
* `undefined` iff the market's oracle is undefined or reverts.
|
|
66
|
-
*/
|
|
67
|
-
get preSeizableCollateral(): bigint | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* This position's pre health factor (collateral power over debt, scaled by WAD).
|
|
70
|
-
* If the debt is 0, health factor is `MaxUint256`.
|
|
71
|
-
* `undefined` iff the market's oracle is undefined or reverts.
|
|
53
|
+
* @inheritdoc `undefined` if the pre-liquidation's oracle reverts.
|
|
72
54
|
*/
|
|
73
|
-
get
|
|
55
|
+
get isLiquidatable(): boolean | undefined;
|
|
74
56
|
/**
|
|
75
|
-
*
|
|
76
|
-
* If the collateral price is 0, usage is `MaxUint256`.
|
|
57
|
+
* @inheritdoc `undefined` if the pre-liquidation's oracle reverts.
|
|
77
58
|
*/
|
|
78
|
-
get
|
|
79
|
-
getBorrowCapacityLimit(options?: MaxBorrowOptions): import("../market").CapacityLimit | undefined;
|
|
80
|
-
getWithdrawCollateralCapacityLimit(options?: MaxWithdrawCollateralOptions): import("../market").CapacityLimit | undefined;
|
|
59
|
+
get seizableCollateral(): bigint | undefined;
|
|
81
60
|
}
|