@gearbox-protocol/sdk 16.0.0-next.7 → 16.0.0-next.9

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.
Files changed (41) hide show
  1. package/dist/cjs/onchain/accounts/index.js +3 -2
  2. package/dist/cjs/onchain/accounts/intents/guards.js +71 -14
  3. package/dist/cjs/onchain/accounts/intents/index.js +12 -16
  4. package/dist/cjs/onchain/accounts/intents/math.js +25 -8
  5. package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +2 -5
  6. package/dist/cjs/onchain/accounts/intents/open-strategy.js +5 -6
  7. package/dist/cjs/onchain/accounts/intents/plan.js +43 -21
  8. package/dist/cjs/onchain/accounts/intents/realize.js +23 -8
  9. package/dist/cjs/onchain/accounts/intents/refusal.js +28 -0
  10. package/dist/cjs/onchain/accounts/intents/tail.js +2 -2
  11. package/dist/cjs/onchain/accounts/intents/types.js +0 -16
  12. package/dist/cjs/onchain/index.js +3 -2
  13. package/dist/cjs/onchain/utils/bigint-math.js +9 -0
  14. package/dist/cjs/sdk/prepare/PrepareApi.js +19 -20
  15. package/dist/esm/onchain/accounts/index.js +2 -2
  16. package/dist/esm/onchain/accounts/intents/guards.js +71 -14
  17. package/dist/esm/onchain/accounts/intents/index.js +11 -16
  18. package/dist/esm/onchain/accounts/intents/math.js +25 -8
  19. package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +2 -5
  20. package/dist/esm/onchain/accounts/intents/open-strategy.js +6 -7
  21. package/dist/esm/onchain/accounts/intents/plan.js +43 -21
  22. package/dist/esm/onchain/accounts/intents/realize.js +23 -8
  23. package/dist/esm/onchain/accounts/intents/refusal.js +26 -0
  24. package/dist/esm/onchain/accounts/intents/tail.js +2 -2
  25. package/dist/esm/onchain/accounts/intents/types.js +1 -16
  26. package/dist/esm/onchain/index.js +2 -2
  27. package/dist/esm/onchain/utils/bigint-math.js +9 -0
  28. package/dist/esm/sdk/GearboxSDK.js +2 -2
  29. package/dist/esm/sdk/prepare/PrepareApi.js +19 -20
  30. package/dist/types/onchain/accounts/index.d.ts +3 -2
  31. package/dist/types/onchain/accounts/intents/guards.d.ts +23 -5
  32. package/dist/types/onchain/accounts/intents/index.d.ts +4 -6
  33. package/dist/types/onchain/accounts/intents/math.d.ts +2 -1
  34. package/dist/types/onchain/accounts/intents/refusal.d.ts +175 -0
  35. package/dist/types/onchain/accounts/intents/types.d.ts +7 -71
  36. package/dist/types/onchain/index.d.ts +3 -2
  37. package/dist/types/onchain/utils/bigint-math.d.ts +9 -0
  38. package/dist/types/sdk/index.d.ts +3 -1
  39. package/dist/types/sdk/prepare/index.d.ts +3 -1
  40. package/dist/types/sdk/prepare/types.d.ts +14 -26
  41. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { MAX_UINT256, PERCENTAGE_FACTOR } from "../../constants/math.js";
2
2
  import "../../constants/index.js";
3
- import { IntentPreviewError } from "./types.js";
3
+ import { IntentPreviewError } from "./refusal.js";
4
4
  import { eq } from "./utils/common.js";
5
5
  import { assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage, proportionalDebt } from "./math.js";
6
6
  //#region src/onchain/accounts/intents/plan.ts
@@ -23,18 +23,27 @@ function planAdjustLeverage(intent, view) {
23
23
  const T = intent.token ?? positionToken(view, "adjustLeverage");
24
24
  if (delta > 0n) return [borrow(delta), convert(U, T, delta)];
25
25
  const shortfall = -delta - view.balanceOf(U);
26
- if (shortfall > 0n && eq(T, U)) throw new IntentPreviewError("insufficientSourceBalance", `adjustLeverage: needs ${-delta} underlying, account holds ${view.balanceOf(U)}`);
26
+ if (shortfall > 0n && eq(T, U)) throw new IntentPreviewError("insufficientSourceBalance", {
27
+ required: {
28
+ token: U,
29
+ balance: -delta
30
+ },
31
+ held: {
32
+ token: U,
33
+ balance: view.balanceOf(U)
34
+ }
35
+ }, `adjustLeverage: needs ${-delta} underlying, account holds ${view.balanceOf(U)}`);
27
36
  return [...shortfall > 0n ? [convert(T, U, view.price(U, T, shortfall))] : [], repay(-delta)];
28
37
  }
