@gearbox-protocol/sdk 18.4.0 → 18.4.1-aave.1

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 (134) hide show
  1. package/dist/cjs/model/index.js +1 -4
  2. package/dist/cjs/offchain/GearboxAPI.js +0 -7
  3. package/dist/cjs/offchain/index.js +0 -3
  4. package/dist/cjs/onchain/accounts/intents/index.js +1 -0
  5. package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
  6. package/dist/cjs/onchain/accounts/intents/plan.js +33 -0
  7. package/dist/cjs/onchain/accounts/intents/realize.js +44 -0
  8. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
  9. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  10. package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
  11. package/dist/cjs/onchain/chain/chains.js +4 -0
  12. package/dist/cjs/onchain/index.js +12 -0
  13. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
  14. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +112 -0
  15. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +5 -0
  16. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
  17. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +197 -0
  18. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
  19. package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +4 -0
  20. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  21. package/dist/cjs/onchain/market/adapters/abi/index.js +9 -0
  22. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +130 -0
  23. package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +205 -0
  24. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  25. package/dist/cjs/onchain/market/adapters/contracts/index.js +4 -0
  26. package/dist/cjs/onchain/market/adapters/createAdapter.js +4 -0
  27. package/dist/cjs/onchain/market/adapters/index.js +12 -0
  28. package/dist/cjs/onchain/market/adapters/types.js +2 -0
  29. package/dist/cjs/onchain/market/index.js +12 -0
  30. package/dist/cjs/onchain/positions/projectAavePosition.js +40 -0
  31. package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
  32. package/dist/cjs/onchain/preview/preview/previewOperation.js +2 -0
  33. package/dist/cjs/sdk/GearboxSDK.js +0 -9
  34. package/dist/cjs/sdk/prepare/PrepareApi.js +39 -0
  35. package/dist/cjs/sdk/preview/PreviewNamespace.js +33 -0
  36. package/dist/esm/model/index.js +2 -3
  37. package/dist/esm/offchain/GearboxAPI.js +0 -7
  38. package/dist/esm/offchain/index.js +1 -3
  39. package/dist/esm/onchain/accounts/intents/index.js +2 -1
  40. package/dist/esm/onchain/accounts/intents/operations.js +20 -1
  41. package/dist/esm/onchain/accounts/intents/plan.js +33 -1
  42. package/dist/esm/onchain/accounts/intents/realize.js +46 -2
  43. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
  44. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  45. package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
  46. package/dist/esm/onchain/chain/chains.js +4 -0
  47. package/dist/esm/onchain/index.js +7 -1
  48. package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
  49. package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +111 -0
  50. package/dist/esm/onchain/market/adapters/abi/aave/index.js +3 -0
  51. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
  52. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +196 -0
  53. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
  54. package/dist/esm/onchain/market/adapters/abi/adapters/index.js +3 -1
  55. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  56. package/dist/esm/onchain/market/adapters/abi/index.js +6 -1
  57. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +129 -0
  58. package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +204 -0
  59. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  60. package/dist/esm/onchain/market/adapters/contracts/index.js +3 -1
  61. package/dist/esm/onchain/market/adapters/createAdapter.js +4 -0
  62. package/dist/esm/onchain/market/adapters/index.js +7 -1
  63. package/dist/esm/onchain/market/adapters/types.js +2 -0
  64. package/dist/esm/onchain/market/index.js +7 -1
  65. package/dist/esm/onchain/positions/projectAavePosition.js +39 -0
  66. package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
  67. package/dist/esm/onchain/preview/preview/previewOperation.js +2 -0
  68. package/dist/esm/sdk/GearboxSDK.js +0 -9
  69. package/dist/esm/sdk/prepare/PrepareApi.js +39 -0
  70. package/dist/esm/sdk/preview/PreviewNamespace.js +33 -0
  71. package/dist/types/model/aave.d.ts +32 -0
  72. package/dist/types/model/analytics.d.ts +2 -2
  73. package/dist/types/model/index.d.ts +6 -7
  74. package/dist/types/model/opportunities.d.ts +1 -1
  75. package/dist/types/model/positions.d.ts +1 -1
  76. package/dist/types/model/previews.d.ts +15 -0
  77. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
  78. package/dist/types/offchain/GearboxAPI.d.ts +0 -6
  79. package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
  80. package/dist/types/offchain/analytics/types.d.ts +1 -1
  81. package/dist/types/offchain/index.d.ts +1 -3
  82. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
  83. package/dist/types/offchain/opportunities/types.d.ts +1 -1
  84. package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
  85. package/dist/types/offchain/positions/types.d.ts +1 -1
  86. package/dist/types/onchain/accounts/intents/operations.d.ts +37 -1
  87. package/dist/types/onchain/accounts/intents/plan.d.ts +26 -1
  88. package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
  89. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
  90. package/dist/types/onchain/accounts/intents/types.d.ts +20 -1
  91. package/dist/types/onchain/index.d.ts +7 -1
  92. package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
  93. package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +90 -0
  94. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +3 -0
  95. package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +186 -0
  96. package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
  97. package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +3 -1
  98. package/dist/types/onchain/market/adapters/abi/index.d.ts +6 -1
  99. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +312 -0
  100. package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +312 -0
  101. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
  102. package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
  103. package/dist/types/onchain/market/adapters/index.d.ts +7 -1
  104. package/dist/types/onchain/market/adapters/types.d.ts +3 -1
  105. package/dist/types/onchain/market/index.d.ts +7 -1
  106. package/dist/types/onchain/positions/projectAavePosition.d.ts +16 -0
  107. package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
  108. package/dist/types/sdk/GearboxSDK.d.ts +1 -8
  109. package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
  110. package/dist/types/sdk/analytics/types.d.ts +1 -1
  111. package/dist/types/sdk/index.d.ts +3 -3
  112. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  113. package/dist/types/sdk/opportunities/types.d.ts +1 -1
  114. package/dist/types/sdk/positions/PositionsNamespace.d.ts +1 -1
  115. package/dist/types/sdk/positions/types.d.ts +1 -1
  116. package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
  117. package/dist/types/sdk/prepare/index.d.ts +2 -2
  118. package/dist/types/sdk/prepare/types.d.ts +56 -1
  119. package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
  120. package/dist/types/sdk/preview/types.d.ts +10 -1
  121. package/dist/types/sdk/types.d.ts +0 -20
  122. package/package.json +1 -1
  123. package/dist/cjs/model/notices.schema.js +0 -25
  124. package/dist/cjs/offchain/notices/OffchainNotices.js +0 -27
  125. package/dist/cjs/offchain/notices/index.js +0 -3
  126. package/dist/esm/model/notices.schema.js +0 -23
  127. package/dist/esm/offchain/notices/OffchainNotices.js +0 -26
  128. package/dist/esm/offchain/notices/index.js +0 -1
  129. package/dist/types/model/notices.d.ts +0 -28
  130. package/dist/types/model/notices.schema.d.ts +0 -22
  131. package/dist/types/offchain/notices/OffchainNotices.d.ts +0 -18
  132. package/dist/types/offchain/notices/index.d.ts +0 -2
  133. /package/dist/cjs/model/{notices.js → aave.js} +0 -0
  134. /package/dist/esm/model/{notices.js → aave.js} +0 -0
