@gearbox-protocol/sdk 15.1.0-next.5 → 15.1.0-next.7
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/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/model/positions.schema.js +13 -0
- package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/cjs/preview/preview/previewOperation.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +0 -6
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
- package/dist/cjs/sdk/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
- package/dist/cjs/sdk/index.js +21 -5
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +1 -12
- package/dist/cjs/sdk/market/credit/CreditSuite.js +17 -26
- package/dist/cjs/sdk/market/credit/index.js +3 -0
- package/dist/cjs/sdk/market/credit/isStrategyCollateral.js +50 -0
- package/dist/cjs/sdk/market/index.js +17 -0
- package/dist/cjs/sdk/market/math.js +57 -44
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/cjs/sdk/opportunities/index.js +0 -13
- package/dist/cjs/sdk/positions/PositionsService.js +206 -1
- package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
- package/dist/cjs/sdk/positions/calcHealthFactor.js +44 -0
- package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
- package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
- package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +18 -0
- package/dist/cjs/sdk/positions/index.js +12 -1
- package/dist/cjs/sdk/positions/types.js +31 -0
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/model/positions.schema.js +14 -2
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/preview/CreditAccountState.js +14 -1
- package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/esm/preview/preview/previewOperation.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -8
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
- package/dist/esm/sdk/accounts/intents/utils/index.js +2 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +3 -3
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +9 -2
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +2 -13
- package/dist/esm/sdk/market/credit/CreditSuite.js +18 -27
- package/dist/esm/sdk/market/credit/index.js +2 -1
- package/dist/esm/sdk/market/credit/isStrategyCollateral.js +48 -0
- package/dist/esm/sdk/market/index.js +3 -1
- package/dist/esm/sdk/market/math.js +52 -40
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +3 -3
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/opportunities/index.js +1 -2
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/positions/PositionsService.js +206 -1
- package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
- package/dist/esm/sdk/positions/calcHealthFactor.js +43 -0
- package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
- package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
- package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +17 -0
- package/dist/esm/sdk/positions/index.js +7 -2
- package/dist/esm/sdk/positions/types.js +31 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
- package/dist/types/model/index.d.ts +3 -3
- package/dist/types/model/opportunities.d.ts +9 -9
- package/dist/types/model/positions.d.ts +87 -4
- package/dist/types/model/positions.schema.d.ts +26 -1
- package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
- package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
- package/dist/types/preview/preview/types.d.ts +4 -2
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
- package/dist/types/sdk/accounts/index.d.ts +2 -2
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +6 -0
- package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/utils/index.d.ts +2 -1
- package/dist/types/sdk/accounts/types.d.ts +1 -12
- package/dist/types/sdk/index.d.ts +10 -4
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +0 -4
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -16
- package/dist/types/sdk/market/credit/index.d.ts +2 -1
- package/dist/types/sdk/market/credit/isStrategyCollateral.d.ts +74 -0
- package/dist/types/sdk/market/credit/types.d.ts +2 -9
- package/dist/types/sdk/market/index.d.ts +3 -1
- package/dist/types/sdk/market/math.d.ts +44 -34
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +4 -0
- package/dist/types/sdk/market/oracle/types.d.ts +8 -0
- package/dist/types/sdk/opportunities/index.d.ts +1 -2
- package/dist/types/sdk/positions/PositionsService.d.ts +31 -2
- package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
- package/dist/types/sdk/positions/calcHealthFactor.d.ts +45 -0
- package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
- package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
- package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +15 -0
- package/dist/types/sdk/positions/index.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +58 -1
- package/package.json +1 -1
|
@@ -131,6 +131,67 @@ interface PoolPosition {
|
|
|
131
131
|
**/
|
|
132
132
|
pnl?: PnlBreakdown;
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Cost of a position's debt broken down by source.
|
|
136
|
+
*
|
|
137
|
+
* The base rate is what the pool charges on the debt; each quoted collateral
|
|
138
|
+
* adds its own quota rate on top. Rates are reported in two normalizations:
|
|
139
|
+
* relative to the position's total value and relative to its debt.
|
|
140
|
+
**/
|
|
141
|
+
interface BorrowRateBreakdown {
|
|
142
|
+
/**
|
|
143
|
+
* Base rate plus quota rates, relative to the position's total value.
|
|
144
|
+
**/
|
|
145
|
+
total: Bps;
|
|
146
|
+
/**
|
|
147
|
+
* Base rate plus quota rates, relative to the debt. This is the rate the
|
|
148
|
+
* debt itself grows at, so it feeds {@link PositionMetrics.timeToLiquidation}.
|
|
149
|
+
**/
|
|
150
|
+
totalOnDebt: Bps;
|
|
151
|
+
/**
|
|
152
|
+
* Annual cost of the borrowed underlying itself: the pool's base rate plus
|
|
153
|
+
* the credit manager's interest fee. Same value `borrowApy` reports.
|
|
154
|
+
**/
|
|
155
|
+
base: Bps;
|
|
156
|
+
/**
|
|
157
|
+
* Per-token quota rate contribution, relative to the position's total value.
|
|
158
|
+
**/
|
|
159
|
+
quotas: Record<Address, Bps>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Health and cost metrics of a credit account's state, actual or projected.
|
|
163
|
+
*
|
|
164
|
+
* Previews and operation states carry the whole group; on-chain positions
|
|
165
|
+
* report only the fields they lack natively, see {@link StrategyPosition}.
|
|
166
|
+
**/
|
|
167
|
+
interface PositionMetrics {
|
|
168
|
+
/**
|
|
169
|
+
* Health factor in basis points: below `10000` the account is liquidatable.
|
|
170
|
+
*
|
|
171
|
+
* @example `12500` for a health factor of 1.25
|
|
172
|
+
**/
|
|
173
|
+
healthFactor: Bps;
|
|
174
|
+
/**
|
|
175
|
+
* Net rate the whole position earns, collateral yield minus borrow cost.
|
|
176
|
+
**/
|
|
177
|
+
overallApy: Bps;
|
|
178
|
+
/**
|
|
179
|
+
* Cost of the debt, broken down by source.
|
|
180
|
+
**/
|
|
181
|
+
borrowRate: BorrowRateBreakdown;
|
|
182
|
+
/**
|
|
183
|
+
* Estimated milliseconds until the health factor decays to `10000` under
|
|
184
|
+
* the current borrow rate, or `null` when the debt carries no rate (or the
|
|
185
|
+
* account is already liquidatable).
|
|
186
|
+
**/
|
|
187
|
+
timeToLiquidation: bigint | null;
|
|
188
|
+
/**
|
|
189
|
+
* Price of the single non-underlying collateral at which the account
|
|
190
|
+
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
191
|
+
* when the account holds zero or several non-underlying assets.
|
|
192
|
+
**/
|
|
193
|
+
liquidationPrice: bigint | null;
|
|
194
|
+
}
|
|
134
195
|
/**
|
|
135
196
|
* An open credit account of a wallet.
|
|
136
197
|
**/
|
|
@@ -163,9 +224,9 @@ interface StrategyPosition {
|
|
|
163
224
|
**/
|
|
164
225
|
targetCollateral: Token | null;
|
|
165
226
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
227
|
+
* Total-value leverage: `totalValue / (totalValue − totalDebt)`. `1` =
|
|
228
|
+
* unleveraged; `0` if underwater. Same notation as opportunity `maxLeverage`,
|
|
229
|
+
* and bounded by it.
|
|
169
230
|
**/
|
|
170
231
|
leverage: Leverage;
|
|
171
232
|
/**
|
|
@@ -200,6 +261,28 @@ interface StrategyPosition {
|
|
|
200
261
|
* @example `12500` for a health factor of 1.25
|
|
201
262
|
**/
|
|
202
263
|
healthFactor: Bps;
|
|
264
|
+
/**
|
|
265
|
+
* Cost of the debt broken down into the pool's base rate and per-token
|
|
266
|
+
* quota rates.
|
|
267
|
+
*
|
|
268
|
+
* @mode onchain
|
|
269
|
+
**/
|
|
270
|
+
borrowRate?: BorrowRateBreakdown;
|
|
271
|
+
/**
|
|
272
|
+
* Estimated milliseconds until the health factor decays to `10000` under
|
|
273
|
+
* the current borrow rate, or `null` when it cannot be estimated.
|
|
274
|
+
*
|
|
275
|
+
* @mode onchain
|
|
276
|
+
**/
|
|
277
|
+
timeToLiquidation?: bigint | null;
|
|
278
|
+
/**
|
|
279
|
+
* Price of the single non-underlying collateral at which the account
|
|
280
|
+
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
281
|
+
* when the account holds zero or several non-underlying assets.
|
|
282
|
+
*
|
|
283
|
+
* @mode onchain
|
|
284
|
+
**/
|
|
285
|
+
liquidationPrice?: bigint | null;
|
|
203
286
|
/**
|
|
204
287
|
* What the position has earned so far.
|
|
205
288
|
*
|
|
@@ -343,4 +426,4 @@ interface StrategyPositionRef extends StrategyPositionKey {
|
|
|
343
426
|
**/
|
|
344
427
|
type PositionKey = PoolPositionRef | StrategyPositionRef;
|
|
345
428
|
//#endregion
|
|
346
|
-
export { PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };
|
|
429
|
+
export { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };
|
|
@@ -255,6 +255,15 @@ declare const poolPositionSchema: z.ZodObject<{
|
|
|
255
255
|
}, z.core.$strip>], "kind">>;
|
|
256
256
|
}, z.core.$strip>>;
|
|
257
257
|
}, z.core.$strip>;
|
|
258
|
+
/**
|
|
259
|
+
* {@link BorrowRateBreakdown}
|
|
260
|
+
**/
|
|
261
|
+
declare const borrowRateBreakdownSchema: z.ZodObject<{
|
|
262
|
+
total: z.ZodNumber;
|
|
263
|
+
totalOnDebt: z.ZodNumber;
|
|
264
|
+
base: z.ZodNumber;
|
|
265
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
266
|
+
}, z.core.$strip>;
|
|
258
267
|
/**
|
|
259
268
|
* {@link StrategyPosition}
|
|
260
269
|
**/
|
|
@@ -323,6 +332,14 @@ declare const strategyPositionSchema: z.ZodObject<{
|
|
|
323
332
|
}, z.core.$strip>;
|
|
324
333
|
}, z.core.$strip>;
|
|
325
334
|
healthFactor: z.ZodNumber;
|
|
335
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
336
|
+
total: z.ZodNumber;
|
|
337
|
+
totalOnDebt: z.ZodNumber;
|
|
338
|
+
base: z.ZodNumber;
|
|
339
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
340
|
+
}, z.core.$strip>>;
|
|
341
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
342
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
326
343
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
327
344
|
organic: z.ZodObject<{
|
|
328
345
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -568,6 +585,14 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
568
585
|
}, z.core.$strip>;
|
|
569
586
|
}, z.core.$strip>;
|
|
570
587
|
healthFactor: z.ZodNumber;
|
|
588
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
589
|
+
total: z.ZodNumber;
|
|
590
|
+
totalOnDebt: z.ZodNumber;
|
|
591
|
+
base: z.ZodNumber;
|
|
592
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
593
|
+
}, z.core.$strip>>;
|
|
594
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
595
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
571
596
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
572
597
|
organic: z.ZodObject<{
|
|
573
598
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -756,4 +781,4 @@ declare const positionKeySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
756
781
|
kind: z.ZodLiteral<"strategy">;
|
|
757
782
|
}, z.core.$strip>], "kind">;
|
|
758
783
|
//#endregion
|
|
759
|
-
export { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
784
|
+
export { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CreditAccountData } from "../../sdk/base/types.js";
|
|
2
2
|
import { AssetsMap } from "../../sdk/utils/AssetsMap.js";
|
|
3
|
+
import { AccountSnapshot } from "../../sdk/positions/types.js";
|
|
3
4
|
import "../../sdk/index.js";
|
|
4
5
|
import { Address } from "viem";
|
|
5
6
|
//#region src/preview/preview/CreditAccountState.d.ts
|
|
@@ -60,6 +61,11 @@ declare class CreditAccountState {
|
|
|
60
61
|
* balances and quotas (≤ 1 wei) filtered out.
|
|
61
62
|
*/
|
|
62
63
|
static fromCreditAccountData(ca: CreditAccountData): CreditAccountState;
|
|
64
|
+
/**
|
|
65
|
+
* Immutable snapshot of this projected state for `sdk.positions` metric
|
|
66
|
+
* methods: dust-filtered balances, all quotas, and {@link totalDebt}.
|
|
67
|
+
**/
|
|
68
|
+
toSnapshot(totalValue: bigint): AccountSnapshot;
|
|
63
69
|
clone(): CreditAccountState;
|
|
64
70
|
/**
|
|
65
71
|
* Borrows `amount` of underlying: debt, total debt and the underlying
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OnchainSDK } from "../../sdk/OnchainSDK.js";
|
|
2
|
+
import "../../sdk/index.js";
|
|
1
3
|
import { CreditAccountState } from "./CreditAccountState.js";
|
|
2
4
|
import { DetectedDelayedOperation } from "./detectDelayedOperation.js";
|
|
3
5
|
import { InstantOperationPreview } from "./types.js";
|
|
@@ -26,7 +28,9 @@ type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
|
|
|
26
28
|
* @param receivedToken - Token the `CLOSE_ACCOUNT` resume withdraws to the
|
|
27
29
|
* user: the unwrapped underlying (vault asset) for RWA markets, the
|
|
28
30
|
* underlying itself otherwise.
|
|
31
|
+
* @param sdk - Market data source for the position metrics of the resulting
|
|
32
|
+
* state; read synchronously, no network access.
|
|
29
33
|
*/
|
|
30
|
-
declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address): InstantOperationPreview;
|
|
34
|
+
declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address, sdk: OnchainSDK): InstantOperationPreview;
|
|
31
35
|
//#endregion
|
|
32
36
|
export { ConvertFn, buildDelayedPreview };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DelayedIntent } from "../../sdk/accounts/withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset } from "../../sdk/base/types.js";
|
|
3
|
+
import { PositionMetrics } from "../../model/positions.js";
|
|
4
|
+
import "../../model/index.js";
|
|
3
5
|
import "../../sdk/index.js";
|
|
4
6
|
import { PoolOperationType } from "../parse/types-pools.js";
|
|
5
7
|
import "../parse/index.js";
|
|
@@ -89,7 +91,7 @@ interface PoolOperationPreview {
|
|
|
89
91
|
*/
|
|
90
92
|
error?: OperationPreviewError;
|
|
91
93
|
}
|
|
92
|
-
interface OpenCreditAccountPreview {
|
|
94
|
+
interface OpenCreditAccountPreview extends PositionMetrics {
|
|
93
95
|
operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
|
|
94
96
|
/**
|
|
95
97
|
* Credit manager the account is opened in
|
|
@@ -132,7 +134,7 @@ interface OpenCreditAccountPreview {
|
|
|
132
134
|
*/
|
|
133
135
|
error?: OperationPreviewError;
|
|
134
136
|
}
|
|
135
|
-
interface AdjustCreditAccountPreview {
|
|
137
|
+
interface AdjustCreditAccountPreview extends PositionMetrics {
|
|
136
138
|
operation: "AdjustCreditAccount";
|
|
137
139
|
/**
|
|
138
140
|
* Credit manager the account is opened in
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
|
|
3
|
-
import { StrategyPosition } from "../../model/positions.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
3
|
import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements } from "../market/rwa/types.js";
|
|
6
4
|
import "../market/rwa/index.js";
|
|
7
5
|
import { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
@@ -14,7 +12,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
|
|
|
14
12
|
import "../types/index.js";
|
|
15
13
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
16
14
|
import "../base/index.js";
|
|
17
|
-
import { GetCreditAccountsOptions
|
|
15
|
+
import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
18
16
|
import "./credit-account-compressor/index.js";
|
|
19
17
|
import "./withdrawal-compressor/index.js";
|
|
20
18
|
import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
|
|
@@ -50,10 +48,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
|
|
|
50
48
|
* {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
|
|
51
49
|
**/
|
|
52
50
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
53
|
-
/**
|
|
54
|
-
* {@inheritDoc ICreditAccountsService.listPositions}
|
|
55
|
-
**/
|
|
56
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
57
51
|
/**
|
|
58
52
|
* {@inheritDoc ICreditAccountsService.getRewards}
|
|
59
53
|
**/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { CreditAccountData } from "../../base/types.js";
|
|
2
|
-
import { StrategyPosition } from "../../../model/positions.js";
|
|
3
|
-
import "../../../model/index.js";
|
|
4
2
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
5
3
|
import "../../base/index.js";
|
|
6
|
-
import { GetCreditAccountsOptions
|
|
4
|
+
import { GetCreditAccountsOptions } from "./types.js";
|
|
7
5
|
import { Address } from "viem";
|
|
8
6
|
//#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts
|
|
9
7
|
/**
|
|
10
8
|
* Reads credit accounts of the current chain.
|
|
11
9
|
*
|
|
12
10
|
* Stitches the credit account compressor together with the RWA factories (for
|
|
13
|
-
* accounts owned via an investor EOA) and
|
|
14
|
-
*
|
|
15
|
-
* either as raw account data or as {@link StrategyPosition}s.
|
|
11
|
+
* accounts owned via an investor EOA), and describes the result as raw
|
|
12
|
+
* account data.
|
|
16
13
|
*
|
|
17
14
|
* TODO: create and deploy new compressor contract onchain to avoid all this stitching
|
|
18
15
|
**/
|
|
@@ -49,12 +46,6 @@ declare class CreditAccountCompressor extends SDKConstruct {
|
|
|
49
46
|
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
50
47
|
**/
|
|
51
48
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData<true>[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Describes all credit accounts of a wallet as strategy positions.
|
|
54
|
-
*
|
|
55
|
-
* @param props - {@link ListStrategyPositionsProps}
|
|
56
|
-
**/
|
|
57
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
58
49
|
}
|
|
59
50
|
//#endregion
|
|
60
51
|
export { CreditAccountCompressor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
1
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./types.js";
|
|
2
2
|
import { CreditAccountCompressor } from "./CreditAccountCompressor.js";
|
|
3
3
|
import { CreditAccountCompressorV310Contract } from "./CreditAccountCompressorV310Contract.js";
|
|
4
|
-
export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
4
|
+
export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
|
|
@@ -146,23 +146,5 @@ interface GetCreditAccountsOptions {
|
|
|
146
146
|
**/
|
|
147
147
|
ignoreReservePrices?: boolean;
|
|
148
148
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Props for {@link CreditAccountCompressor.listPositions}.
|
|
151
|
-
**/
|
|
152
|
-
interface ListStrategyPositionsProps {
|
|
153
|
-
/**
|
|
154
|
-
* Wallet whose credit accounts to describe. RWA accounts are resolved from
|
|
155
|
-
* the investor EOA, see {@link CreditAccountCompressor.getBorrowerCreditAccounts}.
|
|
156
|
-
**/
|
|
157
|
-
owner: Address;
|
|
158
|
-
/**
|
|
159
|
-
* Whether to include accounts that carry no debt.
|
|
160
|
-
**/
|
|
161
|
-
includeZeroDebt: boolean;
|
|
162
|
-
/**
|
|
163
|
-
* Block to read at. Defaults to the latest block.
|
|
164
|
-
**/
|
|
165
|
-
blockNumber?: bigint;
|
|
166
|
-
}
|
|
167
149
|
//#endregion
|
|
168
|
-
export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
150
|
+
export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
|
|
2
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
2
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
3
3
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
4
4
|
import { CreditAccountCompressorV310Contract } from "./credit-account-compressor/CreditAccountCompressorV310Contract.js";
|
|
5
5
|
import "./credit-account-compressor/index.js";
|
|
@@ -28,4 +28,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
|
|
|
28
28
|
import { LiquidationsService } from "./liquidations/LiquidationsService.js";
|
|
29
29
|
import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
|
|
30
30
|
import "./liquidations/index.js";
|
|
31
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService,
|
|
31
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -62,6 +62,12 @@ interface BuildMockSdkArgs {
|
|
|
62
62
|
quotas: Record<Address, MockQuotaEntry>;
|
|
63
63
|
liquidationThresholds: Record<Address, number>;
|
|
64
64
|
maxDebt: bigint;
|
|
65
|
+
/** Facade `minDebt`; defaults to 0n so debt-range checks stay opt-in. */
|
|
66
|
+
minDebt?: bigint;
|
|
67
|
+
/** Pool base rate in ray; feeds `calcBorrowApy` of position metrics. */
|
|
68
|
+
baseInterestRate?: bigint;
|
|
69
|
+
/** Credit manager interest fee in Bps; feeds position metrics. */
|
|
70
|
+
feeInterest?: number;
|
|
65
71
|
creditManager: Address;
|
|
66
72
|
creditFacade: Address;
|
|
67
73
|
/** Market underlying token (`market.pool.underlying`). */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AccountSnapshot } from "../../../positions/types.js";
|
|
2
|
+
import "../../../positions/index.js";
|
|
3
|
+
import { AdjustState } from "../types.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Maps an intents {@link AdjustState} onto the {@link AccountSnapshot} that
|
|
8
|
+
* position-metric functions take. `accountDebt` is treated as total debt
|
|
9
|
+
* (principal plus accrued interest and fees).
|
|
10
|
+
**/
|
|
11
|
+
declare function adjustStateToSnapshot(creditManager: Address, state: AdjustState): AccountSnapshot;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { adjustStateToSnapshot };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { adjustStateToSnapshot } from "./adjust-state-to-snapshot.js";
|
|
1
2
|
import { assembleOperationCalls } from "./assemble-operation-calls.js";
|
|
2
3
|
import { calcBorrowedAmountPlusInterestAndFees } from "./borrowed-amount-plus-interest-and-fees.js";
|
|
3
4
|
import { eq, toRouterCaSlice, toTargetDecimals } from "./common.js";
|
|
@@ -6,4 +7,4 @@ import { ConvertFn, simulateOperationAssets } from "./simulate-assets.js";
|
|
|
6
7
|
import { getQuotasForUpdate } from "./quotas-for-update.js";
|
|
7
8
|
import { SimulateStateReturn, simulateState } from "./simulate-adjust-state.js";
|
|
8
9
|
import { getOperationsWithQuotaUpdate } from "./with-quota-update.js";
|
|
9
|
-
export { ConvertFn, SimulateStateReturn, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
|
|
10
|
+
export { ConvertFn, SimulateStateReturn, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
|
|
3
|
-
import { StrategyPosition } from "../../model/positions.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
3
|
import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
|
|
6
4
|
import "../market/rwa/index.js";
|
|
7
5
|
import { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
@@ -15,7 +13,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
|
|
|
15
13
|
import { Construct } from "../base/Construct.js";
|
|
16
14
|
import "../types/index.js";
|
|
17
15
|
import "../base/index.js";
|
|
18
|
-
import { GetCreditAccountsOptions
|
|
16
|
+
import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
19
17
|
import "./credit-account-compressor/index.js";
|
|
20
18
|
import "./withdrawal-compressor/index.js";
|
|
21
19
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
@@ -404,15 +402,6 @@ interface ICreditAccountsService extends Construct {
|
|
|
404
402
|
* @returns Credit accounts (with investor) sorted by health factor ascending
|
|
405
403
|
*/
|
|
406
404
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
407
|
-
/**
|
|
408
|
-
* Describes the open credit accounts of a wallet as the shared read model's
|
|
409
|
-
* strategy positions.
|
|
410
|
-
*
|
|
411
|
-
* @param props - {@link ListStrategyPositionsProps}
|
|
412
|
-
* @returns One row per open account. Accounts whose collateral computation
|
|
413
|
-
* failed are excluded, because none of their amounts can be computed.
|
|
414
|
-
*/
|
|
415
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
416
405
|
/**
|
|
417
406
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
|
|
418
407
|
* Associates rewards by adapter + stakedPhantomToken.
|
|
@@ -94,6 +94,7 @@ import { MarketSuite, StrategyRef } from "./market/MarketSuite.js";
|
|
|
94
94
|
import { CreditSuite } from "./market/credit/CreditSuite.js";
|
|
95
95
|
import { dominantCollateral, mustGetDominantCollateral } from "./market/credit/dominantCollateral.js";
|
|
96
96
|
import { ExpectedBalanceDeltasProps, ExpectedOutput, expectedBalanceDeltas } from "./market/credit/expectedBalanceDeltas.js";
|
|
97
|
+
import { IsStrategyCollateralProps, NON_STRATEGY_PHANTOM_TOKEN_TYPES, isStrategyCollateral } from "./market/credit/isStrategyCollateral.js";
|
|
97
98
|
import { CompressorZapperData, ZapperData } from "./market/types.js";
|
|
98
99
|
import { IZapperContract, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem } from "./market/zapper/types.js";
|
|
99
100
|
import { createZapper } from "./market/zapper/createZapper.js";
|
|
@@ -102,8 +103,8 @@ import { ZapperContract } from "./market/zapper/ZapperContract.js";
|
|
|
102
103
|
import { IERC20ZapperContract } from "./market/zapper/IERC20ZapperContract.js";
|
|
103
104
|
import { IETHZapperContract } from "./market/zapper/IETHZapperContract.js";
|
|
104
105
|
import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./market/MarketRegister.js";
|
|
106
|
+
import { MAX_LEVERAGE_BUFFER_BPS, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./market/math.js";
|
|
105
107
|
import "./market/index.js";
|
|
106
|
-
import { OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "./market/math.js";
|
|
107
108
|
import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
|
|
108
109
|
import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
|
|
109
110
|
import "./opportunities/index.js";
|
|
@@ -111,7 +112,12 @@ import { ContractMethod, IPriceUpdateTx, MultiCall, RawTx } from "./types/transa
|
|
|
111
112
|
import { AddLiquidityProps, DepositMetadata, IPoolsService, ListPoolPositionsProps, MarketType, PoolServiceCall, PoolServiceCallResult, RemoveLiquidityProps, WithdrawalMetadata } from "./pools/types.js";
|
|
112
113
|
import { PoolService } from "./pools/PoolService.js";
|
|
113
114
|
import "./pools/index.js";
|
|
114
|
-
import { ListPositionsProps, ListPositionsPropsBase } from "./positions/types.js";
|
|
115
|
+
import { AccountSnapshot, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, accountSnapshotFromCreditAccountData } from "./positions/types.js";
|
|
116
|
+
import { CalcBorrowRateProps, calcBorrowRate } from "./positions/calcBorrowRate.js";
|
|
117
|
+
import { CalcHealthFactorProps, calcHealthFactor } from "./positions/calcHealthFactor.js";
|
|
118
|
+
import { CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, calcLiquidationPriceForTarget } from "./positions/calcLiquidationPriceForTarget.js";
|
|
119
|
+
import { calcLiquidationPrice } from "./positions/calcLiquidationPrice.js";
|
|
120
|
+
import { calcTimeToLiquidationMs } from "./positions/calcTimeToLiquidationMs.js";
|
|
115
121
|
import { MultichainPositionsService } from "./positions/MultichainPositionsService.js";
|
|
116
122
|
import { PositionsService } from "./positions/PositionsService.js";
|
|
117
123
|
import "./positions/index.js";
|
|
@@ -145,7 +151,7 @@ import { ChainBlock, ChainBlockPin, ChainBlockSource, ChainQueryOneProps, ChainQ
|
|
|
145
151
|
import { PlaceholderContract } from "./base/PlaceholderContract.js";
|
|
146
152
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
147
153
|
import "./base/index.js";
|
|
148
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
154
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./accounts/credit-account-compressor/types.js";
|
|
149
155
|
import { CreditAccountCompressor } from "./accounts/credit-account-compressor/CreditAccountCompressor.js";
|
|
150
156
|
import { CreditAccountCompressorV310Contract } from "./accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js";
|
|
151
157
|
import { AbstractWithdrawalCompressorContract, OnchainRequestableWithdrawal, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
|
|
@@ -172,4 +178,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
|
|
|
172
178
|
import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
|
|
173
179
|
import "./accounts/index.js";
|
|
174
180
|
import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
175
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
|
|
181
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountSnapshot, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, IsStrategyCollateralProps, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcBorrowRate, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcPositionLeverage, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -1001,10 +1001,6 @@ declare class CreditManagerV310Contract extends BaseContract<abi> implements ICr
|
|
|
1001
1001
|
constructor(sdk: OnchainSDK, { creditManager, adapters }: CreditSuiteState);
|
|
1002
1002
|
stateHuman(raw?: boolean): CreditManagerStateHuman;
|
|
1003
1003
|
get collateralTokens(): Address[];
|
|
1004
|
-
/**
|
|
1005
|
-
* {@inheritDoc ICreditManagerContract.leverageableCollaterals}
|
|
1006
|
-
*/
|
|
1007
|
-
get leverageableCollaterals(): Address[];
|
|
1008
1004
|
/**
|
|
1009
1005
|
* {@inheritDoc ICreditManagerContract.maxLeverage}
|
|
1010
1006
|
*/
|
|
@@ -135,22 +135,8 @@ declare class CreditSuite extends SDKConstruct {
|
|
|
135
135
|
*/
|
|
136
136
|
get isPaused(): boolean;
|
|
137
137
|
/**
|
|
138
|
-
* Collateral tokens a leveraged position can be built around in this suite
|
|
139
|
-
*
|
|
140
|
-
* still be entered. A token qualifies when it
|
|
141
|
-
*
|
|
142
|
-
* - has a liquidation threshold above `0` and below `100%`, and is not the
|
|
143
|
-
* suite's underlying, see
|
|
144
|
-
* {@link ICreditManagerContract.leverageableCollaterals};
|
|
145
|
-
* - is not the token the market's underlying wraps, which for an RWA market
|
|
146
|
-
* is the same exposure as the underlying itself;
|
|
147
|
-
* - is not a phantom token, which only ever appears as the intermediate step
|
|
148
|
-
* of a withdrawal and cannot be acquired;
|
|
149
|
-
* - is not an expired token, e.g. a matured Pendle PT;
|
|
150
|
-
* - has a non-zero main price in the market's oracle — a zero or failed
|
|
151
|
-
* answer (e.g. a zero price feed) means the position cannot be valued;
|
|
152
|
-
* - the market still accepts quota for, see
|
|
153
|
-
* {@link PoolQuotaKeeperContract.hasActiveQuota}.
|
|
138
|
+
* Collateral tokens a leveraged position can be built around in this suite,
|
|
139
|
+
* see {@link isStrategyCollateral} for the per-token criteria.
|
|
154
140
|
*
|
|
155
141
|
* A suite where no debt can be drawn at all ({@link maxBorrowAmount} is `0`,
|
|
156
142
|
* e.g. its debt limit is exhausted or zeroed out) offers no strategies,
|
|
@@ -6,4 +6,5 @@ import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
|
|
|
6
6
|
import { CreditSuite } from "./CreditSuite.js";
|
|
7
7
|
import { dominantCollateral, mustGetDominantCollateral } from "./dominantCollateral.js";
|
|
8
8
|
import { ExpectedBalanceDeltasProps, ExpectedOutput, expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
|
|
9
|
-
|
|
9
|
+
import { IsStrategyCollateralProps, NON_STRATEGY_PHANTOM_TOKEN_TYPES, isStrategyCollateral } from "./isStrategyCollateral.js";
|
|
10
|
+
export { BalanceDelta, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, ExpectedBalanceDeltasProps, ExpectedOutput, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IsStrategyCollateralProps, LiquidationFees, NON_STRATEGY_PHANTOM_TOKEN_TYPES, PartialLiquidationParams, PrepareUpdateQuotasProps, RampEvent, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, mustGetDominantCollateral };
|