@gearbox-protocol/sdk 18.4.1-aave.2 → 18.4.1-aave.3

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 (70) hide show
  1. package/dist/cjs/model/errors/index.js +1 -0
  2. package/dist/cjs/model/errors/operation-errors.js +9 -0
  3. package/dist/cjs/model/index.js +1 -0
  4. package/dist/cjs/onchain/accounts/intents/plan.js +6 -1
  5. package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
  6. package/dist/cjs/onchain/index.js +6 -0
  7. package/dist/cjs/onchain/market/adapters/abi/aave/iVariableDebtToken.js +17 -0
  8. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +2 -0
  9. package/dist/cjs/onchain/market/adapters/abi/index.js +2 -0
  10. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +18 -0
  11. package/dist/cjs/onchain/market/adapters/index.js +2 -0
  12. package/dist/cjs/onchain/market/index.js +2 -0
  13. package/dist/cjs/onchain/positions/projectAavePosition.js +4 -2
  14. package/dist/cjs/onchain/preview/index.js +2 -0
  15. package/dist/cjs/onchain/preview/preview/aaveBridgeBorrows.js +24 -0
  16. package/dist/cjs/onchain/preview/preview/index.js +2 -0
  17. package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  18. package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +3 -0
  19. package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
  20. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +34 -11
  21. package/dist/cjs/onchain/validation/bundles/index.js +2 -0
  22. package/dist/cjs/onchain/validation/checkOperation.js +16 -4
  23. package/dist/cjs/onchain/validation/index.js +2 -0
  24. package/dist/cjs/sdk/prepare/PrepareApi.js +2 -1
  25. package/dist/esm/model/errors/index.js +2 -2
  26. package/dist/esm/model/errors/operation-errors.js +9 -1
  27. package/dist/esm/model/index.js +2 -2
  28. package/dist/esm/onchain/accounts/intents/plan.js +6 -1
  29. package/dist/esm/onchain/accounts/intents/tail.js +1 -1
  30. package/dist/esm/onchain/index.js +4 -1
  31. package/dist/esm/onchain/market/adapters/abi/aave/iVariableDebtToken.js +16 -0
  32. package/dist/esm/onchain/market/adapters/abi/aave/index.js +2 -1
  33. package/dist/esm/onchain/market/adapters/abi/index.js +2 -1
  34. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +18 -0
  35. package/dist/esm/onchain/market/adapters/index.js +2 -1
  36. package/dist/esm/onchain/market/index.js +2 -1
  37. package/dist/esm/onchain/positions/projectAavePosition.js +4 -2
  38. package/dist/esm/onchain/preview/index.js +2 -1
  39. package/dist/esm/onchain/preview/preview/aaveBridgeBorrows.js +23 -0
  40. package/dist/esm/onchain/preview/preview/index.js +2 -1
  41. package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  42. package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +3 -0
  43. package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
  44. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +34 -11
  45. package/dist/esm/onchain/validation/bundles/index.js +2 -1
  46. package/dist/esm/onchain/validation/checkOperation.js +16 -4
  47. package/dist/esm/onchain/validation/index.js +2 -1
  48. package/dist/esm/sdk/prepare/PrepareApi.js +2 -1
  49. package/dist/types/model/aave.d.ts +15 -0
  50. package/dist/types/model/errors/index.d.ts +2 -2
  51. package/dist/types/model/errors/operation-errors.d.ts +19 -0
  52. package/dist/types/model/index.d.ts +3 -3
  53. package/dist/types/model/previews.d.ts +11 -1
  54. package/dist/types/onchain/accounts/intents/types.d.ts +5 -0
  55. package/dist/types/onchain/index.d.ts +4 -1
  56. package/dist/types/onchain/market/adapters/abi/aave/iVariableDebtToken.d.ts +17 -0
  57. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +2 -1
  58. package/dist/types/onchain/market/adapters/abi/index.d.ts +2 -1
  59. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +8 -0
  60. package/dist/types/onchain/market/adapters/index.d.ts +2 -1
  61. package/dist/types/onchain/market/index.d.ts +2 -1
  62. package/dist/types/onchain/preview/index.d.ts +2 -1
  63. package/dist/types/onchain/preview/preview/aaveBridgeBorrows.d.ts +15 -0
  64. package/dist/types/onchain/preview/preview/index.d.ts +2 -1
  65. package/dist/types/onchain/validation/bundles/checkAaveDelegation.d.ts +21 -0
  66. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
  67. package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
  68. package/dist/types/onchain/validation/index.d.ts +2 -1
  69. package/dist/types/sdk/prepare/types.d.ts +17 -6
  70. package/package.json +1 -1