@@ -17,7 +17,7 @@ import { maxBorrow } from "./maxBorrow.js";
17
17
  import { maxBorrowAndWithdraw } from "./maxBorrowAndWithdraw.js";
18
18
  import { maxWithdrawCollateral } from "./maxWithdrawCollateral.js";
19
19
  import { buildOpenStrategyState } from "./open-strategy.js";
20
- import { planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planBorrowAndWithdraw, planDeposit, planRepay, planUpdateQuota, planWithdraw, planWithdrawAsset, planWithdrawDelayed } from "./plan.js";
20
+ import { planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planBorrowAndWithdraw, planDeposit, planMoveToAave, planRepay, planUpdateQuota, planWithdraw, planWithdrawAsset, planWithdrawDelayed } from "./plan.js";
21
21
  import { withdrawLimits } from "./withdraw-limits.js";
22
22
  import { realize } from "./realize.js";
23
23
  import { planTail, projectTail } from "./tail.js";
@@ -65,6 +65,7 @@ var CreditAccountOperationsService = class extends SDKConstruct {
65
65
  case "ADJUST_LEVERAGE": return planAdjustLeverage(intent, view);
66
66
  case "DEPOSIT": return planDeposit(intent, view);
67
67
  case "REPAY": return planRepay(intent, view);
68
+ case "MOVE_TO_AAVE": return planMoveToAave(intent, view);
68
69
  case "WITHDRAW": return planWithdraw(intent, view);
69
70
  case "UPDATE_QUOTA": return planUpdateQuota(intent, view);
70
71
  default: throw new Error(`${intent.type} - not implemented`);
@@ -134,6 +134,25 @@ function buildClaimDelayedWithdrawalOperation(input) {
134
134
  })