29
38
  /** Intents 1.1 / 1.2: collateral grows by `a`, debt grows to match. */
30
39
  function planDeposit(intent, view) {
31
40
  assertPositive(intent.amount, "deposit");
32
41
  const U = view.underlying;
33
- if (!eq(intent.token, U) && !(view.rwaAsset && eq(intent.token, view.rwaAsset))) throw new IntentPreviewError("unsupportedCollateralToken", `deposit: only ${U}${view.rwaAsset ? ` or ${view.rwaAsset}` : ""} can be deposited, got ${intent.token}`);
42
+ if (!eq(intent.token, U) && !(view.rwaAsset && eq(intent.token, view.rwaAsset))) throw new IntentPreviewError("unsupportedCollateralToken", { token: intent.token }, `deposit: only ${U}${view.rwaAsset ? ` or ${view.rwaAsset}` : ""} can be deposited, got ${intent.token}`);
34
43
  const aU = view.price(intent.token, U, intent.amount);
35
44
  const debtDelta = intent.targetLeverage === void 0 ? proportionalDebt(view, aU) : debtForLeverage(view.collateral + aU, intent.targetLeverage) - view.debt;
36
- if (debtDelta < 0n) throw new IntentPreviewError("leverageOutOfRange", `deposit: target leverage ${intent.targetLeverage} would require repaying debt`);
37
- assertDebtInBand(view.debt + debtDelta, view.band);
45
+ if (debtDelta < 0n) throw new IntentPreviewError("leverageOutOfRange", void 0, `deposit: target leverage ${intent.targetLeverage} would require repaying debt`);
46
+ assertDebtInBand(view.debt + debtDelta, view.band, U);
38
47
  const T = intent.positionToken ?? positionToken(view, "deposit");
39
48
  const depositStays = eq(intent.token, T);
40
49
  return [
@@ -61,11 +70,24 @@ function planRepay(intent, view) {
61
70
  assertPositive(intent.amount, "repay");
62
71
  const U = view.underlying;
63
72
  const fundsInU = eq(intent.token, U);
64
- if (!fundsInU && !(view.rwaAsset && eq(intent.token, view.rwaAsset))) throw new IntentPreviewError("unsupportedCollateralToken", `repay: only ${U}${view.rwaAsset ? ` or ${view.rwaAsset}` : ""} can be repaid with, got ${intent.token}`);
65
- if (view.debt <= 0n) throw new IntentPreviewError("debtOutOfRange", "repay: the account owes nothing");
73
+ if (!fundsInU && !(view.rwaAsset && eq(intent.token, view.rwaAsset))) throw new IntentPreviewError("unsupportedCollateralToken", { token: intent.token }, `repay: only ${U}${view.rwaAsset ? ` or ${view.rwaAsset}` : ""} can be repaid with, got ${intent.token}`);
74
+ if (view.debt <= 0n) throw new IntentPreviewError("debtOutOfRange", {
75
+ requested: {
76
+ token: U,
77
+ balance: view.debt
78
+ },
79
+ minDebt: {
80
+ token: U,
81
+ balance: view.band.minDebt
82
+ },
83
+ maxDebt: {
84
+ token: U,
85
+ balance: view.band.maxDebt
86
+ }
87
+ }, "repay: the account owes nothing");
66
88
  const funding = everything(intent.amount) ? view.price(U, intent.token, withMargin(view.debt)) : intent.amount;
67
89
  const repaid = min(view.price(intent.token, U, funding), view.debt);
68
- assertDebtInBand(view.debt - repaid, view.band);
90
+ assertDebtInBand(view.debt - repaid, view.band, U);
69
91
  return [
70
92
  add(intent.token, funding, intent.value),
71
93
  ...fundsInU ? [] : [convert(intent.token, U, funding)],
@@ -121,7 +143,7 @@ function planWithdrawDelayed(intent, view) {
121
143
  const { U, T, S, WU, dD, all } = withdrawShape(intent, view);
122
144
  if (all) {
123
145
  const held = view.balanceOf(S);
124
- if (held <= 0n) throw new IntentPreviewError("insufficientSourceBalance", `withdraw: account holds no ${S} to redeem`);
146
+ if (held <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, `withdraw: account holds no ${S} to redeem`);
125
147
  return [{
126
148
  kind: "request",
127
149
  token: S,
@@ -133,7 +155,7 @@ function planWithdrawDelayed(intent, view) {
133
155
  }
134
156
  }];
135
157
  }
136
- if (!eq(T, U) && !(view.rwaAsset && eq(T, view.rwaAsset))) throw new IntentPreviewError("noDelayedRoute", `withdraw: a delayed route cannot pay out in ${T}`);
158
+ if (!eq(T, U) && !(view.rwaAsset && eq(T, view.rwaAsset))) throw new IntentPreviewError("noDelayedRoute", { token: T }, `withdraw: a delayed route cannot pay out in ${T}`);
137
159
  const payoutIsSource = eq(T, S);
138
160
  return [{
139
161
  kind: "request",
@@ -159,9 +181,9 @@ function planWithdrawDelayed(intent, view) {
159
181
  */
160
182
  function planAdjustLeverageDelayed(intent, view) {
161
183
  const { U, delta } = leverageShape(intent, view);
162
- if (delta >= 0n) throw new IntentPreviewError("noDelayedRoute", "adjustLeverage: only deleveraging can settle with a delay");
184
+ if (delta >= 0n) throw new IntentPreviewError("noDelayedRoute", void 0, "adjustLeverage: only deleveraging can settle with a delay");
163
185
  const shortfall = -delta - view.balanceOf(U);
164
- if (shortfall <= 0n) throw new IntentPreviewError("noDelayedRoute", "adjustLeverage: idle underlying covers the repayment, nothing to redeem");
186
+ if (shortfall <= 0n) throw new IntentPreviewError("noDelayedRoute", void 0, "adjustLeverage: idle underlying covers the repayment, nothing to redeem");
165
187
  const T = intent.token ?? positionToken(view, "adjustLeverage");
166
188
  return [{
167
189
  kind: "request",
@@ -189,7 +211,7 @@ function planFinishWithdraw(intent, claimable, claimed, view) {
189
211
  const U = view.underlying;
190
212
  const T = intent.withdrawToken;
191
213
  const W = intent.withdrawAmount;
192
- if (!eq(T, U) && !(view.rwaAsset && eq(T, view.rwaAsset))) throw new IntentPreviewError("noDelayedRoute", `finishWithdraw: cannot pay out in ${T}`);
214
+ if (!eq(T, U) && !(view.rwaAsset && eq(T, view.rwaAsset))) throw new IntentPreviewError("noDelayedRoute", { token: T }, `finishWithdraw: cannot pay out in ${T}`);
193
215
  if (intent.debtRepaid === 0n) return [
194
216
  claim(claimable),
195
217
  convert(claimed.token, T, claimed.amount),
@@ -281,7 +303,7 @@ function withdrawShape(intent, view) {
281
303
  };
282
304
  }
283
305
  const WU = view.price(T, U, intent.amount);
284
- if (WU <= 0n) throw new IntentPreviewError("insufficientSourceBalance", `withdraw: cannot price ${intent.amount} of ${T}`);
306
+ if (WU <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, `withdraw: cannot price ${intent.amount} of ${T}`);
285
307
  if (WU >= view.collateral) {
286
308
  assertHasValue(view);
287
309
  return {
@@ -294,7 +316,7 @@ function withdrawShape(intent, view) {
294
316
  };
295
317
  }
296
318
  const dD = proportionalDebt(view, WU);
297
- assertDebtInBand(view.debt - dD, view.band);
319
+ assertDebtInBand(view.debt - dD, view.band, U);
298
320
  return {
299
321
  U,
300
322
  T,
@@ -311,9 +333,9 @@ function withdrawShape(intent, view) {
311
333
  */
312
334
  function leverageShape(intent, view) {
313
335
  assertLeverageAtLeastOne(intent.targetLeverage);
314
- if (view.collateral <= 0n) throw new IntentPreviewError("insufficientSourceBalance", "adjustLeverage: account has no collateral to lever");
336
+ if (view.collateral <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, "adjustLeverage: account has no collateral to lever");
315
337
  const target = debtForLeverage(view.collateral, intent.targetLeverage);
316
- assertDebtInBand(target, view.band);
338
+ assertDebtInBand(target, view.band, view.underlying);
317
339
  return {
318
340
  U: view.underlying,
319
341
  delta: target - view.debt
@@ -379,20 +401,20 @@ function payout(view, token, amount, to) {
379
401
  }
380
402
  function positionToken(view, flow) {
381
403
  const pick = view.fattest([view.underlying]);
382
- if (!pick) throw new IntentPreviewError("insufficientSourceBalance", `${flow}: no position token on the account`);
404
+ if (!pick) throw new IntentPreviewError("insufficientSourceBalance", void 0, `${flow}: no position token on the account`);
383
405
  return pick;
384
406
  }
385
407
  function sourceToken(view) {
386
408
  const pick = view.fattest();
387
- if (!pick) throw new IntentPreviewError("insufficientSourceBalance", "withdraw: account has no spendable balance");
409
+ if (!pick) throw new IntentPreviewError("insufficientSourceBalance", void 0, "withdraw: account has no spendable balance");
388
410
  return pick;
389
411
  }
390
412
  /** An account whose debt has eaten its collateral has nothing to hand over. */
391
413
  function assertHasValue(view) {
392
- if (view.collateral <= 0n) throw new IntentPreviewError("insufficientSourceBalance", `withdraw: nothing to withdraw, net value is ${view.collateral}`);
414
+ if (view.collateral <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, `withdraw: nothing to withdraw, net value is ${view.collateral}`);
393
415
  }
394
416
  function assertPositive(amount, flow) {
395
- if (amount <= 0n) throw new IntentPreviewError("insufficientSourceBalance", `${flow}: amount must be positive`);
417
+ if (amount <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, `${flow}: amount must be positive`);
396
418
  }
397
419
  //#endregion
398
420
  export { RAISED, planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planDeposit, planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw, planRepay, planWithdraw, planWithdrawAsset, planWithdrawDelayed };
@@ -1,5 +1,5 @@
1
1
  import { calcPositionLeverage } from "../../market/math.js";
2
- import { IntentPreviewError } from "./types.js";
2
+ import { IntentPreviewError } from "./refusal.js";
3
3
  import { eq, toTargetDecimals } from "./utils/common.js";
4
4
  import { convertAmount } from "./utils/convert-amount.js";
5
5
  import { isRedemptionPhantomToken } from "./utils/pick-token.js";
@@ -59,7 +59,16 @@ async function realize(steps, props) {
59
59
  const amountOf = (a) => typeof a === "bigint" ? a : min(raised, a.max ?? raised);
60
60
  const assertHolds = (token, amount, what) => {
61
61
  const held = ledger.balanceOf(token);
62
- if (amount <= 0n || held < amount) throw new IntentPreviewError("insufficientSourceBalance", `${what}: needs ${amount} of ${token}, account holds ${held}`);
62
+ if (amount <= 0n || held < amount) throw new IntentPreviewError("insufficientSourceBalance", {
63
+ required: {
64
+ token,
65
+ balance: amount
66
+ },
67
+ held: {
68
+ token,
69
+ balance: held
70
+ }
71
+ }, `${what}: needs ${amount} of ${token}, account holds ${held}`);
63
72
  };
64
73
  for (const step of steps) switch (step.kind) {
65
74
  case "add":
@@ -143,7 +152,7 @@ async function realize(steps, props) {
143
152
  case "closeAll": {
144
153
  const balances = ledger.snapshot().assets.filter((a) => !eq(a.token, underlying) && a.balance > DUST);
145
154
  const pending = balances.find((a) => isRedemptionPhantomToken(sdk, a.token));
146
- if (pending) throw new IntentPreviewError("withdrawalInProgress", `closeAll: ${pending.token} is a pending withdrawal, claim it first`);
155
+ if (pending) throw new IntentPreviewError("withdrawalInProgress", { inFlight: pending }, `closeAll: ${pending.token} is a pending withdrawal, claim it first`);
147
156
  if (balances.length > 0) {
148
157
  const leg = await paths.closeAll({ balances });
149
158
  if (leg.calls.length > 0 || leg.minAmount > 0n) push(buildCloseSwapOperation({
@@ -171,7 +180,10 @@ async function realize(steps, props) {
171
180
  }
172
181
  case "request": {
173
182
  const asset = await delayedConfig(sdk, creditAccount, step.token);
174
- if (ledger.balanceOf(asset.withdrawalPhantomToken) > 0n) throw new IntentPreviewError("withdrawalInProgress", `request: ${asset.withdrawalPhantomToken} already holds a pending withdrawal`);
183
+ if (ledger.balanceOf(asset.withdrawalPhantomToken) > 0n) throw new IntentPreviewError("withdrawalInProgress", { inFlight: {
184
+ token: asset.withdrawalPhantomToken,
185
+ balance: ledger.balanceOf(asset.withdrawalPhantomToken)
186
+ } }, `request: ${asset.withdrawalPhantomToken} already holds a pending withdrawal`);
175
187
  assertHolds(step.token, step.amount + step.reserve, "request");
176
188
  const preview = await sdk.accounts.previewDelayedWithdrawal({
177
189
  creditAccount: creditAccount.creditAccount,
@@ -270,7 +282,7 @@ async function realize(steps, props) {
270
282
  timeToLiquidation: sdk.positions.timeToLiquidation(snapshot, projectedPool),
271
283
  liquidationPrice: sdk.positions.liquidationPrice(snapshot)
272
284
  };
273
- assertCollateralised(paysOut ? sdk.positions.healthFactor(snapshot, { safePrices: true }) : metrics.healthFactor);
285
+ assertCollateralised(paysOut ? sdk.positions.healthFactor(snapshot, { safePrices: true }) : metrics.healthFactor, paysOut);
274
286
  const state = {
275
287
  totalValue,
276
288
  accountDebt: debt,
@@ -297,10 +309,13 @@ async function realize(steps, props) {
297
309
  */
298
310
  async function delayedConfig(sdk, creditAccount, token) {
299
311
  const compressor = sdk.withdrawalCompressor;
300
- if (!compressor) throw new IntentPreviewError("noDelayedRoute", "request: chain has no withdrawal compressor");
312
+ if (!compressor) throw new IntentPreviewError("noDelayedRoute", { token }, "request: chain has no withdrawal compressor");
301
313
  const assets = await compressor.findWithdrawableAssets(creditAccount.creditManager, token);
302
- if (assets.length === 0) throw new IntentPreviewError("noDelayedRoute", `request: ${token} has no delayed withdrawal config`);
303
- if (assets.length > 1) throw new IntentPreviewError("multipleDelayedWithdrawals", `request: ${token} has ${assets.length} delayed withdrawal configs`);
314
+ if (assets.length === 0) throw new IntentPreviewError("noDelayedRoute", { token }, `request: ${token} has no delayed withdrawal config`);
315
+ if (assets.length > 1) throw new IntentPreviewError("multipleDelayedWithdrawals", {
316
+ token,
317
+ venues: assets.length
318
+ }, `request: ${token} has ${assets.length} delayed withdrawal configs`);
304
319
  return assets[0];
305
320
  }
306
321
  const callsOf = (operations) => operations.flatMap((op) => op.calls);
@@ -0,0 +1,26 @@
1
+ //#region src/onchain/accounts/intents/refusal.ts
2
+ /** Builds the refusal a caller sees. */
3
+ function refuse(reason, detail) {
4
+ return {
5
+ ok: false,
6
+ reason,
7
+ detail
8
+ };
9
+ }
10
+ /**
11
+ * Validation failure that maps onto {@link PreviewErrorReason} rather than
12
+ * crashing the caller: raised by the planners and the guards, turned into
13
+ * `{ ok: false }` by `CreditAccountOperationsService`.
14
+ */
15
+ var IntentPreviewError = class extends Error {
16
+ reason;
17
+ detail;
18
+ constructor(reason, detail, message) {
19
+ super(message ?? reason);
20
+ this.name = "IntentPreviewError";
21
+ this.reason = reason;
22
+ this.detail = detail;
23
+ }
24
+ };
25
+ //#endregion
26
+ export { IntentPreviewError, refuse };
@@ -1,4 +1,4 @@
1
- import { IntentPreviewError } from "./types.js";
1
+ import { IntentPreviewError } from "./refusal.js";
2
2
  import { createOraclePaths } from "./utils/router-path.js";
3
3
  import { planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw } from "./plan.js";
4
4
  import { instantOutput } from "./operations.js";
@@ -17,7 +17,7 @@ function planTail(args) {
17
17
  const { intent, claimable, view } = args;
18
18
  const claimed = () => {
19
19
  const output = instantOutput(claimable.outputs);
20
- if (!output) throw new IntentPreviewError("insufficientSourceBalance", "finishIntent: the claim credits nothing to spend");
20
+ if (!output) throw new IntentPreviewError("insufficientSourceBalance", void 0, "finishIntent: the claim credits nothing to spend");
21
21
  return output;
22
22
  };
23
23
  switch (intent.type) {
@@ -1,16 +1 @@
1
- //#region src/onchain/accounts/intents/types.ts
2
- /**
3
- * Validation failure that maps onto {@link PreviewErrorReason} rather than
4
- * crashing the caller: thrown by builders, converted to `{ ok: false }` by
5
- * `CreditAccountOperationsService.startIntent`.
6
- */
7
- var IntentPreviewError = class extends Error {
8
- reason;
9
- constructor(reason, message) {
10
- super(message ?? reason);
11
- this.name = "IntentPreviewError";
12
- this.reason = reason;
13
- }
14
- };
15
- //#endregion
16
- export { IntentPreviewError };
1
+ export {};
@@ -192,7 +192,7 @@ import "./market/index.js";
192
192
  import { CreditAccountCompressorV310Contract } from "./accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js";
193
193
  import { CreditAccountCompressor } from "./accounts/credit-account-compressor/CreditAccountCompressor.js";
194
194
  import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
195
- import { IntentPreviewError } from "./accounts/intents/types.js";
195
+ import { IntentPreviewError, refuse } from "./accounts/intents/refusal.js";
196
196
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./accounts/intents/utils/credit-account-slice.js";
197
197
  import { CreditAccountOperationsService } from "./accounts/intents/index.js";
198
198
  import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./accounts/liquidations/constants.js";
@@ -238,4 +238,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
238
238
  import { MultichainSDK } from "./MultichainSDK.js";
239
239
  import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
240
240
  import "./types/index.js";
241
- 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, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
241
+ 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, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, refuse, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -41,6 +41,15 @@ var BigIntMath = class {
41
41
  * @returns A non-positive bigint representation of `a`.
42
42
  */
43
43
  static neg = (a) => a > 0 ? a * -1n : a;
44
+ /**
45
+ * Divides rounding toward positive infinity.
46
+ *
47
+ * @param a - Dividend; must not be negative.
48
+ * @param b - Divisor; must be positive — zero throws, negative returns
49
+ * nonsense rather than the ceiling.
50
+ * @returns The smallest integer that is at least `a / b`.
51
+ **/
52
+ static ceilDiv = (a, b) => (a + b - 1n) / b;
44
53
  };
45
54
  //#endregion
46
55
  export { BigIntMath };
@@ -1,11 +1,11 @@
1
1
  import { toChainIds } from "../onchain/chain/chains.js";
2
2
  import { MultichainSDK } from "../onchain/MultichainSDK.js";
3
3
  import "../onchain/index.js";
4
+ import { GearboxAPI } from "../offchain/GearboxAPI.js";
5
+ import "../offchain/index.js";
4
6
  import { assertSameChains } from "./errors/assertSameChains.js";
5
7
  import { MissingSourceError } from "./errors/MissingSourceError.js";
6
8
  import "./errors/index.js";
7
- import { GearboxAPI } from "../offchain/GearboxAPI.js";
8
- import "../offchain/index.js";
9
9
  import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
10
10
  import "./liquidations/index.js";
11
11
  import "./utils/mergeChains.js";
@@ -1,5 +1,6 @@
1
1
  import { hexEq } from "../../onchain/utils/hex.js";
2
2
  import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
3
+ import { refuse } from "../../onchain/accounts/intents/refusal.js";
3
4
  import { fetchCreditAccountSlice } from "../../onchain/accounts/intents/utils/credit-account-slice.js";
4
5
  import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
5
6
  import "../../onchain/index.js";
@@ -35,10 +36,7 @@ var PrepareApi = class extends MultichainConstruct {
35
36
  network: position.chainId,
36
37
  run: async (sdk) => {
37
38
  const intent = resumable(params.intent ?? params.claimable.intent);
38
- if (!intent) return {
39
- ok: false,
40
- reason: "noRecordedIntent"
41
- };
39
+ if (!intent) return refuse("noRecordedIntent", void 0);
42
40
  return service(sdk).finishIntent({
43
41
  intent,
44
42
  claimable: params.claimable,
@@ -57,10 +55,7 @@ var PrepareApi = class extends MultichainConstruct {
57
55
  const { marketRegister, pools } = this.sdk.chain(pool.chainId);
58
56
  const tokenIn = params.tokenIn ?? marketRegister.findByPool(pool.pool).pool.underlying;
59
57
  const tokenOut = lpRoute(params.tokenOut, () => pools.getDepositTokensOut(pool.pool, tokenIn));
60
- if (!tokenOut) return {
61
- ok: false,
62
- reason: "unsupportedTokenPair"
63
- };
58
+ if (!tokenOut) return unroutable(tokenIn, void 0);
64
59
  const preview = pools.simulateDeposit({
65
60
  pool: pool.pool,
66
61
  amount: params.amount,
@@ -73,10 +68,7 @@ var PrepareApi = class extends MultichainConstruct {
73
68
  wallet: params.wallet,
74
69
  meta: pools.getDepositMetadata(pool.pool, tokenIn, tokenOut)
75
70
  });
76
- if (!call) return {
77
- ok: false,
78
- reason: "unsupportedTokenPair"
79
- };
71
+ if (!call) return unroutable(tokenIn, tokenOut);
80
72
  return {
81
73
  ok: true,
82
74
  operations: [],
@@ -91,10 +83,7 @@ var PrepareApi = class extends MultichainConstruct {
91
83
  const { pools } = this.sdk.chain(pool.chainId);
92
84
  const tokenIn = params.tokenIn ?? pool.pool;
93
85
  const tokenOut = lpRoute(params.tokenOut, () => pools.getWithdrawalTokensOut(pool.pool, tokenIn));
94
- if (!tokenOut) return {
95
- ok: false,
96
- reason: "unsupportedTokenPair"
97
- };
86
+ if (!tokenOut) return unroutable(tokenIn, void 0);
98
87
  const preview = pools.simulateWithdraw({
99
88
  pool: pool.pool,
100
89
  amount: params.amount,
@@ -123,10 +112,7 @@ var PrepareApi = class extends MultichainConstruct {
123
112
  const { pools } = this.sdk.chain(pool.chainId);
124
113
  const tokenIn = params.tokenIn ?? pool.pool;
125
114
  const tokenOut = lpRoute(params.tokenOut, () => pools.getWithdrawalTokensOut(pool.pool, tokenIn));
126
- if (!tokenOut) return {
127
- ok: false,
128
- reason: "unsupportedTokenPair"
129
- };
115
+ if (!tokenOut) return unroutable(tokenIn, void 0);
130
116
  const preview = pools.simulateRedeem({
131
117
  pool: pool.pool,
132
118
  amount: params.amount,
@@ -327,6 +313,19 @@ function resumable(intent) {
327
313
  return intent ?? void 0;
328
314
  }
329
315
  /**
316
+ * A pool route the market does not offer, as the refusal a caller reads.
317
+ *
318
+ * `to` is absent where {@link lpRoute} found no output to name at all, which
319
+ * is the usual way of it; both are present where a pair exists but nothing of
320
+ * ours implements it.
321
+ **/
322
+ function unroutable(from, to) {
323
+ return refuse("unsupportedTokenPair", {
324
+ from,
325
+ to
326
+ });
327
+ }
328
+ /**
330
329
  * Picks the route the operation takes out of `tokenIn`, as a value rather than
331
330
  * an exception: an unroutable or ambiguous pair is a request the caller can
332
331
  * fix, so it belongs in the `ok: false` half alongside the strategy refusals.
@@ -21,7 +21,8 @@ import { PeripheryCompressorV310Contract } from "./bots/PeripheryCompressorV310C
21
21
  import "./bots/index.js";
22
22
  import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
23
23
  import { OpenStrategyPreview, OpenStrategyProps } from "./intents/open-strategy.js";
24
- import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewError, IntentPreviewResult, IntentRoutesResult, OperationState, PreviewErrorReason, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./intents/types.js";
24
+ import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./intents/refusal.js";
25
+ import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./intents/types.js";
25
26
  import { AccountCalculatorOperation } from "./intents/operations.js";
26
27
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./intents/utils/credit-account-slice.js";
27
28
  import { CreditAccountOperationsService, OpenStrategyPreviewResult } from "./intents/index.js";
@@ -30,4 +31,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
30
31
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
31
32
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
32
33
  import "./liquidations/index.js";
33
- export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, 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, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, type PreviewErrorReason, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
34
+ export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, 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, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, refuse, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -12,6 +12,11 @@ import "../../index.js";
12
12
  * pool has run out of what it lends. On-chain those come back as a reverted
13
13
  * multicall with a selector no form can explain, so they are read from the
14
14
  * loaded market and reported as refusals instead.
15
+ *
16
+ * Every guard here refuses something the market decides rather than something
17
+ * the arithmetic cannot do, which is why all six of their reasons are
18
+ * `blocking`: the walk that hit one still reached an end state, and a caller
19
+ * gets that state alongside the refusal.
15
20
  */
16
21
  /**
17
22
  * The facade takes no multicall while it is paused or past its expiration, so
@@ -51,10 +56,23 @@ declare function assertGrowthAllowed(args: {
51
56
  * and reverts if the collateral does not cover it, so a plan that lands the
52
57
  * account below water is refused here.
53
58
  *
54
- * The bar is the health factor of the state the plan projects: collateral under
55
- * liquidation thresholds, capped by quota, against the debt. Note that a
56
- * position already underwater cannot be nursed back one step at a time — the
57
- * check is on where the transaction ends, not on whether it improved things.
59
+ * The bar is the facade's own `1.0`, because this guard answers one question:
60
+ * would the transaction revert. It is deliberately not `MIN_HF_LIMITED`, and
61
+ * the three bars in this codebase are three different jobs:
62
+ *
63
+ * - here, `1.0` — what the facade enforces, so what a plan must clear to land;
64
+ * - `maxWithdrawCollateral` sizes at `MIN_HF_LIMITED + 2` — a *sizing* helper
65
+ * leaving headroom, which is not the same as a validity check;
66
+ * - `validateHF` refuses at or below `MIN_HF_LIMITED` — a form's own caution.
67
+ *
68
+ * Raising this one to `MIN_HF_LIMITED` was tried and reverted: it made
69
+ * `maxWithdraw` hand back a ceiling this guard then refused, and it blocked
70
+ * small top-ups of an account sitting in `[1.0, 1.01)` — the very operations
71
+ * that rescue it. A form wanting the stricter bar has `validateHF`.
72
+ *
73
+ * Note that a position already underwater cannot be nursed back one step at a
74
+ * time — the check is on where the transaction ends, not on whether it
75
+ * improved things.
58
76
  *
59
77
  * @remarks
60
78
  * The caller decides the pricing the factor was computed at: main prices, or
@@ -62,7 +80,7 @@ declare function assertGrowthAllowed(args: {
62
80
  * whose reserve feed the SDK cannot read keeps its main price, so a plan can
63
81
  * still be refused on-chain after passing here.
64
82
  */
65
- declare function assertCollateralised(healthFactorBps: number): void;
83
+ declare function assertCollateralised(healthFactorBps: number, safePrices: boolean): void;
66
84
  /**
67
85
  * A quota can only be raised as far as the market still has room for: past the
68
86
  * token's limit the keeper takes nothing more, whoever is asking.
@@ -1,6 +1,7 @@
1
1
  import { SDKConstruct } from "../../base/SDKConstruct.js";
2
2
  import { OpenStrategyPreview, OpenStrategyProps } from "./open-strategy.js";
3
- import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewError, IntentPreviewResult, IntentRoutesResult, OperationState, PreviewErrorReason, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
3
+ import { IntentPreviewError, PreviewErrorDetails, PreviewErrorReason, PreviewRefusal, refuse } from "./refusal.js";
4
+ import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
4
5
  import { AccountCalculatorOperation } from "./operations.js";
5
6
  import { fetchCreditAccountSlice, toCreditAccountSlice } from "./utils/credit-account-slice.js";
6
7
  import { Address } from "viem";
@@ -15,10 +16,7 @@ import { Address } from "viem";
15
16
  type OpenStrategyPreviewResult = {
16
17
  ok: true;
17
18
  preview: OpenStrategyPreview;
18
- } | {
19
- ok: false;
20
- reason: PreviewErrorReason;
21
- };
19
+ } | PreviewRefusal;
22
20
  /** An intent plus everything previewing it needs. */
23
21
  type StartProps = StartIntentProps & {
24
22
  intent: StartIntent;
@@ -156,4 +154,4 @@ declare class CreditAccountOperationsService extends SDKConstruct {
156
154
  openStrategyIntent(props: OpenStrategyProps): Promise<OpenStrategyPreviewResult>;
157
155
  }
158
156
  //#endregion
159
- export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type FinishIntentProps, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, type PreviewErrorReason, type RepayStrategyIntent, type ResumableIntent, type RouteRefusals, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, fetchCreditAccountSlice, toCreditAccountSlice };
157
+ export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, CreditAccountOperationsService, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type FinishIntentProps, type InstantRoute, IntentPreviewError, type IntentPreviewResult, type IntentRoutesResult, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, type PreviewErrorDetails, type PreviewErrorReason, type PreviewRefusal, type RepayStrategyIntent, type ResumableIntent, type RouteRefusals, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, fetchCreditAccountSlice, refuse, toCreditAccountSlice };
@@ -1,3 +1,4 @@
1
+ import { Address } from "viem";
1
2
  //#region src/onchain/accounts/intents/math.d.ts
2
3
  /**
3
4
  * The whole arithmetic behind every intent, in underlying units.
@@ -41,6 +42,6 @@ declare function assertLeverageAtLeastOne(leverage: bigint): void;
41
42
  * Rejects a debt the facade would revert on: zero is always fine (no loan at
42
43
  * all), anything else has to sit inside `[minDebt, maxDebt]`.
43
44
  */
44
- declare function assertDebtInBand(debt: bigint, band: DebtBand): void;
45
+ declare function assertDebtInBand(debt: bigint, band: DebtBand, underlying: Address): void;
45
46
  //#endregion
46
47
  export { DebtBand, Position, assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage, maxProportionalWithdrawal, proportionalDebt };