@@ -16,7 +16,7 @@ import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analy
16
16
  import "./curators.js";
17
17
  import "./delayed-intents.js";
18
18
  import { creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./errors/liquidation-errors.js";
19
- import { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
19
+ import { accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
20
20
  import { unpriceableTokenError } from "./errors/oracle-errors.js";
21
21
  import { creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
22
22
  import { malformedTransaction } from "./errors/preview-errors.js";
@@ -32,4 +32,4 @@ import { safeValue, sdkErr, sdkOk } from "./result.js";
32
32
  import "./rewards.js";
33
33
  import "./withdrawals.js";
34
34
  import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
35
- export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
35
+ export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
@@ -7,6 +7,7 @@ import { toToken, toTokenAmount } from "../../validation/helpers/token.js";
7
7
  import { IntentPreviewError } from "../../validation/raise.js";
8
8
  import { eq, toTargetDecimals } from "./utils/common.js";
9
9
  import { assertDebtLimits, assertLeverageAtLeastOne, debtForLeverage, proportionalDebt } from "./math.js";
10
+ import { instantOutput } from "./operations.js";
10
11
  //#region src/onchain/accounts/intents/plan.ts
11
12
  /** Whatever the previous convert produced. */
12
13
  const RAISED = { raised: true };
@@ -113,7 +114,10 @@ function planRepay(intent, view) {
113
114
  * what it does not take stays on the account.
114
115
  */
115
116
  function planMoveToAave(intent, view) {
116
- const amount = view.balanceOf(intent.token);
117
+ const { claimable } = intent;
118
+ const claimed = claimable ? instantOutput(claimable.outputs, intent.token) : void 0;
119
+ if (claimable && !claimed) throw new IntentPreviewError(unsupportedCollateralToken(toToken(view.sdk, intent.token)), `moveToAave: the claim brings no ${intent.token}`);
120
+ const amount = view.balanceOf(intent.token) + (claimed?.amount ?? 0n);
117
121
  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
122
  if (view.debt <= 0n) throw new IntentPreviewError(debtOutOfRange({
119
123
  requested: toTokenAmount(view.sdk, view.underlying, view.debt),
@@ -121,6 +125,7 @@ function planMoveToAave(intent, view) {
121
125
  maxDebt: toTokenAmount(view.sdk, view.underlying, view.debtLimits.maxDebt)
122
126
  }), "moveToAave: the account owes nothing");
123
127
  return [
128
+ ...claimable ? [claim(claimable)] : [],
124
129
  {
125
130
  kind: "aaveSupply",
126
131
  token: intent.token,
@@ -6,8 +6,8 @@ import { IntentPreviewError } from "../../validation/raise.js";
6
6
  import { toTargetDecimals } from "./utils/common.js";
7
7
  import { createOraclePaths } from "./utils/router-path.js";
8
8
  import { accountView } from "./view.js";
9
- import { planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw } from "./plan.js";
10
9
  import { instantOutput } from "./operations.js";
10
+ import { planFinishClaimOnly, planFinishCloseAccount, planFinishDecreaseLeverage, planFinishWithdraw } from "./plan.js";
11
11
  import { realize } from "./realize.js";
12
12
  //#region src/onchain/accounts/intents/tail.ts
13
13
  /**
@@ -49,6 +49,7 @@ import { iAaveHorizonBridgeAbi } from "./market/adapters/abi/aave/iAaveHorizonBr
49
49
  import { iAaveOracleAbi } from "./market/adapters/abi/aave/iAaveOracle.js";
50
50
  import { iAaveV3PoolAbi } from "./market/adapters/abi/aave/iAaveV3Pool.js";
51
51
  import { iPoolAddressesProviderAbi } from "./market/adapters/abi/aave/iPoolAddressesProvider.js";
52
+ import { iVariableDebtTokenAbi } from "./market/adapters/abi/aave/iVariableDebtToken.js";
52
53
  import { AdapterType } from "./market/adapters/types.js";
53
54
  import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./market/adapters/abi/actionAbi.js";
54
55
  import { erc4626ReferralAdapterAbi } from "./market/adapters/abi/adapters/erc4626ReferralAdapter.js";
@@ -218,6 +219,7 @@ import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.
218
219
  import { amountOf } from "./validation/helpers/amount.js";
219
220
  import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./validation/helpers/health-factor-limits.js";
220
221
  import { toToken, toTokenAmount } from "./validation/helpers/token.js";
222
+ import { checkAaveDelegation } from "./validation/bundles/checkAaveDelegation.js";
221
223
  import { checkBorrowLimit } from "./validation/checks/checkBorrowLimit.js";
222
224
  import { checkCollateralised } from "./validation/checks/checkCollateralised.js";
223
225
  import { checkCreditAccountFrozen } from "./validation/checks/checkCreditAccountFrozen.js";
@@ -314,6 +316,7 @@ import { parsePoolOperationCalldata } from "./preview/parse/parsePoolOperationCa
314
316
  import { parseRWAFactoryOperationCalldata } from "./preview/parse/parseRWAFactoryOperationCalldata.js";
315
317
  import { parseOperationCalldata } from "./preview/parse/parseOperationCalldata.js";
316
318
  import { isPoolOperation, isRWAOperation } from "./preview/parse/types.js";
319
+ import { aaveBridgeBorrows } from "./preview/preview/aaveBridgeBorrows.js";
317
320
  import { buildDelayedStrategyPositionOperationPreview } from "./preview/preview/buildDelayedStrategyPositionOperationPreview.js";
318
321
  import { CreditAccountState } from "./preview/preview/CreditAccountState.js";
319
322
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/preview/detectCloseOrRepay.js";
@@ -328,4 +331,4 @@ import { replayMulticall } from "./preview/preview/replayMulticall.js";
328
331
  import { previewOperation } from "./preview/preview/previewOperation.js";
329
332
  import "./preview/index.js";
330
333
  import "./types/index.js";
331
- 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, iAaveOracleAbi, 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, iPoolAddressesProviderAbi, 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 };
334
+ 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, aaveBridgeBorrows, 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, checkAaveDelegation, 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, iAaveOracleAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVariableDebtTokenAbi, 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,16 @@
1
+ //#region src/onchain/market/adapters/abi/aave/iVariableDebtToken.ts
2
+ const iVariableDebtTokenAbi = [{
3
+ name: "borrowAllowance",
4
+ type: "function",
5
+ stateMutability: "view",
6
+ inputs: [{
7
+ type: "address",
8
+ name: "fromUser"
9
+ }, {
10
+ type: "address",
11
+ name: "toUser"
12
+ }],
13
+ outputs: [{ type: "uint256" }]
14
+ }];
15
+ //#endregion
16
+ export { iVariableDebtTokenAbi };
@@ -2,4 +2,5 @@ import { iAaveHorizonBridgeAbi } from "./iAaveHorizonBridge.js";
2
2
  import { iAaveOracleAbi } from "./iAaveOracle.js";
3
3
  import { iAaveV3PoolAbi } from "./iAaveV3Pool.js";
4
4
  import { iPoolAddressesProviderAbi } from "./iPoolAddressesProvider.js";
5
- export { iAaveHorizonBridgeAbi, iAaveOracleAbi, iAaveV3PoolAbi, iPoolAddressesProviderAbi };
5
+ import { iVariableDebtTokenAbi } from "./iVariableDebtToken.js";
6
+ export { iAaveHorizonBridgeAbi, iAaveOracleAbi, iAaveV3PoolAbi, iPoolAddressesProviderAbi, iVariableDebtTokenAbi };
@@ -2,6 +2,7 @@ import { iAaveHorizonBridgeAbi } from "./aave/iAaveHorizonBridge.js";
2
2
  import { iAaveOracleAbi } from "./aave/iAaveOracle.js";
3
3
  import { iAaveV3PoolAbi } from "./aave/iAaveV3Pool.js";
4
4
  import { iPoolAddressesProviderAbi } from "./aave/iPoolAddressesProvider.js";
5
+ import { iVariableDebtTokenAbi } from "./aave/iVariableDebtToken.js";
5
6
  import "./aave/index.js";
6
7
  import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./actionAbi.js";
7
8
  import { erc4626ReferralAdapterAbi } from "./adapters/erc4626ReferralAdapter.js";
@@ -58,4 +59,4 @@ import { iTreehouseRedemptionGatewayAbi } from "./treehouse/iTreehouseRedemption
58
59
  import { iTreehouseRouterAbi } from "./treehouse/iTreehouseRouter.js";
59
60
  import "./treehouse/index.js";
60
61
  import { getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, parseAdapterAction, parseAdapterDeployParams } from "./utils.js";
61
- export { adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, erc4626ReferralAdapterAbi, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, parseAdapterAction, parseAdapterDeployParams };
62
+ export { adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, erc4626ReferralAdapterAbi, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVariableDebtTokenAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, parseAdapterAction, parseAdapterDeployParams };
@@ -104,6 +104,24 @@ var AaveHorizonBridgeAdapterContract = class extends AbstractAdapterContract {
104
104
  };
105
105
  }
106
106
  /**
107
+ * What an opening call borrows on the owner's behalf: `debtToken` and
108
+ * `borrowAmount`. `undefined` for a call that borrows nothing.
109
+ */
110
+ parseBorrow(calldata) {
111
+ const decoded = decodeFunctionData({
112
+ abi,
113
+ data: calldata
114
+ });
115
+ switch (decoded.functionName) {
116
+ case "openPosition":
117
+ case "openPositionDiff": return {
118
+ debtToken: decoded.args[1],
119
+ amount: decoded.args[3]
120
+ };
121
+ default: return;
122
+ }
123
+ }
124
+ /**
107
125
  * Every account on this credit manager is finished by the Horizon finalizer
108
126
  * bot a block after its own transaction, so opening one grants the bot its
109
127
  * permissions. The bot is the one the market configurator lists among its
@@ -2,6 +2,7 @@ import { iAaveHorizonBridgeAbi } from "./abi/aave/iAaveHorizonBridge.js";
2
2
  import { iAaveOracleAbi } from "./abi/aave/iAaveOracle.js";
3
3
  import { iAaveV3PoolAbi } from "./abi/aave/iAaveV3Pool.js";
4
4
  import { iPoolAddressesProviderAbi } from "./abi/aave/iPoolAddressesProvider.js";
5
+ import { iVariableDebtTokenAbi } from "./abi/aave/iVariableDebtToken.js";
5
6
  import { AdapterType } from "./types.js";
6
7
  import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./abi/actionAbi.js";
7
8
  import { erc4626ReferralAdapterAbi } from "./abi/adapters/erc4626ReferralAdapter.js";
@@ -104,4 +105,4 @@ import "./contracts/index.js";
104
105
  import { createAdapter } from "./createAdapter.js";
105
106
  import "./legacyAdapterOperations.js";
106
107
  import "./transfers.js";
107
- export { AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AccountMigratorAdapterContract, AdapterType, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, CamelotV3AdapterContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, FluidDexAdapterContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasRedemptionVaultAdapterContract, PendlePairStatus, PendleRouterAdapterContract, PendleTokenType, SecuritizeOnRampAdapterContract, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHV1AdapterContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, classifyCurveOperation, createAdapter, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, erc4626ReferralAdapterAbi, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, rewardsFromTransfers, swapFromTransfers, toNetTransfers };
108
+ export { AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AccountMigratorAdapterContract, AdapterType, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, CamelotV3AdapterContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, FluidDexAdapterContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasRedemptionVaultAdapterContract, PendlePairStatus, PendleRouterAdapterContract, PendleTokenType, SecuritizeOnRampAdapterContract, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHV1AdapterContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, classifyCurveOperation, createAdapter, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, erc4626ReferralAdapterAbi, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, hasAdapterDeployParamsAbi, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVariableDebtTokenAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, rewardsFromTransfers, swapFromTransfers, toNetTransfers };
@@ -2,6 +2,7 @@ import { iAaveHorizonBridgeAbi } from "./adapters/abi/aave/iAaveHorizonBridge.js
2
2
  import { iAaveOracleAbi } from "./adapters/abi/aave/iAaveOracle.js";
3
3
  import { iAaveV3PoolAbi } from "./adapters/abi/aave/iAaveV3Pool.js";
4
4
  import { iPoolAddressesProviderAbi } from "./adapters/abi/aave/iPoolAddressesProvider.js";
5
+ import { iVariableDebtTokenAbi } from "./adapters/abi/aave/iVariableDebtToken.js";
5
6
  import { AdapterType } from "./adapters/types.js";
6
7
  import { adapterActionAbi, adapterActionSelectors, adapterActionSignatures } from "./adapters/abi/actionAbi.js";
7
8
  import { erc4626ReferralAdapterAbi } from "./adapters/abi/adapters/erc4626ReferralAdapter.js";
@@ -166,4 +167,4 @@ import { RWARegistry, RWA_COMPRESSOR_ADDRESS } from "./rwa/RWARegistry.js";
166
167
  import { isRWAFactory } from "./rwa/types.js";
167
168
  import "./rwa/index.js";
168
169
  import "./types.js";
169
- export { AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, updatableDependencies, usdToNumber };
170
+ export { AaveHorizonBridgeAdapterContract, AaveV3PoolAdapterContract, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConstantPriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CreditSuiteStrategy, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegistry, PriceOracleV310Contract, PriceUpdatesCache, PythPriceFeed, RWARegistry, RWA_COMPRESSOR_ADDRESS, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SecuritizeDegenNFT, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TreehouseFastlaneAdapterContract, TreehouseRedemptionGatewayAdapterContract, TreehouseRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatablePriceFeedRegistry, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iAaveHorizonBridgeAbi, iAaveHorizonBridgeAdapterAbi, iAaveOracleAbi, iAaveV3PoolAbi, iAaveV3PoolAdapterAbi, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, 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, iPoolAddressesProviderAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iTreehouseFastlaneAbi, iTreehouseFastlaneAdapterAbi, iTreehouseRedemptionGatewayAbi, iTreehouseRedemptionGatewayAdapterAbi, iTreehouseRouterAbi, iTreehouseRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVariableDebtTokenAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalPartialLiquidationAmounts, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, updatableDependencies, usdToNumber };
@@ -93,7 +93,8 @@ async function projectAavePosition(sdk, snapshot, owner) {
93
93
  allowFailure: false,
94
94
  batchSize: 0
95
95
  });
96
- if (!adapters.some((b) => b instanceof AaveHorizonBridgeAdapterContract && b.isATokenAllowed(rwaReserve.aTokenAddress) && b.isDebtTokenAllowed(underlying))) return;
96
+ const bridgeAdapter = adapters.find((b) => b instanceof AaveHorizonBridgeAdapterContract && b.isATokenAllowed(rwaReserve.aTokenAddress) && b.isDebtTokenAllowed(underlying));
97
+ if (!bridgeAdapter) return;
97
98
  const oracle = await sdk.client.readContract({
98
99
  address: provider,
99
100
  abi: iPoolAddressesProviderAbi,
@@ -162,7 +163,8 @@ async function projectAavePosition(sdk, snapshot, owner) {
162
163
  leverage: calcPositionLeverage(totalValue, totalDebt),
163
164
  mintPeriodInterest: market.toUnderlyingAmount(interest),
164
165
  mintDuration,
165
- estLiveAt: Number(sdk.timestamp) + mintDuration
166
+ estLiveAt: Number(sdk.timestamp) + mintDuration,
167
+ bridge: bridgeAdapter.bridge
166
168
  },
167
169
  maxDebt: borrowableBase > debtBase ? (borrowableBase - debtBase) * underlyingScale / underlyingPrice : 0n
168
170
  };
@@ -5,6 +5,7 @@ import { parseRWAFactoryOperationCalldata } from "./parse/parseRWAFactoryOperati
5
5
  import { parseOperationCalldata } from "./parse/parseOperationCalldata.js";
6
6
  import { isPoolOperation, isRWAOperation } from "./parse/types.js";
7
7
  import "./parse/index.js";
8
+ import { aaveBridgeBorrows } from "./preview/aaveBridgeBorrows.js";
8
9
  import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
9
10
  import { CreditAccountState } from "./preview/CreditAccountState.js";
10
11
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
@@ -18,4 +19,4 @@ import { makeReplayState, replayInnerOperations } from "./preview/replayInnerOpe
18
19
  import { replayMulticall } from "./preview/replayMulticall.js";
19
20
  import { previewOperation } from "./preview/previewOperation.js";
20
21
  import "./preview/index.js";
21
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, midasGreenlistsAccount, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
22
+ export { CreditAccountState, aaveBridgeBorrows, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, midasGreenlistsAccount, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -0,0 +1,23 @@
1
+ import { AaveHorizonBridgeAdapterContract } from "../../market/adapters/contracts/AaveHorizonBridgeAdapterContract.js";
2
+ //#region src/onchain/preview/preview/aaveBridgeBorrows.ts
3
+ /**
4
+ * The loans the multicall's Horizon bridge calls take as the account owner,
5
+ * at the amounts the calldata names.
6
+ */
7
+ function aaveBridgeBorrows(sdk, creditManager, multicall) {
8
+ const { priceOracle } = sdk.marketRegister.findByCreditManager(creditManager);
9
+ const borrows = [];
10
+ for (const op of multicall) {
11
+ if (op.operation !== "Execute") continue;
12
+ const adapter = sdk.getContract(op.adapter);
13
+ if (!(adapter instanceof AaveHorizonBridgeAdapterContract)) continue;
14
+ const borrow = adapter.parseBorrow(op.calldata);
15
+ if (borrow) borrows.push({
16
+ bridge: adapter.bridge,
17
+ amount: priceOracle.toTokenAmount(borrow.debtToken, borrow.amount)
18
+ });
19
+ }
20
+ return borrows;
21
+ }
22
+ //#endregion
23
+ export { aaveBridgeBorrows };
@@ -1,3 +1,4 @@
1
+ import { aaveBridgeBorrows } from "./aaveBridgeBorrows.js";
1
2
  import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
2
3
  import { CreditAccountState } from "./CreditAccountState.js";
3
4
  import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
@@ -10,4 +11,4 @@ import { previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategy
10
11
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
11
12
  import { replayMulticall } from "./replayMulticall.js";
12
13
  import { previewOperation } from "./previewOperation.js";
13
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
14
+ export { CreditAccountState, aaveBridgeBorrows, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -3,6 +3,7 @@ import { DUST_THRESHOLD } from "../../constants/math.js";
3
3
  import { asEstimated } from "../../../model/previews.js";
4
4
  import { sdkOk } from "../../../model/result.js";
5
5
  import "../../../model/index.js";
6
+ import { aaveBridgeBorrows } from "./aaveBridgeBorrows.js";
6
7
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
7
8
  //#region src/onchain/preview/preview/previewAdjustStrategyPosition.ts
8
9
  /**
@@ -23,6 +24,7 @@ function previewAdjustStrategyPosition(sdk, input, operation, replay) {
23
24
  const assetsChange = account.balances.difference(before.balances).toAssets(DUST_THRESHOLD);
24
25
  const priced = oracle.safeConvertAssets(account.balances.toAssets(), market.underlying);
25
26
  const snap = account.toSnapshot(priced.value);
27
+ const aaveBorrows = aaveBridgeBorrows(sdk, operation.creditManager, operation.multicall);
26
28
  return sdkOk({
27
29
  operation: "AdjustCreditAccount",
28
30
  ...asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: before.totalDebt - account.totalDebt })),
@@ -37,6 +39,7 @@ function previewAdjustStrategyPosition(sdk, input, operation, replay) {
37
39
  ...oracle.toAmount(market.underlying, q.balance)
38
40
  })),
39
41
  assetsChange: assetsChange.map((a) => oracle.toTokenAmount(a.token, a.balance)),
42
+ ...aaveBorrows.length > 0 ? { aaveBorrows } : {},
40
43
  warning: priced.error
41
44
  });
42
45
  }
@@ -3,6 +3,7 @@ import "../../constants/math.js";
3
3
  import { asEstimated } from "../../../model/previews.js";
4
4
  import { sdkOk } from "../../../model/result.js";
5
5
  import "../../../model/index.js";
6
+ import { aaveBridgeBorrows } from "./aaveBridgeBorrows.js";
6
7
  import { classifyCloseOrRepay } from "./detectCloseOrRepay.js";
7
8
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
8
9
  //#region src/onchain/preview/preview/previewExitOrRepayStrategyPosition.ts
@@ -55,6 +56,7 @@ function previewRepayCreditAccount(sdk, input, operation, permanent, replay) {
55
56
  const collateralAdded = unwrapped.data;
56
57
  const priced = market.priceOracle.safeConvertAssets(account.balances.toAssets(), market.underlying);
57
58
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
59
+ const aaveBorrows = aaveBridgeBorrows(sdk, operation.creditManager, operation.multicall);
58
60
  return sdkOk({
59
61
  operation: "RepayCreditAccount",
60
62
  permanent,
@@ -65,6 +67,7 @@ function previewRepayCreditAccount(sdk, input, operation, permanent, replay) {
65
67
  collateralAdded: collateralAdded.map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
66
68
  debtRepaid: market.toUnderlyingAmount(before.totalDebt - account.totalDebt),
67
69
  collateralWithdrawn: after.collateralWithdrawn.toAssets().map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
70
+ ...aaveBorrows.length > 0 ? { aaveBorrows } : {},
68
71
  warning: priced.error
69
72
  });
70
73
  }
@@ -0,0 +1,53 @@
1
+ import { iAaveHorizonBridgeAbi } from "../../market/adapters/abi/aave/iAaveHorizonBridge.js";
2
+ import { iAaveV3PoolAbi } from "../../market/adapters/abi/aave/iAaveV3Pool.js";
3
+ import { iVariableDebtTokenAbi } from "../../market/adapters/abi/aave/iVariableDebtToken.js";
4
+ import "../../market/adapters/abi/aave/index.js";
5
+ import { insufficientBorrowAllowance } from "../../../model/errors/operation-errors.js";
6
+ import { unexpectedFailure } from "../../../model/errors/prepare-errors.js";
7
+ import "../../../model/index.js";
8
+ import { toTokenAmount } from "../helpers/token.js";
9
+ import "../helpers/index.js";
10
+ //#region src/onchain/validation/bundles/checkAaveDelegation.ts
11
+ /**
12
+ * `owner` has delegated the bridge at least the borrowed amount on the
13
+ * variable debt token of the borrowed token, in the pool the bridge borrows
14
+ * from.
15
+ */
16
+ async function checkAaveDelegation(input) {
17
+ const { sdk, owner, borrow, blockNumber } = input;
18
+ const { bridge, amount } = borrow;
19
+ const token = amount.token.address;
20
+ try {
21
+ const pool = await sdk.client.readContract({
22
+ address: bridge,
23
+ abi: iAaveHorizonBridgeAbi,
24
+ functionName: "pool",
25
+ blockNumber
26
+ });
27
+ const { variableDebtTokenAddress } = await sdk.client.readContract({
28
+ address: pool,
29
+ abi: iAaveV3PoolAbi,
30
+ functionName: "getReserveData",
31
+ args: [token],
32
+ blockNumber
33
+ });
34
+ const allowed = await sdk.client.readContract({
35
+ address: variableDebtTokenAddress,
36
+ abi: iVariableDebtTokenAbi,
37
+ functionName: "borrowAllowance",
38
+ args: [owner, bridge],
39
+ blockNumber
40
+ });
41
+ return allowed >= amount.value ? [] : [insufficientBorrowAllowance({
42
+ owner,
43
+ spender: bridge,
44
+ debtToken: variableDebtTokenAddress,
45
+ required: amount,
46
+ allowed: toTokenAmount(sdk, token, allowed)
47
+ })];
48
+ } catch (cause) {
49
+ return [unexpectedFailure(cause, `read the ${amount.token.symbol} borrow delegation`)];
50
+ }
51
+ }
52
+ //#endregion
53
+ export { checkAaveDelegation };
@@ -1,5 +1,6 @@
1
1
  import { toToken } from "../helpers/token.js";
2
2
  import "../helpers/index.js";
3
+ import { checkAaveDelegation } from "./checkAaveDelegation.js";
3
4
  import { checkDebtLimits } from "../checks/checkDebtLimits.js";
4
5
  import "../checks/index.js";
5
6
  import { checkAccountQuotas } from "./checkAccountQuotas.js";
@@ -49,21 +50,43 @@ async function checkCreditOperation(args) {
49
50
  safeHealthFactor: preview.estSafeHealthFactor
50
51
  }, thresholds)
51
52
  ];
52
- const [funding, rwa] = await Promise.all([checkCollateralFunding({
53
- sdk,
54
- preview,
55
- sender,
56
- blockNumber
57
- }), isOpening ? checkRWAOpening({
58
- sdk,
59
- preview,
60
- sender
61
- }) : []]);
53
+ const [funding, rwa, ...delegations] = await Promise.all([
54
+ checkCollateralFunding({
55
+ sdk,
56
+ preview,
57
+ sender,
58
+ blockNumber
59
+ }),
60
+ isOpening ? checkRWAOpening({
61
+ sdk,
62
+ preview,
63
+ sender
64
+ }) : [],
65
+ ...aaveBorrows(preview).map((borrow) => checkAaveDelegation({
66
+ sdk,
67
+ owner: sender,
68
+ borrow,
69
+ blockNumber
70
+ }))
71
+ ]);
62
72
  return [
63
73
  ...protocol,
64
74
  ...funding,
65
- ...rwa
75
+ ...rwa,
76
+ ...delegations.flat()
66
77
  ];
67
78
  }
79
+ /**
80
+ * What the Horizon bridge borrows as the owner: the whole debt when an Aave
81
+ * opening moves, or the loans an adjustment takes itself.
82
+ */
83
+ function aaveBorrows(preview) {
84
+ if (isAaveOpening(preview)) return [{
85
+ bridge: preview.aave.bridge,
86
+ amount: preview.aave.totalDebt
87
+ }];
88
+ return preview.operation === "AdjustCreditAccount" ? preview.aaveBorrows ?? [] : [];
89
+ }
90
+ const isAaveOpening = (preview) => "aave" in preview;
68
91
  //#endregion
69
92
  export { checkCreditOperation };
@@ -1,3 +1,4 @@
1
+ import { checkAaveDelegation } from "./checkAaveDelegation.js";
1
2
  import { checkAccountQuotas } from "./checkAccountQuotas.js";
2
3
  import { checkWalletAllowance } from "./checkWalletAllowance.js";
3
4
  import { checkWalletBalance } from "./checkWalletBalance.js";
@@ -17,4 +18,4 @@ import { checkLiquidationFunding } from "./checkLiquidationFunding.js";
17
18
  import { checkWallet } from "./checkWallet.js";
18
19
  import { checkPoolFunding } from "./checkPoolFunding.js";
19
20
  import { checkPoolOperation } from "./checkPoolOperation.js";
20
- export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
21
+ export { checkAaveDelegation, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
@@ -1,3 +1,4 @@
1
+ import { checkAaveDelegation } from "./bundles/checkAaveDelegation.js";
1
2
  import { checkCollateralFunding } from "./bundles/checkCollateralFunding.js";
2
3
  import { checkMarket } from "./bundles/checkMarket.js";
3
4
  import { checkCreditOperation } from "./bundles/checkCreditOperation.js";
@@ -49,10 +50,21 @@ async function checkOperation(input, options = {}) {
49
50
  blockNumber,
50
51
  ...thresholds
51
52
  });
52
- case "RepayCreditAccount": return [...checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager)), ...await checkCollateralFunding({
53
- ...wallet,
54
- preview
55
- })];
53
+ case "RepayCreditAccount": {
54
+ const [funding, ...delegations] = await Promise.all([checkCollateralFunding({
55
+ ...wallet,
56
+ preview
57
+ }), ...(preview.aaveBorrows ?? []).map((borrow) => checkAaveDelegation({
58
+ ...wallet,
59
+ owner: sender,
60
+ borrow
61
+ }))]);
62
+ return [
63
+ ...checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager)),
64
+ ...funding,
65
+ ...delegations.flat()
66
+ ];
67
+ }
56
68
  case "CloseCreditAccount": return checkMarket(sdk.marketRegister.findCreditManager(preview.creditManager));
57
69
  }
58
70
  }
@@ -2,6 +2,7 @@ import { amountOf } from "./helpers/amount.js";
2
2
  import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./helpers/health-factor-limits.js";
3
3
  import { toToken, toTokenAmount } from "./helpers/token.js";
4
4
  import "./helpers/index.js";
5
+ import { checkAaveDelegation } from "./bundles/checkAaveDelegation.js";
5
6
  import { checkBorrowLimit } from "./checks/checkBorrowLimit.js";
6
7
  import { checkCollateralised } from "./checks/checkCollateralised.js";
7
8
  import { checkCreditAccountFrozen } from "./checks/checkCreditAccountFrozen.js";
@@ -47,4 +48,4 @@ import { checkLiquidation } from "./checkLiquidation.js";
47
48
  import { checkOperation } from "./checkOperation.js";
48
49
  import { checkSimulation } from "./checkSimulation.js";
49
50
  import { raise } from "./raise.js";
50
- export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, 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, raise, toToken, toTokenAmount };
51
+ export { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkAaveDelegation, 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, raise, toToken, toTokenAmount };