135
135
  };
136
136
  }
137
+ function buildAaveSupplyOperation(input) {
138
+ return {
139
+ type: "aaveSupply",
140
+ token: input.token,
141
+ aToken: input.aToken,
142
+ amount: input.amount,
143
+ calls: [input.adapter.supplyCall(input.token, input.amount)]
144
+ };
145
+ }
146
+ function buildAaveOpenPositionOperation(input) {
147
+ return {
148
+ type: "aaveOpenPosition",
149
+ aToken: input.aToken,
150
+ aTokenAmount: input.aTokenAmount,
151
+ debtToken: input.debtToken,
152
+ borrowAmount: input.borrowAmount,
153
+ calls: [input.adapter.openPositionCall(input.aToken, input.debtToken, input.aTokenAmount, input.borrowAmount)]
154
+ };
155
+ }
137
156
  /**
138
157
  * What a request or a claim puts on the account right away, as opposed to what
139
158
  * only the phantom token represents.
@@ -149,4 +168,4 @@ function instantOutput(outputs, token) {
149
168
  }
150
169
  }
151
170
  //#endregion
152
- export { buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput };
171
+ export { buildAaveOpenPositionOperation, buildAaveSupplyOperation, buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput };
@@ -104,6 +104,38 @@ function planRepay(intent, view) {
104
104
  ];
105
105
  }
106
106
  /**
107
+ * The position leaves for Aave Horizon: the RWA is supplied to the Aave pool,
108
+ * its aTokens go to the owner with a loan against them, and that loan settles
109
+ * the account's own.
110
+ *
111
+ * Aave lends the debt plus the {@link SETTLE_MARGIN} headroom, since the facade
112
+ * is told to repay everything outstanding by the time the transaction lands;
113
+ * what it does not take stays on the account.
114
+ */
115
+ function planMoveToAave(intent, view) {
116
+ const amount = view.balanceOf(intent.token);
117
+ if (eq(intent.token, view.underlying) || isZeroBalance(amount)) throw new IntentPreviewError(unsupportedCollateralToken(toToken(view.sdk, intent.token)), `moveToAave: ${intent.token} is the underlying or not held by the account`);
118
+ if (view.debt <= 0n) throw new IntentPreviewError(debtOutOfRange({
119
+ requested: toTokenAmount(view.sdk, view.underlying, view.debt),
120
+ minDebt: toTokenAmount(view.sdk, view.underlying, view.debtLimits.minDebt),
121
+ maxDebt: toTokenAmount(view.sdk, view.underlying, view.debtLimits.maxDebt)
122
+ }), "moveToAave: the account owes nothing");
123
+ return [
124
+ {
125
+ kind: "aaveSupply",
126
+ token: intent.token,
127
+ amount
128
+ },
129
+ {
130
+ kind: "aaveOpenPosition",
131
+ token: intent.token,
132
+ borrow: withMargin(view.debt)
133
+ },
134
+ clearQuotas(),
135
+ repay(view.debt)
136
+ ];
137
+ }
138
+ /**
107
139
  * One token's quota changes; no balance moves and debt is untouched.
108
140
  *
109
141
  * Only a token the account holds can be quoted here, and only on an account
@@ -445,4 +477,4 @@ function assertPositive(amount, flow) {
445
477
  if (amount <= 0n) throw new IntentPreviewError(insufficientBalance(), `${flow}: amount must be positive`);
446
478
  }
447
479
  //#endregion
448
- export { RAISED, planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planBorrowAndWithdraw, planDeposit, planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw, planRepay, planUpdateQuota, planWithdraw, planWithdrawAsset, planWithdrawDelayed };
480
+ export { RAISED, planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planBorrowAndWithdraw, planDeposit, planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw, planMoveToAave, planRepay, planUpdateQuota, planWithdraw, planWithdrawAsset, planWithdrawDelayed };
@@ -1,7 +1,9 @@
1
1
  import { getDirectTransferToken } from "../../chain/chains.js";
2
2
  import { PERCENTAGE_FACTOR_1KK } from "../../constants/math.js";
3
+ import { AaveHorizonBridgeAdapterContract } from "../../market/adapters/contracts/AaveHorizonBridgeAdapterContract.js";
4
+ import { AaveV3PoolAdapterContract } from "../../market/adapters/contracts/AaveV3PoolAdapterContract.js";
3
5
  import { insufficientBalance } from "../../../model/errors/operation-errors.js";
4
- import { multipleDelayedWithdrawals, noDelayedRoute, withdrawalInProgress } from "../../../model/errors/prepare-errors.js";
6
+ import { multipleDelayedWithdrawals, noDelayedRoute, unsupportedCollateralToken, withdrawalInProgress } from "../../../model/errors/prepare-errors.js";
5
7
  import "../../../model/index.js";
6
8
  import { toToken, toTokenAmount } from "../../validation/helpers/token.js";
7
9
  import { IntentPreviewError } from "../../validation/raise.js";
@@ -12,7 +14,7 @@ import { OperationLedger } from "./utils/ledger.js";
12
14
  import { collectPriceImpact } from "./utils/price-impact.js";
13
15
  import { clearedQuotas, getQuotasForUpdate, quotasAfterUpdate, withDirectTransferQuota } from "./utils/quotas-for-update.js";
14
16
  import { createRouterPaths } from "./utils/router-path.js";
15
- import { buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput } from "./operations.js";
17
+ import { buildAaveOpenPositionOperation, buildAaveSupplyOperation, buildAddCollateralOperation, buildClaimDelayedWithdrawalOperation, buildCloseSwapOperation, buildDecreaseDebtOperation, buildIncreaseDebtOperation, buildQuotaUpdateOperation, buildStartDelayedWithdrawalOperation, buildSwapOperation, buildUnwrapRwaCollateralOperation, buildWithdrawCollateralOperation, buildWrapRwaCollateralOperation, instantOutput } from "./operations.js";
16
18
  import { resolveQuotaUpdate } from "./resolveQuotaUpdate.js";
17
19
  import { withdrawLimits } from "./withdraw-limits.js";
18
20
  //#region src/onchain/accounts/intents/realize.ts
@@ -353,6 +355,33 @@ async function realize(steps, props) {
353
355
  }
354
356
  break;
355
357
  }
358
+ case "aaveSupply": {
359
+ assertHolds(step.token, step.amount, "aaveSupply");
360
+ const adapter = aavePoolAdapter(sdk, suite, step.token);
361
+ push(buildAaveSupplyOperation({
362
+ adapter,
363
+ token: step.token,
364
+ aToken: await adapter.aToken(step.token),
365
+ amount: step.amount
366
+ }));
367
+ break;
368
+ }
369
+ case "aaveOpenPosition": {
370
+ const aToken = await aavePoolAdapter(sdk, suite, step.token).aToken(step.token);
371
+ const aTokenAmount = ledger.balanceOf(aToken);
372
+ assertHolds(aToken, aTokenAmount, "aaveOpenPosition");
373
+ push(buildAaveOpenPositionOperation({
374
+ adapter: aaveBridgeAdapter(sdk, suite, step.token, {
375
+ aToken,
376
+ debtToken: underlying
377
+ }),
378
+ aToken,
379
+ aTokenAmount,
380
+ debtToken: underlying,
381
+ borrowAmount: step.borrow
382
+ }));
383
+ break;
384
+ }
356
385
  }
357
386
  const floor = ledger.snapshot();
358
387
  const { assets, debt } = floor;
@@ -475,6 +504,21 @@ async function delayedConfig(sdk, creditAccount, token) {
475
504
  if (assets.length > 1) throw new IntentPreviewError(multipleDelayedWithdrawals(toToken(sdk, token), assets.length), `request: ${token} has ${assets.length} delayed withdrawal configs`);
476
505
  return assets[0];
477
506
  }
507
+ /** The credit manager's Aave pool adapter that lists `token`. */
508
+ function aavePoolAdapter(sdk, suite, token) {
509
+ const adapter = suite.creditManager.adapters.values().find((a) => a instanceof AaveV3PoolAdapterContract && a.isAssetAllowed(token));
510
+ if (!adapter) throw new IntentPreviewError(unsupportedCollateralToken(toToken(sdk, token)), `aaveSupply: no Aave pool adapter lists ${token}`);
511
+ return adapter;
512
+ }
513
+ /**
514
+ * The credit manager's Horizon bridge adapter that takes `aToken` and lends
515
+ * `debtToken`. Refused on `token`, the collateral the aToken stands for.
516
+ */
517
+ function aaveBridgeAdapter(sdk, suite, token, pair) {
518
+ const adapter = suite.creditManager.adapters.values().find((a) => a instanceof AaveHorizonBridgeAdapterContract && a.isATokenAllowed(pair.aToken) && a.isDebtTokenAllowed(pair.debtToken));
519
+ if (!adapter) throw new IntentPreviewError(unsupportedCollateralToken(toToken(sdk, token)), `aaveOpenPosition: no Horizon bridge adapter takes ${pair.aToken} against ${pair.debtToken}`);
520
+ return adapter;
521
+ }
478
522
  const callsOf = (operations) => operations.flatMap((op) => op.calls);
