@gearbox-protocol/sdk 15.1.0-next.3 → 15.1.0-next.4

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.
@@ -184,16 +184,26 @@ var CreditSuite = class extends require_sdk_base_SDKConstruct.SDKConstruct {
184
184
  * - is not a phantom token, which only ever appears as the intermediate step
185
185
  * of a withdrawal and cannot be acquired;
186
186
  * - is not an expired token, e.g. a matured Pendle PT;
187
+ * - has a non-zero main price in the market's oracle — a zero or failed
188
+ * answer (e.g. a zero price feed) means the position cannot be valued;
187
189
  * - the market still accepts quota for, see
188
190
  * {@link PoolQuotaKeeperContract.hasActiveQuota}.
191
+ *
192
+ * A suite where no debt can be drawn at all ({@link maxBorrowAmount} is `0`,
193
+ * e.g. its debt limit is exhausted or zeroed out) offers no strategies,
194
+ * whatever its collaterals are.
189
195
  */
190
196
  get strategyCollaterals() {
197
+ if (this.maxBorrowAmount === 0n) return [];
191
198
  const { pqk, unwrappedUnderlying } = this.market.pool;
199
+ const { mainPrices } = this.market.priceOracle;
192
200
  const { tokensMeta } = this;
193
201
  return this.creditManager.leverageableCollaterals.filter((token) => {
194
202
  if ((0, viem.isAddressEqual)(token, unwrappedUnderlying)) return false;
195
203
  const meta = tokensMeta.mustGet(token);
196
204
  if (tokensMeta.isPhantomToken(meta) || meta.isExpired) return false;
205
+ const mainPrice = mainPrices.get(token);
206
+ if (!mainPrice?.success || mainPrice.price === 0n) return false;
197
207
  return pqk.hasActiveQuota(token);
198
208
  });
199
209
  }
@@ -183,16 +183,26 @@ var CreditSuite = class extends SDKConstruct {
183
183
  * - is not a phantom token, which only ever appears as the intermediate step
184
184
  * of a withdrawal and cannot be acquired;
185
185
  * - is not an expired token, e.g. a matured Pendle PT;
186
+ * - has a non-zero main price in the market's oracle — a zero or failed
187
+ * answer (e.g. a zero price feed) means the position cannot be valued;
186
188
  * - the market still accepts quota for, see
187
189
  * {@link PoolQuotaKeeperContract.hasActiveQuota}.
190
+ *
191
+ * A suite where no debt can be drawn at all ({@link maxBorrowAmount} is `0`,
192
+ * e.g. its debt limit is exhausted or zeroed out) offers no strategies,
193
+ * whatever its collaterals are.
188
194
  */
189
195
  get strategyCollaterals() {
196
+ if (this.maxBorrowAmount === 0n) return [];
190
197
  const { pqk, unwrappedUnderlying } = this.market.pool;
198
+ const { mainPrices } = this.market.priceOracle;
191
199
  const { tokensMeta } = this;
192
200
  return this.creditManager.leverageableCollaterals.filter((token) => {
193
201
  if (isAddressEqual(token, unwrappedUnderlying)) return false;
194
202
  const meta = tokensMeta.mustGet(token);
195
203
  if (tokensMeta.isPhantomToken(meta) || meta.isExpired) return false;
204
+ const mainPrice = mainPrices.get(token);
205
+ if (!mainPrice?.success || mainPrice.price === 0n) return false;
196
206
  return pqk.hasActiveQuota(token);
197
207
  });
198
208
  }
@@ -147,8 +147,14 @@ declare class CreditSuite extends SDKConstruct {
147
147
  * - is not a phantom token, which only ever appears as the intermediate step
148
148
  * of a withdrawal and cannot be acquired;
149
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;
150
152
  * - the market still accepts quota for, see
151
153
  * {@link PoolQuotaKeeperContract.hasActiveQuota}.
154
+ *
155
+ * A suite where no debt can be drawn at all ({@link maxBorrowAmount} is `0`,
156
+ * e.g. its debt limit is exhausted or zeroed out) offers no strategies,
157
+ * whatever its collaterals are.
152
158
  */
153
159
  get strategyCollaterals(): Address[];
154
160
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "15.1.0-next.3",
3
+ "version": "15.1.0-next.4",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {