@gearbox-protocol/sdk 15.1.0-next.4 → 15.1.0-next.6
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/dev/compareOpportunities.js +218 -0
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -2
- package/dist/cjs/sdk/index.js +9 -5
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +1 -12
- package/dist/cjs/sdk/market/credit/CreditSuite.js +18 -27
- 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/pool/PoolV310Contract.js +1 -1
- package/dist/cjs/sdk/opportunities/index.js +0 -13
- package/dist/esm/dev/compareOpportunities.js +216 -0
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +3 -3
- package/dist/esm/sdk/index.js +3 -2
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +2 -13
- package/dist/esm/sdk/market/credit/CreditSuite.js +19 -28
- 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/pool/PoolV310Contract.js +2 -2
- package/dist/esm/sdk/opportunities/index.js +1 -2
- package/dist/types/dev/compareOpportunities.d.ts +153 -0
- package/dist/types/model/opportunities.d.ts +9 -9
- package/dist/types/model/positions.d.ts +3 -3
- package/dist/types/sdk/index.d.ts +3 -2
- 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/opportunities/index.d.ts +1 -2
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import "../../constants/math.js";
|
|
2
|
+
import "../../constants/index.js";
|
|
3
|
+
import { isAddressEqual } from "viem";
|
|
4
|
+
//#region src/sdk/market/credit/isStrategyCollateral.ts
|
|
5
|
+
/**
|
|
6
|
+
* Withdrawal and redemption phantom tokens that can never be acquired as a
|
|
7
|
+
* strategy target. Other `PHANTOM_TOKEN::*` types (Convex, Infrared, staking
|
|
8
|
+
* rewards) can.
|
|
9
|
+
*/
|
|
10
|
+
const NON_STRATEGY_PHANTOM_TOKEN_TYPES = [
|
|
11
|
+
"PHANTOM_TOKEN::INFINIFI_UNWIND",
|
|
12
|
+
"PHANTOM_TOKEN::MELLOW_WITHDRAWAL",
|
|
13
|
+
"PHANTOM_TOKEN::MIDAS_REDEMPTION",
|
|
14
|
+
"PHANTOM_TOKEN::SECURITIZE_RD",
|
|
15
|
+
"PHANTOM_TOKEN::UPSHIFT_WITHDRAW"
|
|
16
|
+
];
|
|
17
|
+
const NON_STRATEGY_PHANTOM_TOKEN_TYPE_SET = new Set(NON_STRATEGY_PHANTOM_TOKEN_TYPES);
|
|
18
|
+
const RWA_UNDERLYING_PREFIX = "RWA_UNDERLYING::";
|
|
19
|
+
/**
|
|
20
|
+
* Whether a collateral token can be the target of a leveraged strategy.
|
|
21
|
+
*
|
|
22
|
+
* A token qualifies when it
|
|
23
|
+
*
|
|
24
|
+
* - has a liquidation threshold above `0` and below `100%`, and is not the
|
|
25
|
+
* suite's underlying — borrowing an asset against itself is not a position,
|
|
26
|
+
* and an LT of `0` or at least `100%` would mean unbounded leverage;
|
|
27
|
+
* - is not the token the market's underlying wraps, which for an RWA market
|
|
28
|
+
* is the same exposure as the underlying itself (also rejected when
|
|
29
|
+
* `contractType` starts with `"RWA_UNDERLYING::"`);
|
|
30
|
+
* - is not a withdrawal or redemption phantom token listed in
|
|
31
|
+
* {@link NON_STRATEGY_PHANTOM_TOKEN_TYPES} — those only ever appear as the
|
|
32
|
+
* intermediate step of a withdrawal and cannot be acquired;
|
|
33
|
+
* - is not an expired token, e.g. a matured Pendle PT;
|
|
34
|
+
* - has a non-zero main price in the market's oracle — a zero or missing
|
|
35
|
+
* answer (e.g. a failed or zero price feed) means the position cannot be
|
|
36
|
+
* valued;
|
|
37
|
+
* - the market still accepts quota for.
|
|
38
|
+
*/
|
|
39
|
+
function isStrategyCollateral({ token, underlying, unwrappedUnderlying, liquidationThreshold, contractType, isExpired, mainPrice, hasActiveQuota }) {
|
|
40
|
+
if (isAddressEqual(token, underlying) || isAddressEqual(token, unwrappedUnderlying)) return false;
|
|
41
|
+
if (liquidationThreshold <= 0 || liquidationThreshold >= Number(10000n)) return false;
|
|
42
|
+
if (contractType && (NON_STRATEGY_PHANTOM_TOKEN_TYPE_SET.has(contractType) || contractType.startsWith(RWA_UNDERLYING_PREFIX))) return false;
|
|
43
|
+
if (isExpired) return false;
|
|
44
|
+
if (!mainPrice) return false;
|
|
45
|
+
return hasActiveQuota;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { NON_STRATEGY_PHANTOM_TOKEN_TYPES, isStrategyCollateral };
|
|
@@ -4,8 +4,10 @@ import "./adapters/index.js";
|
|
|
4
4
|
import { CreditConfiguratorV310Contract } from "./credit/CreditConfiguratorV310Contract.js";
|
|
5
5
|
import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./credit/CreditFacadeV310BaseContract.js";
|
|
6
6
|
import { CreditFacadeV310Contract } from "./credit/CreditFacadeV310Contract.js";
|
|
7
|
+
import { MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
|
|
7
8
|
import { CreditManagerV310Contract } from "./credit/CreditManagerV310Contract.js";
|
|
8
9
|
import { dominantCollateral, mustGetDominantCollateral } from "./credit/dominantCollateral.js";
|
|
10
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES, isStrategyCollateral } from "./credit/isStrategyCollateral.js";
|
|
9
11
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
10
12
|
import { expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
|
|
11
13
|
import "./credit/index.js";
|
|
@@ -59,4 +61,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
|
|
|
59
61
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
|
|
60
62
|
import "./rwa/index.js";
|
|
61
63
|
import "./types.js";
|
|
62
|
-
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, LinearInterestRateModelContract, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeRWAFactory, UnsupportedZapperFunctionError, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, fetchRedstonePayloads, getRawPriceUpdates, isLPPriceFeed, isRWAFactory, isUpdatablePriceFeed, mustGetDominantCollateral };
|
|
64
|
+
export { AbstractLPPriceFeedContract, AbstractPriceFeedContract, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CompositePriceFeedContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, NON_STRATEGY_PHANTOM_TOKEN_TYPES, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeRWAFactory, UnsupportedZapperFunctionError, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, fetchRedstonePayloads, getRawPriceUpdates, healthFactorBps, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, minSeizedAmount, mustGetDominantCollateral, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber };
|
|
@@ -15,7 +15,8 @@ const FULL = Number(PERCENTAGE_FACTOR);
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
18
|
-
*
|
|
18
|
+
* // ray: 5% (0.05 × 10²⁷)
|
|
19
|
+
* rayToBps(50_000_000_000_000_000_000_000_000n) // 500 bps = 5%
|
|
19
20
|
* ```
|
|
20
21
|
**/
|
|
21
22
|
function rayToBps(ray) {
|
|
@@ -26,6 +27,7 @@ function rayToBps(ray) {
|
|
|
26
27
|
*
|
|
27
28
|
* @example
|
|
28
29
|
* ```ts
|
|
30
|
+
* // usd: $1500.50 in 8-decimal fixed point
|
|
29
31
|
* usdToNumber(150_050_000_000n) // 1500.5
|
|
30
32
|
* ```
|
|
31
33
|
**/
|
|
@@ -38,56 +40,66 @@ function usdToNumber(usd) {
|
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* ```ts
|
|
41
|
-
*
|
|
43
|
+
* // borrowed: 750, total: 1000
|
|
44
|
+
* calcUtilization(750n, 1000n) // 750 / 1000 = 7500 bps = 75%
|
|
42
45
|
* ```
|
|
43
46
|
**/
|
|
44
|
-
function
|
|
47
|
+
function calcUtilization(borrowed, total) {
|
|
45
48
|
if (total <= 0n || borrowed <= 0n) return 0;
|
|
46
49
|
const utilization = Number(borrowed * PERCENTAGE_FACTOR / total);
|
|
47
50
|
return Math.min(utilization, FULL);
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
|
-
* Annual cost of debt for a credit manager, in basis points:
|
|
51
|
-
*
|
|
53
|
+
* Annual cost of debt for a credit manager, in basis points:
|
|
54
|
+
* `baseInterestRate × (1 + feeInterest)` — the pool's base rate plus the
|
|
55
|
+
* protocol's cut of the accrued interest.
|
|
52
56
|
*
|
|
53
57
|
* @param baseInterestRate - Pool base rate in ray.
|
|
54
58
|
* @param feeInterest - Credit manager interest fee in basis points.
|
|
55
59
|
*
|
|
56
60
|
* @example
|
|
57
61
|
* ```ts
|
|
58
|
-
* // 5%
|
|
59
|
-
*
|
|
62
|
+
* // baseInterestRate: 5% in ray, feeInterest: 5000 bps = 50%
|
|
63
|
+
* calcBorrowApy(50_000_000_000_000_000_000_000_000n, 5000) // 5% × 1.5 = 750 bps = 7.5%
|
|
60
64
|
* ```
|
|
61
65
|
**/
|
|
62
|
-
function
|
|
66
|
+
function calcBorrowApy(baseInterestRate, feeInterest) {
|
|
63
67
|
return rayToBps(baseInterestRate * (PERCENTAGE_FACTOR + BigInt(feeInterest)) / PERCENTAGE_FACTOR);
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
* 5% safety margin subtracted from 100% in {@link calcMaxLeverage}, so a
|
|
71
|
+
* maxed position opens with HF slightly above 1.
|
|
72
|
+
**/
|
|
73
|
+
const MAX_LEVERAGE_BUFFER_BPS = 500;
|
|
74
|
+
/**
|
|
75
|
+
* Highest total-value leverage a liquidation threshold allows:
|
|
76
|
+
* `(100% − buffer) / (100% − liquidationThreshold)`. At HF = 1, debt is
|
|
77
|
+
* `liquidationThreshold × totalValue`, leaving `1 − liquidationThreshold` of
|
|
78
|
+
* equity per unit of exposure; the {@link MAX_LEVERAGE_BUFFER_BPS} buffer
|
|
79
|
+
* keeps the maxed position slightly away from that boundary.
|
|
71
80
|
*
|
|
72
81
|
* @example
|
|
73
82
|
* ```ts
|
|
74
|
-
*
|
|
75
|
-
*
|
|
83
|
+
* // liquidationThreshold: 9000 bps = 90%
|
|
84
|
+
* calcMaxLeverage(9000) // (1 − 0.05) / (1 − 0.9) = 9.5x total exposure
|
|
76
85
|
* ```
|
|
77
86
|
**/
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
function calcMaxLeverage(liquidationThreshold) {
|
|
88
|
+
if (liquidationThreshold >= FULL) return 0;
|
|
89
|
+
const leverage = (FULL - 500) / (FULL - liquidationThreshold);
|
|
90
|
+
return Math.max(leverage, 1);
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
83
93
|
* Converts a credit account's health factor from the 18-decimal fixed point the
|
|
84
94
|
* contracts store to basis points.
|
|
85
95
|
*
|
|
86
|
-
*
|
|
96
|
+
* Accounts with no debt store `MAX_UINT256` on-chain; for those this
|
|
97
|
+
* returns `0`.
|
|
87
98
|
*
|
|
88
99
|
* @example
|
|
89
100
|
* ```ts
|
|
90
|
-
*
|
|
101
|
+
* // healthFactor: 1.25 in 18-decimal fixed point
|
|
102
|
+
* healthFactorBps(1_250_000_000_000_000_000n) // 12500 bps = 1.25
|
|
91
103
|
* ```
|
|
92
104
|
**/
|
|
93
105
|
function healthFactorBps(healthFactor) {
|
|
@@ -95,39 +107,39 @@ function healthFactorBps(healthFactor) {
|
|
|
95
107
|
return Number(healthFactor * PERCENTAGE_FACTOR / WAD);
|
|
96
108
|
}
|
|
97
109
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* Returns `0` for a position that carries no debt and for one that is
|
|
102
|
-
* underwater, where there is no equity to lever.
|
|
110
|
+
* Total-value leverage of an open position:
|
|
111
|
+
* `totalValue / (totalValue − totalDebt)`. `1` when unleveraged, `0` when
|
|
112
|
+
* underwater.
|
|
103
113
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param
|
|
114
|
+
* @param totalValue - Total value of the position.
|
|
115
|
+
* @param totalDebt - Debt principal plus accrued interest and fees, same token.
|
|
106
116
|
*
|
|
107
117
|
* @example
|
|
108
118
|
* ```ts
|
|
109
|
-
*
|
|
119
|
+
* // totalValue: 100k, totalDebt: 80k → equity: 100k − 80k = 20k
|
|
120
|
+
* calcPositionLeverage(100_000n, 80_000n) // 100k / 20k = 5x
|
|
110
121
|
* ```
|
|
111
122
|
**/
|
|
112
|
-
function
|
|
123
|
+
function calcPositionLeverage(totalValue, totalDebt) {
|
|
113
124
|
const equity = totalValue - totalDebt;
|
|
114
|
-
if (
|
|
115
|
-
|
|
125
|
+
if (totalValue <= 0n || equity <= 0n) return 0;
|
|
126
|
+
if (totalDebt <= 0n) return 1;
|
|
127
|
+
return Number(totalValue) / Number(equity);
|
|
116
128
|
}
|
|
117
129
|
/**
|
|
118
|
-
* Annual quota cost
|
|
119
|
-
*
|
|
120
|
-
*
|
|
130
|
+
* Annual quota cost on equity, in basis points:
|
|
131
|
+
* `quotaRate × (1 + feeInterest) × leverage`. Quota accrues on the whole
|
|
132
|
+
* quoted position, and the DAO takes `feeInterest` of it as with base interest.
|
|
121
133
|
*
|
|
122
134
|
* @example
|
|
123
135
|
* ```ts
|
|
124
|
-
* // 2
|
|
125
|
-
*
|
|
136
|
+
* // quotaRate: 200 bps = 2%, feeInterest: 2500 bps = 25%, leverage: 9.5x
|
|
137
|
+
* calcAdditionalBorrowApy(200, 2500, 9.5) // 2% × 1.25 × 9.5 = 2375 bps = 23.75%
|
|
126
138
|
* ```
|
|
127
139
|
**/
|
|
128
|
-
function
|
|
129
|
-
if (!Number.isFinite(leverage)) return 0;
|
|
130
|
-
return Math.round(quotaRate *
|
|
140
|
+
function calcAdditionalBorrowApy(quotaRate, feeInterest, leverage) {
|
|
141
|
+
if (!Number.isFinite(leverage) || leverage <= 0) return 0;
|
|
142
|
+
return Math.round(quotaRate * (1 + feeInterest / FULL) * leverage);
|
|
131
143
|
}
|
|
132
144
|
/**
|
|
133
145
|
* {@link PERCENTAGE_FACTOR} less a 0.1% safety buffer.
|
|
@@ -185,4 +197,4 @@ function optimalHFForPartialLiquidation(borrowRate) {
|
|
|
185
197
|
return PERCENTAGE_FACTOR + (borrowRate < 100n ? borrowRate : 100n);
|
|
186
198
|
}
|
|
187
199
|
//#endregion
|
|
188
|
-
export { PARTIAL_LIQUIDATION_BUFFER_BPS,
|
|
200
|
+
export { MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber };
|
|
@@ -7,7 +7,7 @@ import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
|
|
|
7
7
|
import "../../utils/index.js";
|
|
8
8
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
9
|
import "../../base/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { calcUtilization } from "../math.js";
|
|
11
11
|
//#region src/sdk/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
13
13
|
var PoolV310Contract = class extends BaseContract {
|
|
@@ -50,7 +50,7 @@ var PoolV310Contract = class extends BaseContract {
|
|
|
50
50
|
* {@inheritDoc IPoolContract.utilization}
|
|
51
51
|
*/
|
|
52
52
|
get utilization() {
|
|
53
|
-
return
|
|
53
|
+
return calcUtilization(this.borrowed, this.expectedLiquidity);
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* {@inheritDoc IPoolContract.unwrappedUnderlying}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
|
|
2
1
|
import { MultichainOpportunitiesService } from "./MultichainOpportunitiesService.js";
|
|
3
2
|
import { OpportunitiesService } from "./OpportunitiesService.js";
|
|
4
|
-
export { MultichainOpportunitiesService, OpportunitiesService
|
|
3
|
+
export { MultichainOpportunitiesService, OpportunitiesService };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ChainId } from "../model/primitives.js";
|
|
2
|
+
import { Opportunity, OpportunityId, OpportunityKind } from "../model/opportunities.js";
|
|
3
|
+
import { ChainMetadata, DataResponse } from "../model/response.js";
|
|
4
|
+
import "../model/index.js";
|
|
5
|
+
import { Address } from "viem";
|
|
6
|
+
//#region src/dev/compareOpportunities.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* What kind of disagreement a {@link FieldDiff} describes, so that a reader can
|
|
9
|
+
* bucket the report without re-deriving it from the values.
|
|
10
|
+
*
|
|
11
|
+
* - `"presence"` — one side has no value at all (`undefined` or `null`).
|
|
12
|
+
* - `"usd"` — an {@link Amount.valueUsd}, i.e. a price-derived float.
|
|
13
|
+
* - `"numeric"` — any other number or bigint.
|
|
14
|
+
* - `"other"` — everything else: strings, booleans, array shapes.
|
|
15
|
+
**/
|
|
16
|
+
type DiffKind = "presence" | "usd" | "numeric" | "other";
|
|
17
|
+
/**
|
|
18
|
+
* One field of one opportunity where the two sources disagree.
|
|
19
|
+
**/
|
|
20
|
+
interface FieldDiff {
|
|
21
|
+
/**
|
|
22
|
+
* Dotted path into the row, with array elements keyed by their own identity
|
|
23
|
+
* rather than by index, e.g. `collateralTokens[0xa0b8...].symbol`.
|
|
24
|
+
**/
|
|
25
|
+
path: string;
|
|
26
|
+
/**
|
|
27
|
+
* Value the chain reported, `undefined` when it has no such field.
|
|
28
|
+
**/
|
|
29
|
+
onchain: unknown;
|
|
30
|
+
/**
|
|
31
|
+
* Value the backend reported, see {@link onchain}.
|
|
32
|
+
**/
|
|
33
|
+
offchain: unknown;
|
|
34
|
+
kind: DiffKind;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Enough of an opportunity to identify it in a report without carrying the
|
|
38
|
+
* whole row.
|
|
39
|
+
**/
|
|
40
|
+
interface OpportunityRef {
|
|
41
|
+
id: OpportunityId;
|
|
42
|
+
kind: OpportunityKind;
|
|
43
|
+
chainId: ChainId;
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* Set on a pool opportunity.
|
|
47
|
+
**/
|
|
48
|
+
pool?: Address;
|
|
49
|
+
/**
|
|
50
|
+
* Set on a strategy opportunity, together with {@link targetCollateral}.
|
|
51
|
+
**/
|
|
52
|
+
creditManager?: Address;
|
|
53
|
+
targetCollateral?: Address;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One opportunity both sources listed, and everything they disagree on.
|
|
57
|
+
**/
|
|
58
|
+
interface OpportunityMatch {
|
|
59
|
+
id: OpportunityId;
|
|
60
|
+
kind: OpportunityKind;
|
|
61
|
+
chainId: ChainId;
|
|
62
|
+
/**
|
|
63
|
+
* Name each source gave the row, which is itself a frequent diff.
|
|
64
|
+
**/
|
|
65
|
+
onchainName: string;
|
|
66
|
+
offchainName: string;
|
|
67
|
+
identical: boolean;
|
|
68
|
+
diffs: FieldDiff[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* How often one field disagreed across all matched rows, with array keys
|
|
72
|
+
* collapsed, e.g. `collateralTokens[].symbol`.
|
|
73
|
+
**/
|
|
74
|
+
interface DiffPathCount {
|
|
75
|
+
path: string;
|
|
76
|
+
kinds: DiffKind[];
|
|
77
|
+
count: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Counts of one chain, or of the whole report when `chainId` is absent.
|
|
81
|
+
**/
|
|
82
|
+
interface CompareCounts {
|
|
83
|
+
onchainRows: number;
|
|
84
|
+
offchainRows: number;
|
|
85
|
+
matched: number;
|
|
86
|
+
identical: number;
|
|
87
|
+
differing: number;
|
|
88
|
+
onlyOnchain: number;
|
|
89
|
+
onlyOffchain: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Counts of one chain.
|
|
93
|
+
**/
|
|
94
|
+
interface ChainCompareCounts extends CompareCounts {
|
|
95
|
+
chainId: ChainId;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Totals of the comparison plus the fields that differed most often.
|
|
99
|
+
**/
|
|
100
|
+
interface CompareSummary extends CompareCounts {
|
|
101
|
+
byChain: ChainCompareCounts[];
|
|
102
|
+
diffsByPath: DiffPathCount[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Everything one comparison run produced, ready to be written out as JSON.
|
|
106
|
+
**/
|
|
107
|
+
interface OpportunityCompareReport {
|
|
108
|
+
generatedAt: string;
|
|
109
|
+
backendUrl: string;
|
|
110
|
+
networks: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Per-chain metadata of the on-chain read, which says which block each chain
|
|
113
|
+
* answered from.
|
|
114
|
+
**/
|
|
115
|
+
onchainChains: ChainMetadata[];
|
|
116
|
+
/**
|
|
117
|
+
* Per-chain metadata of the backend read, see {@link onchainChains}.
|
|
118
|
+
**/
|
|
119
|
+
offchainChains: ChainMetadata[];
|
|
120
|
+
summary: CompareSummary;
|
|
121
|
+
onlyOnchain: OpportunityRef[];
|
|
122
|
+
onlyOffchain: OpportunityRef[];
|
|
123
|
+
matched: OpportunityMatch[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The two listings to compare, plus what the run was pointed at.
|
|
127
|
+
**/
|
|
128
|
+
interface CompareOpportunitiesInput {
|
|
129
|
+
onchain: DataResponse<Opportunity[]>;
|
|
130
|
+
offchain: DataResponse<Opportunity[]>;
|
|
131
|
+
backendUrl: string;
|
|
132
|
+
networks: string[];
|
|
133
|
+
/**
|
|
134
|
+
* ISO timestamp stamped onto the report, defaulting to now. Pinned by tests.
|
|
135
|
+
**/
|
|
136
|
+
generatedAt?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Matches two opportunity listings by {@link opportunityId} and reports every
|
|
140
|
+
* field the two sources disagree on.
|
|
141
|
+
*
|
|
142
|
+
* Nothing is filtered out: a diff that is expected — a field only the backend
|
|
143
|
+
* can fill, a formula the two sides define differently, a USD value smoothed on
|
|
144
|
+
* one side — is reported like any other, tagged by {@link DiffKind} so that a
|
|
145
|
+
* reader can bucket it afterwards.
|
|
146
|
+
**/
|
|
147
|
+
declare function compareOpportunities(input: CompareOpportunitiesInput): OpportunityCompareReport;
|
|
148
|
+
/**
|
|
149
|
+
* Every field two versions of one opportunity disagree on.
|
|
150
|
+
**/
|
|
151
|
+
declare function diffOpportunity(onchain: Opportunity, offchain: Opportunity): FieldDiff[];
|
|
152
|
+
//#endregion
|
|
153
|
+
export { ChainCompareCounts, CompareCounts, CompareOpportunitiesInput, CompareSummary, DiffKind, DiffPathCount, FieldDiff, OpportunityCompareReport, OpportunityMatch, OpportunityRef, compareOpportunities, diffOpportunity };
|
|
@@ -254,9 +254,8 @@ interface StrategyOpportunity extends OpportunityBase {
|
|
|
254
254
|
collateralApy?: ApyBreakdown;
|
|
255
255
|
/**
|
|
256
256
|
* Net yield at {@link maxLeverage}:
|
|
257
|
-
* `collateralApy
|
|
258
|
-
*
|
|
259
|
-
* {@link ApyBreakdown.rewards} alike.
|
|
257
|
+
* `collateralApy × maxLeverage − borrowApy × (maxLeverage − 1) − additionalBorrowApy`.
|
|
258
|
+
* Yield is on the whole position; borrow interest is on the borrowed part only.
|
|
260
259
|
*
|
|
261
260
|
* Absent in `onchain` mode: its {@link collateralApy} term is.
|
|
262
261
|
*
|
|
@@ -271,9 +270,9 @@ interface StrategyOpportunity extends OpportunityBase {
|
|
|
271
270
|
**/
|
|
272
271
|
borrowApy?: Bps;
|
|
273
272
|
/**
|
|
274
|
-
* Annual cost of the quota on {@link targetCollateral},
|
|
275
|
-
*
|
|
276
|
-
* {@link borrowApy}.
|
|
273
|
+
* Annual cost of the quota on {@link targetCollateral}, in basis points:
|
|
274
|
+
* `quotaRate × (1 + feeInterest) × maxLeverage`. Quota accrues on the whole
|
|
275
|
+
* quoted position and carries the same DAO fee as {@link borrowApy}.
|
|
277
276
|
*
|
|
278
277
|
* @example `90` for +0.9% APY
|
|
279
278
|
**/
|
|
@@ -307,10 +306,11 @@ interface StrategyOpportunity extends OpportunityBase {
|
|
|
307
306
|
**/
|
|
308
307
|
maxBorrowAmount: Amount;
|
|
309
308
|
/**
|
|
310
|
-
* Highest leverage the liquidation threshold allows
|
|
311
|
-
* `1 / (1
|
|
309
|
+
* Highest total-value leverage the liquidation threshold allows:
|
|
310
|
+
* `(1 − 0.05) / (1 − liquidationThreshold)`. The 5% safety margin keeps a
|
|
311
|
+
* maxed position slightly above HF = 1.
|
|
312
312
|
*
|
|
313
|
-
* @example `
|
|
313
|
+
* @example `9.5` at a 90% threshold
|
|
314
314
|
**/
|
|
315
315
|
maxLeverage: Leverage;
|
|
316
316
|
}
|
|
@@ -163,9 +163,9 @@ interface StrategyPosition {
|
|
|
163
163
|
**/
|
|
164
164
|
targetCollateral: Token | null;
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
166
|
+
* Total-value leverage: `totalValue / (totalValue − totalDebt)`. `1` =
|
|
167
|
+
* unleveraged; `0` if underwater. Same notation as opportunity `maxLeverage`,
|
|
168
|
+
* and bounded by it.
|
|
169
169
|
**/
|
|
170
170
|
leverage: Leverage;
|
|
171
171
|
/**
|
|
@@ -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";
|
|
@@ -172,4 +173,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
|
|
|
172
173
|
import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
|
|
173
174
|
import "./accounts/index.js";
|
|
174
175
|
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 };
|
|
176
|
+
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, 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, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, 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 };
|