479
523
  const min = (a, b) => a < b ? a : b;
480
524
  /** Balance the router's close path refuses to route, and leaves in place. */
@@ -114,6 +114,7 @@ function buildMarketSdk(extras) {
114
114
  debtLimitAvailable: extras?.debtLimitAvailable,
115
115
  maxDebtPerBlockMultiplier: extras?.maxDebtPerBlockMultiplier,
116
116
  forbiddenTokens: extras?.forbiddenTokens,
117
+ adapters: extras?.adapters,
117
118
  strategyTargetCollateral: POS
118
119
  });
119
120
  }
@@ -211,7 +211,8 @@ function buildMockSdk(args) {
211
211
  collateralTokens,
212
212
  feeInterest: args.feeInterest ?? 0,
213
213
  maxEnabledTokens: args.maxEnabledTokens ?? 4,
214
- maxLeverage: (collateral, targetHF) => calcMaxLeverage(liquidationThresholds.get(collateral) ?? 0, targetHF)
214
+ maxLeverage: (collateral, targetHF) => calcMaxLeverage(liquidationThresholds.get(collateral) ?? 0, targetHF),
215
+ adapters: { values: () => args.adapters ?? [] }
215
216
  },
216
217
  creditFacade: {
217
218
  address: args.creditFacade,
@@ -79,6 +79,14 @@ var OperationLedger = class {
79
79
  case "claimDelayedWithdrawal":
80
80
  this.#add(op.withdrawalPhantomToken, -op.withdrawalTokenSpent);
81
81
  for (const out of op.outputs) this.#add(out.token, out.amount);
82
+ break;
83
+ case "aaveSupply":
84
+ this.#add(op.token, -op.amount);
85
+ this.#add(op.aToken, op.amount);
86
+ break;
87
+ case "aaveOpenPosition":
88
+ this.#add(op.aToken, -op.aTokenAmount);
89
+ this.#add(op.debtToken, op.borrowAmount);
82
90
  }
83
91
  return this;
84
92
  }
@@ -354,6 +354,10 @@ const chains = {
354
354
  }),
355
355
  Lisk: defineChain({
356
356
  ...lisk,
357
+ rpcUrls: {
358
+ ...lisk.rpcUrls,
359
+ tenderly: { http: ["https://lisk.gateway.tenderly.co"] }
360
+ },
357
361
  network: "Lisk",
358
362
  defaultMarketConfigurators: AddressMap.fromRecord({ "0x25778dbf0e56b7feb8358c4aa2f6f9e19a1c145a": "Re7" }),
359
363
  rwaFactories: [],
@@ -45,9 +45,13 @@ import { VotingContractStatus } from "./base/types.js";
45
45
  import "./base/index.js";
46
46
  import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
47
47
  import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
48
+ import { iAaveHorizonBridgeAbi } from "./market/adapters/abi/aave/iAaveHorizonBridge.js";
49
+ import { iAaveV3PoolAbi } from "./market/adapters/abi/aave/iAaveV3Pool.js";
48
50
  import { AdapterType } from "./market/adapters/types.js";
49
51
  import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./market/adapters/abi/actionAbi.js";
50
52
  import { erc4626ReferralAdapterAbi } from "./market/adapters/abi/adapters/erc4626ReferralAdapter.js";
53
+ import { iAaveHorizonBridgeAdapterAbi } from "./market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js";
54
+ import { iAaveV3PoolAdapterAbi } from "./market/adapters/abi/adapters/iAaveV3PoolAdapter.js";
51
55
  import { iBalancerV3RouterAdapterAbi } from "./market/adapters/abi/adapters/iBalancerV3RouterAdapter.js";
52
56
  import { iBalancerV3WrapperAdapterAbi } from "./market/adapters/abi/adapters/iBalancerV3WrapperAdapter.js";
53
57
  import { iCamelotV3AdapterAbi } from "./market/adapters/abi/adapters/iCamelotV3Adapter.js";
@@ -97,6 +101,8 @@ import { iTreehouseRouterAbi } from "./market/adapters/abi/treehouse/iTreehouseR
97
101
  import { getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, parseAdapterAction, parseAdapterDeployParams } from "./market/adapters/abi/utils.js";
98
102
  import { allTransfersAsTokenAmounts, classifyCurveOperation, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, fnSigToName, parsePosNegAmount, rewardsFromTransfers, swapFromTransfers, toNetTransfers } from "./market/adapters/transferHelpers.js";
99
103
  import { AbstractAdapterContract } from "./market/adapters/contracts/AbstractAdapter.js";
104
+ import { AaveHorizonBridgeAdapterContract } from "./market/adapters/contracts/AaveHorizonBridgeAdapterContract.js";
105
+ import { AaveV3PoolAdapterContract } from "./market/adapters/contracts/AaveV3PoolAdapterContract.js";
100
106
  import { AccountMigratorAdapterContract } from "./market/adapters/contracts/AccountMigratorAdapterContract.js";
101
107
  import { BalancerV3PoolStatus, BalancerV3RouterAdapterContract } from "./market/adapters/contracts/BalancerV3RouterAdapterContract.js";
102
108
  import { BalancerV3WrapperAdapterContract } from "./market/adapters/contracts/BalancerV3WrapperAdapterContract.js";
@@ -320,4 +326,4 @@ import { replayMulticall } from "./preview/preview/replayMulticall.js";
320
326
  import { previewOperation } from "./preview/preview/previewOperation.js";
321
327
  import "./preview/index.js";
322
328
  import "./types/index.js";
323
- 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_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, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, 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, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, 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, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, 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, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, 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, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
329
+ 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_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, 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, ConstantPriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_QUOTA_MULTIPLIER, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, 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, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_COMPRESSOR_ADDRESS, 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, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, 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, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getDirectTransferToken, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, 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, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, maxAmountForQuota, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, partialLiquidationParams, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, updatableDependencies, usdToNumber, watchBlocksAsync };
@@ -0,0 +1,93 @@
1
+ //#region src/onchain/market/adapters/abi/aave/iAaveHorizonBridge.ts
2
+ const iAaveHorizonBridgeAbi = [
3
+ {
4
+ name: "contractType",
5
+ type: "function",
6
+ stateMutability: "view",
7
+ inputs: [],
8
+ outputs: [{ type: "bytes32" }]
9
+ },
10
+ {
11
+ name: "version",
12
+ type: "function",
13
+ stateMutability: "view",
14
+ inputs: [],
15
+ outputs: [{ type: "uint256" }]
16
+ },
17
+ {
18
+ name: "pool",
19
+ type: "function",
20
+ stateMutability: "view",
21
+ inputs: [],
22
+ outputs: [{ type: "address" }]
23
+ },
24
+ {
25
+ name: "rwaATokenManager",
26
+ type: "function",
27
+ stateMutability: "view",
28
+ inputs: [],
29
+ outputs: [{ type: "address" }]
30
+ },
31
+ {
32
+ name: "referralCode",
33
+ type: "function",
34
+ stateMutability: "view",
35
+ inputs: [],
36
+ outputs: [{ type: "uint16" }]
37
+ },
38
+ {
39
+ name: "openPosition",
40
+ type: "function",
41
+ stateMutability: "nonpayable",
42
+ inputs: [
43
+ {
44
+ type: "address",
45
+ name: "aToken"
46
+ },
47
+ {
48
+ type: "address",
49
+ name: "debtToken"
50
+ },
51
+ {
52
+ type: "uint256",
53
+ name: "aTokenAmount"
54
+ },
55
+ {
56
+ type: "uint256",
57
+ name: "borrowAmount"
58
+ }
59
+ ],
60
+ outputs: []
61
+ },
62
+ {
63
+ name: "closePosition",
64
+ type: "function",
65
+ stateMutability: "nonpayable",
66
+ inputs: [
67
+ {
68
+ type: "address",
69
+ name: "aToken"
70
+ },
71
+ {
72
+ type: "address",
73
+ name: "debtToken"
74
+ },
75
+ {
76
+ type: "uint256",
77
+ name: "repayAmount"
78
+ },
79
+ {
80
+ type: "uint256",
81
+ name: "aTokenAmount"
82
+ }
83
+ ],
84
+ outputs: []
85
+ },
86
+ {
87
+ name: "CreditAccountOwnerIsCreditAccountException",
88
+ type: "error",
89
+ inputs: []
90
+ }
91
+ ];
92
+ //#endregion
93
+ export { iAaveHorizonBridgeAbi };
@@ -0,0 +1,111 @@
1
+ //#region src/onchain/market/adapters/abi/aave/iAaveV3Pool.ts
2
+ const iAaveV3PoolAbi = [
3
+ {
4
+ name: "supply",
5
+ type: "function",
6
+ stateMutability: "nonpayable",
7
+ inputs: [
8
+ {
9
+ type: "address",
10
+ name: "asset"
11
+ },
12
+ {
13
+ type: "uint256",
14
+ name: "amount"
15
+ },
16
+ {
17
+ type: "address",
18
+ name: "onBehalfOf"
19
+ },
20
+ {
21
+ type: "uint16",
22
+ name: "referralCode"
23
+ }
24
+ ],
25
+ outputs: []
26
+ },
27
+ {
28
+ name: "withdraw",
29
+ type: "function",
30
+ stateMutability: "nonpayable",
31
+ inputs: [
32
+ {
33
+ type: "address",
34
+ name: "asset"
35
+ },
36
+ {
37
+ type: "uint256",
38
+ name: "amount"
39
+ },
40
+ {
41
+ type: "address",
42
+ name: "to"
43
+ }
44
+ ],
45
+ outputs: [{ type: "uint256" }]
46
+ },
47
+ {
48
+ name: "borrow",
49
+ type: "function",
50
+ stateMutability: "nonpayable",
51
+ inputs: [
52
+ {
53
+ type: "address",
54
+ name: "asset"
55
+ },
56
+ {
57
+ type: "uint256",
58
+ name: "amount"
59
+ },
60
+ {
61
+ type: "uint256",
62
+ name: "interestRateMode"
63
+ },
64
+ {
65
+ type: "uint16",
66
+ name: "referralCode"
67
+ },
68
+ {
69
+ type: "address",
70
+ name: "onBehalfOf"
71
+ }
72
+ ],
73
+ outputs: []
74
+ },
75
+ {
76
+ name: "repay",
77
+ type: "function",
78
+ stateMutability: "nonpayable",
79
+ inputs: [
80
+ {
81
+ type: "address",
82
+ name: "asset"
83
+ },
84
+ {
85
+ type: "uint256",
86
+ name: "amount"
87
+ },
88
+ {
89
+ type: "uint256",
90
+ name: "interestRateMode"
91
+ },
92
+ {
93
+ type: "address",
94
+ name: "onBehalfOf"
95
+ }
96
+ ],
97
+ outputs: [{ type: "uint256" }]
98
+ },
99
+ {
100
+ name: "getReserveAToken",
101
+ type: "function",
102
+ stateMutability: "view",
103
+ inputs: [{
104
+ type: "address",
105
+ name: "asset"
106
+ }],
107
+ outputs: [{ type: "address" }]
108
+ }
109
+ ];
110
+ //#endregion
111
+ export { iAaveV3PoolAbi };
@@ -0,0 +1,3 @@
1
+ import { iAaveHorizonBridgeAbi } from "./iAaveHorizonBridge.js";
2
+ import { iAaveV3PoolAbi } from "./iAaveV3Pool.js";
3
+ export { iAaveHorizonBridgeAbi, iAaveV3PoolAbi };
@@ -7,6 +7,7 @@ import { parseAbi, toFunctionSelector } from "viem";
7
7
  * Based on the actual encodeAbiParameters calls in the adapter implementations
8
8
  */
9
9
  const adapterActionSignatures = {
10
+ ["AAVE_V3_POOL"]: { 311: "function setAssetStatusBatch((address,bool)[])" },
10
11
  ["BALANCER_V3_ROUTER"]: {
11
12
  310: "function setPoolStatusBatch(address[],bool[])",
12
13
  311: "function setPoolStatusBatch((address,uint8)[])"