@gearbox-protocol/sdk 16.3.0-next.3 → 16.3.0-next.5

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 (85) hide show
  1. package/dist/cjs/model/errors/operation-errors.js +1 -1
  2. package/dist/cjs/model/index.js +2 -2
  3. package/dist/cjs/model/rwa.js +4 -4
  4. package/dist/cjs/model/rwa.schema.js +4 -4
  5. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
  6. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +1 -3
  7. package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  8. package/dist/cjs/onchain/index.js +4 -4
  9. package/dist/cjs/onchain/market/credit/CreditSuite.js +19 -9
  10. package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  11. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
  12. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  13. package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  14. package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
  15. package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  16. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +8 -7
  17. package/dist/cjs/onchain/validation/bundles/{checkDraw.js → checkIncreaseDebt.js} +10 -10
  18. package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  19. package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  20. package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +6 -5
  21. package/dist/cjs/onchain/validation/bundles/index.js +4 -4
  22. package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
  23. package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +1 -1
  24. package/dist/cjs/onchain/validation/index.js +4 -4
  25. package/dist/cjs/sdk/execute/ExecuteApi.js +2 -2
  26. package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  27. package/dist/esm/model/errors/operation-errors.js +1 -1
  28. package/dist/esm/model/index.js +3 -3
  29. package/dist/esm/model/rwa.js +4 -4
  30. package/dist/esm/model/rwa.schema.js +5 -5
  31. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
  32. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +1 -3
  33. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  34. package/dist/esm/onchain/index.js +3 -3
  35. package/dist/esm/onchain/market/credit/CreditSuite.js +19 -9
  36. package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  37. package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
  38. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  39. package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  40. package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
  41. package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  42. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +8 -7
  43. package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
  44. package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  45. package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  46. package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +6 -5
  47. package/dist/esm/onchain/validation/bundles/index.js +3 -3
  48. package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
  49. package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +1 -1
  50. package/dist/esm/onchain/validation/index.js +3 -3
  51. package/dist/esm/sdk/execute/ExecuteApi.js +2 -2
  52. package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  53. package/dist/types/model/errors/operation-errors.d.ts +8 -6
  54. package/dist/types/model/index.d.ts +3 -3
  55. package/dist/types/model/opportunities.d.ts +6 -7
  56. package/dist/types/model/rwa.d.ts +47 -27
  57. package/dist/types/model/rwa.schema.d.ts +3 -3
  58. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
  59. package/dist/types/offchain/opportunities/types.d.ts +1 -4
  60. package/dist/types/onchain/accounts/types.d.ts +4 -2
  61. package/dist/types/onchain/index.d.ts +4 -4
  62. package/dist/types/onchain/market/credit/CreditSuite.d.ts +8 -3
  63. package/dist/types/onchain/market/index.d.ts +2 -2
  64. package/dist/types/onchain/market/pool/types.d.ts +1 -1
  65. package/dist/types/onchain/market/rwa/index.d.ts +2 -2
  66. package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
  67. package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
  68. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
  69. package/dist/types/onchain/market/rwa/types.d.ts +39 -37
  70. package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
  71. package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
  72. package/dist/types/onchain/opportunities/types.d.ts +6 -1
  73. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +3 -2
  74. package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
  75. package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
  76. package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
  77. package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +3 -3
  78. package/dist/types/onchain/validation/bundles/index.d.ts +3 -3
  79. package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
  80. package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -1
  81. package/dist/types/onchain/validation/index.d.ts +3 -3
  82. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
  83. package/dist/types/sdk/opportunities/types.d.ts +9 -3
  84. package/package.json +1 -1
  85. package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
@@ -6,24 +6,24 @@ const require_onchain_validation_helpers_token = require("../helpers/token.js");
6
6
  require("../helpers/index.js");
7
7
  //#region src/onchain/validation/bundles/checkRWAOpenRequirements.ts
8
8
  /**
9
- * The RWA factory is satisfied that `wallet` may open on `token` with the
9
+ * The degen NFT is satisfied that `wallet` may open on `token` with the
10
10
  * registration args already on the transaction.
11
11
  */
12
12
  async function checkRWAOpenRequirements(input) {
13
13
  const { sdk, wallet, creditManager, token, providedArgs } = input;
14
14
  try {
15
- const requirements = await sdk.accounts.getOpenAccountRequirements(wallet, creditManager, { tokenOutAddress: token });
16
- if (!requirements) return [];
17
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(creditManager);
18
- if (!rwaFactory) throw new Error(`no RWA factory for credit manager ${creditManager}`);
19
- const missing = rwaFactory.getMissingRequirements(requirements, providedArgs);
20
- if (!missing && requirements.securitizeTokensToRegister.length === 0) return [];
15
+ const nft = await sdk.marketRegister.findCreditManager(creditManager).degenNFT();
16
+ if (!nft) return [];
17
+ const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: token });
18
+ const missing = nft.getMissingRequirements(requirements, providedArgs);
19
+ if (!missing && nft.isRegistered(requirements)) return [];
21
20
  return [require_model_errors_operation_errors.rwaOpenRequirementsNotMet({
22
21
  token: require_onchain_validation_helpers_token.toToken(sdk, token),
23
22
  creditManager,
24
- factory: rwaFactory.address,
23
+ protocol: nft.protocol,
24
+ registrationLink: nft.registrationLink,
25
25
  requirements,
26
- ...missing === void 0 ? {} : { missing }
26
+ missing
27
27
  })];
28
28
  } catch (cause) {
29
29
  return [require_model_errors_prepare_errors.unexpectedFailure(cause, "read the RWA opening requirements")];
@@ -3,21 +3,22 @@ const require_onchain_utils_AddressSet = require("../../utils/AddressSet.js");
3
3
  const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./checkRWAOpenRequirements.js");
4
4
  //#region src/onchain/validation/bundles/checkRWAOpening.ts
5
5
  /**
6
- * Per factory-gated token among `collateralAdded ∪ quotas`, whether the
6
+ * Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
7
7
  * borrower still has to register or sign before this opening can land.
8
8
  */
9
9
  async function checkRWAOpening(input) {
10
10
  const { sdk, preview, sender } = input;
11
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(preview.creditManager);
12
- if (!rwaFactory) return [];
13
- const gated = new require_onchain_utils_AddressSet.AddressSet(rwaFactory.getTokens());
11
+ const nft = await sdk.marketRegister.findCreditManager(preview.creditManager).degenNFT();
12
+ if (!nft) return [];
13
+ const gated = new require_onchain_utils_AddressSet.AddressSet(await nft.getTokens());
14
14
  const candidates = new require_onchain_utils_AddressSet.AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]);
15
+ const providedArgs = preview.operation === "RWAOpenCreditAccount" ? preview.rwaArgs : void 0;
15
16
  return (await Promise.all([...candidates].filter((token) => gated.has(token)).map((token) => require_onchain_validation_bundles_checkRWAOpenRequirements.checkRWAOpenRequirements({
16
17
  sdk,
17
18
  wallet: sender,
18
19
  creditManager: preview.creditManager,
19
20
  token,
20
- providedArgs: preview.rwaArgs
21
+ providedArgs
21
22
  })))).flat();
22
23
  }
23
24
  //#endregion
@@ -3,11 +3,11 @@ const require_onchain_validation_bundles_checkAccountQuotas = require("./checkAc
3
3
  const require_onchain_validation_bundles_checkWalletAllowance = require("./checkWalletAllowance.js");
4
4
  const require_onchain_validation_bundles_checkWalletBalance = require("./checkWalletBalance.js");
5
5
  const require_onchain_validation_bundles_checkCollateralFunding = require("./checkCollateralFunding.js");
6
- const require_onchain_validation_bundles_checkDraw = require("./checkDraw.js");
7
6
  const require_onchain_validation_bundles_checkHealthFactors = require("./checkHealthFactors.js");
7
+ const require_onchain_validation_bundles_checkIncreaseDebt = require("./checkIncreaseDebt.js");
8
+ const require_onchain_validation_bundles_checkIncreaseQuota = require("./checkIncreaseQuota.js");
8
9
  const require_onchain_validation_bundles_checkMarket = require("./checkMarket.js");
9
10
  const require_onchain_validation_bundles_checkObtained = require("./checkObtained.js");
10
- const require_onchain_validation_bundles_checkQuotasAsked = require("./checkQuotasAsked.js");
11
11
  const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./checkRWAOpenRequirements.js");
12
12
  const require_onchain_validation_bundles_checkRWAOpening = require("./checkRWAOpening.js");
13
13
  const require_onchain_validation_bundles_checkCreditOperation = require("./checkCreditOperation.js");
@@ -19,15 +19,15 @@ const require_onchain_validation_bundles_checkPoolOperation = require("./checkPo
19
19
  exports.checkAccountQuotas = require_onchain_validation_bundles_checkAccountQuotas.checkAccountQuotas;
20
20
  exports.checkCollateralFunding = require_onchain_validation_bundles_checkCollateralFunding.checkCollateralFunding;
21
21
  exports.checkCreditOperation = require_onchain_validation_bundles_checkCreditOperation.checkCreditOperation;
22
- exports.checkDraw = require_onchain_validation_bundles_checkDraw.checkDraw;
23
22
  exports.checkHealthFactors = require_onchain_validation_bundles_checkHealthFactors.checkHealthFactors;
23
+ exports.checkIncreaseDebt = require_onchain_validation_bundles_checkIncreaseDebt.checkIncreaseDebt;
24
+ exports.checkIncreaseQuota = require_onchain_validation_bundles_checkIncreaseQuota.checkIncreaseQuota;
24
25
  exports.checkLiquidationEligibility = require_onchain_validation_bundles_checkLiquidationEligibility.checkLiquidationEligibility;
25
26
  exports.checkLiquidationFunding = require_onchain_validation_bundles_checkLiquidationFunding.checkLiquidationFunding;
26
27
  exports.checkMarket = require_onchain_validation_bundles_checkMarket.checkMarket;
27
28
  exports.checkObtained = require_onchain_validation_bundles_checkObtained.checkObtained;
28
29
  exports.checkPoolFunding = require_onchain_validation_bundles_checkPoolFunding.checkPoolFunding;
29
30
  exports.checkPoolOperation = require_onchain_validation_bundles_checkPoolOperation.checkPoolOperation;
30
- exports.checkQuotasAsked = require_onchain_validation_bundles_checkQuotasAsked.checkQuotasAsked;
31
31
  exports.checkRWAOpenRequirements = require_onchain_validation_bundles_checkRWAOpenRequirements.checkRWAOpenRequirements;
32
32
  exports.checkRWAOpening = require_onchain_validation_bundles_checkRWAOpening.checkRWAOpening;
33
33
  exports.checkWallet = require_onchain_validation_bundles_checkWallet.checkWallet;
@@ -5,7 +5,7 @@ const require_onchain_validation_helpers_amount = require("../helpers/amount.js"
5
5
  require("../helpers/index.js");
6
6
  //#region src/onchain/validation/checks/checkBorrowLimit.ts
7
7
  /**
8
- * What the pool will hand over, against what is asked for.
8
+ * What the pool will hand over, against the amount requested.
9
9
  *
10
10
  * `available` and `limit` are the caller's reading of which limit is in the
11
11
  * way; this check only compares. `maxBorrowAmount` is the largest debt still
@@ -8,7 +8,7 @@ require("../helpers/index.js");
8
8
  * What the pool holds, against what is being taken out of it.
9
9
  *
10
10
  * The operator is not `checkBorrowLimit`'s: a pool holding exactly the amount
11
- * asked for still cannot serve it, so equality is already a refusal. That is
11
+ * requested still cannot serve it, so equality is already a refusal. That is
12
12
  * the rule the legacy withdrawal validator enforced and it is preserved to the
13
13
  * unit.
14
14
  */
@@ -23,11 +23,11 @@ const require_onchain_validation_bundles_checkAccountQuotas = require("./bundles
23
23
  const require_onchain_validation_bundles_checkWalletAllowance = require("./bundles/checkWalletAllowance.js");
24
24
  const require_onchain_validation_bundles_checkWalletBalance = require("./bundles/checkWalletBalance.js");
25
25
  const require_onchain_validation_bundles_checkCollateralFunding = require("./bundles/checkCollateralFunding.js");
26
- const require_onchain_validation_bundles_checkDraw = require("./bundles/checkDraw.js");
27
26
  const require_onchain_validation_bundles_checkHealthFactors = require("./bundles/checkHealthFactors.js");
27
+ const require_onchain_validation_bundles_checkIncreaseDebt = require("./bundles/checkIncreaseDebt.js");
28
+ const require_onchain_validation_bundles_checkIncreaseQuota = require("./bundles/checkIncreaseQuota.js");
28
29
  const require_onchain_validation_bundles_checkMarket = require("./bundles/checkMarket.js");
29
30
  const require_onchain_validation_bundles_checkObtained = require("./bundles/checkObtained.js");
30
- const require_onchain_validation_bundles_checkQuotasAsked = require("./bundles/checkQuotasAsked.js");
31
31
  const require_onchain_validation_bundles_checkRWAOpenRequirements = require("./bundles/checkRWAOpenRequirements.js");
32
32
  const require_onchain_validation_bundles_checkRWAOpening = require("./bundles/checkRWAOpening.js");
33
33
  const require_onchain_validation_bundles_checkCreditOperation = require("./bundles/checkCreditOperation.js");
@@ -54,10 +54,11 @@ exports.checkCreditAccountFrozen = require_onchain_validation_checks_checkCredit
54
54
  exports.checkCreditManagerPaused = require_onchain_validation_checks_checkCreditManagerPaused.checkCreditManagerPaused;
55
55
  exports.checkCreditOperation = require_onchain_validation_bundles_checkCreditOperation.checkCreditOperation;
56
56
  exports.checkDebtLimits = require_onchain_validation_checks_checkDebtLimits.checkDebtLimits;
57
- exports.checkDraw = require_onchain_validation_bundles_checkDraw.checkDraw;
58
57
  exports.checkEmergencyLiquidator = require_onchain_validation_checks_checkEmergencyLiquidator.checkEmergencyLiquidator;
59
58
  exports.checkForbiddenToken = require_onchain_validation_checks_checkForbiddenToken.checkForbiddenToken;
60
59
  exports.checkHealthFactors = require_onchain_validation_bundles_checkHealthFactors.checkHealthFactors;
60
+ exports.checkIncreaseDebt = require_onchain_validation_bundles_checkIncreaseDebt.checkIncreaseDebt;
61
+ exports.checkIncreaseQuota = require_onchain_validation_bundles_checkIncreaseQuota.checkIncreaseQuota;
61
62
  exports.checkLeverage = require_onchain_validation_checks_checkLeverage.checkLeverage;
62
63
  exports.checkLiquidation = require_onchain_validation_checkLiquidation.checkLiquidation;
63
64
  exports.checkLiquidationEligibility = require_onchain_validation_bundles_checkLiquidationEligibility.checkLiquidationEligibility;
@@ -74,7 +75,6 @@ exports.checkPoolPaused = require_onchain_validation_checks_checkPoolPaused.chec
74
75
  exports.checkPoolSunset = require_onchain_validation_checks_checkPoolSunset.checkPoolSunset;
75
76
  exports.checkQuotaCount = require_onchain_validation_checks_checkQuotaCount.checkQuotaCount;
76
77
  exports.checkQuotaLimit = require_onchain_validation_checks_checkQuotaLimit.checkQuotaLimit;
77
- exports.checkQuotasAsked = require_onchain_validation_bundles_checkQuotasAsked.checkQuotasAsked;
78
78
  exports.checkRWAOpenRequirements = require_onchain_validation_bundles_checkRWAOpenRequirements.checkRWAOpenRequirements;
79
79
  exports.checkRWAOpening = require_onchain_validation_bundles_checkRWAOpening.checkRWAOpening;
80
80
  exports.checkSimulation = require_onchain_validation_checkSimulation.checkSimulation;
@@ -74,9 +74,9 @@ async function openTx(sdk, request) {
74
74
  async function openRwaOptions(sdk, request) {
75
75
  if (!request.targetToken) return;
76
76
  const requirements = await sdk.accounts.getOpenAccountRequirements(request.wallet, request.creditManager, { tokenOutAddress: request.targetToken });
77
- if (!requirements) return;
77
+ if (requirements?.protocol !== "securitize") return;
78
78
  return {
79
- type: requirements.type,
79
+ protocol: "securitize",
80
80
  tokensToRegister: requirements.tokensToRegister,
81
81
  signaturesToCache: request.signaturesToCache ?? []
82
82
  };
@@ -71,15 +71,21 @@ var OpportunitiesNamespace = class extends require_sdk_AbstractNamespace.Abstrac
71
71
  /**
72
72
  * {@inheritDoc IOpportunitiesBase.getStrategy}
73
73
  **/
74
- async getStrategy(key, wallet) {
74
+ async getStrategy(key) {
75
75
  return this.merged("get strategy opportunity", {
76
76
  chainIds: [key.chainId],
77
- fromChain: (source) => source.getStrategy(key, wallet),
78
- fromBackend: (source) => source.getStrategy(key, wallet),
77
+ fromChain: (source) => source.getStrategy(key),
78
+ fromBackend: (source) => source.getStrategy(key),
79
79
  merge: this.merge.strategy
80
80
  });
81
81
  }
82
82
  /**
83
+ * {@inheritDoc IOpportunitiesOnchainOnly.isEligibleForStrategy}
84
+ **/
85
+ async isEligibleForStrategy(key, wallet) {
86
+ return this.onchain.isEligibleForStrategy(key, wallet);
87
+ }
88
+ /**
83
89
  * {@inheritDoc IOpportunitiesBase.filter}
84
90
  **/
85
91
  filter(response, filter) {
@@ -113,7 +113,7 @@ function insufficientAllowance(args) {
113
113
  function rwaOpenRequirementsNotMet(args) {
114
114
  return {
115
115
  code: "rwaOpenRequirementsNotMet",
116
- message: `The RWA factory still wants something from the borrower before ${args.token.symbol} can be opened on.`,
116
+ message: `${args.protocol} still wants something from the borrower before ${args.token.symbol} can be opened on.`,
117
117
  ...args
118
118
  };
119
119
  }
@@ -7,8 +7,8 @@ import { FILTER_ALL, isFilterSet } from "./filters.js";
7
7
  import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
8
8
  import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
9
9
  import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
10
- import { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES } from "./rwa.js";
11
- import { kycProtocolSchema, kycRequirementSchema } from "./rwa.schema.js";
10
+ import { KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES } from "./rwa.js";
11
+ import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
12
12
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
13
13
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
14
14
  import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
@@ -32,4 +32,4 @@ import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourc
32
32
  import { safeValue, sdkErr, sdkOk } from "./result.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_PROTOCOLS, KYC_REGISTRATION_LINKS, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, 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, kycProtocolSchema, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, 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, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, 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, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, 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, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, 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, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, 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 };
@@ -34,15 +34,15 @@ const SECURITIZE_REGISTER_VAULT_TYPES = { RegisterVault: [
34
34
  }
35
35
  ] };
36
36
  /**
37
- * KYC providers a strategy may be gated by
37
+ * RWA protocols that require dedicated flows
38
38
  **/
39
- const KYC_PROTOCOLS = ["securitize", "midas"];
39
+ const RWA_PROTOCOLS = ["securitize", "midas"];
40
40
  /**
41
- * Hardcoded registration URLs for each {@link KycProtocol}.
41
+ * Hardcoded registration URLs for each {@link RWAProtocol}.
42
42
  **/
43
43
  const KYC_REGISTRATION_LINKS = {
44
44
  securitize: "https://securitize.io/",
45
45
  midas: "https://form.typeform.com/to/DqZaw6kr"
46
46
  };
47
47
  //#endregion
48
- export { KYC_PROTOCOLS, KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, SECURITIZE_REGISTER_VAULT_TYPES };
48
+ export { KYC_REGISTRATION_LINKS, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES };
@@ -1,18 +1,18 @@
1
1
  import { tokenSchema } from "./primitives.schema.js";
2
- import { KYC_PROTOCOLS } from "./rwa.js";
2
+ import { RWA_PROTOCOLS } from "./rwa.js";
3
3
  import { z } from "zod/v4";
4
4
  //#region src/model/rwa.schema.ts
5
5
  /**
6
- * {@link ./rwa.js#KycProtocol}
6
+ * {@link ./rwa.js#RWAProtocol}
7
7
  **/
8
- const kycProtocolSchema = z.enum(KYC_PROTOCOLS);
8
+ const rwaProtocolSchema = z.enum(RWA_PROTOCOLS);
9
9
  /**
10
10
  * {@link ./rwa.js#KycRequirement}
11
11
  **/
12
12
  const kycRequirementSchema = z.object({
13
- protocol: kycProtocolSchema,
13
+ protocol: rwaProtocolSchema,
14
14
  token: tokenSchema.optional(),
15
15
  registrationLink: z.string()
16
16
  });
17
17
  //#endregion
18
- export { kycProtocolSchema, kycRequirementSchema };
18
+ export { kycRequirementSchema, rwaProtocolSchema };
@@ -35,7 +35,7 @@ var OffchainOpportunities = class extends AbstractOffchainNamespace {
35
35
  /**
36
36
  * {@inheritDoc IOffchainOpportunities.getStrategy}
37
37
  **/
38
- async getStrategy(key, _wallet) {
38
+ async getStrategy(key) {
39
39
  return this.get({
40
40
  path: this.#strategyPath(key),
41
41
  schema: strategyOpportunityDetailSchema
@@ -188,9 +188,7 @@ var CreditAccountsServiceV310 = class extends SDKConstruct {
188
188
  * {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
189
189
  */
190
190
  async getOpenAccountRequirements(borrower, creditManager, props) {
191
- const { rwaFactory } = this.sdk.marketRegister.findCreditManager(creditManager);
192
- if (!rwaFactory) return;
193
- return rwaFactory.getOpenAccountRequirements(borrower, props);
191
+ return (await this.sdk.marketRegister.findCreditManager(creditManager).degenNFT())?.getOpenAccountRequirements(borrower, props);
194
192
  }
195
193
  /**
196
194
  * {@inheritDoc ICreditAccountsService.openCA}
@@ -9,9 +9,9 @@ import "../../utils/index.js";
9
9
  import { SDKConstruct } from "../../base/SDKConstruct.js";
10
10
  import "../../base/index.js";
11
11
  import { usdToNumber } from "../../market/math.js";
12
+ import { RWA_LIQUIDATOR_MIDAS } from "../../market/rwa/midas/constants.js";
12
13
  import { matchesLiquidatableAccountFilter } from "../../../model/liquidations.js";
13
14
  import "../../../model/index.js";
14
- import { RWA_LIQUIDATOR_MIDAS } from "../../market/rwa/midas/constants.js";
15
15
  import { RWA_LIQUIDATOR_SECURITIZE } from "../../market/rwa/securitize/constants.js";
16
16
  import { dominantCollateral } from "../../market/credit/collateralUtils.js";
17
17
  import { MidasLiquidatorContract } from "../../market/rwa/midas/MidasLiquidatorContract.js";
@@ -216,11 +216,11 @@ import { checkAccountQuotas } from "./validation/bundles/checkAccountQuotas.js";
216
216
  import { checkWalletAllowance } from "./validation/bundles/checkWalletAllowance.js";
217
217
  import { checkWalletBalance } from "./validation/bundles/checkWalletBalance.js";
218
218
  import { checkCollateralFunding } from "./validation/bundles/checkCollateralFunding.js";
219
- import { checkDraw } from "./validation/bundles/checkDraw.js";
220
219
  import { checkHealthFactors } from "./validation/bundles/checkHealthFactors.js";
220
+ import { checkIncreaseDebt } from "./validation/bundles/checkIncreaseDebt.js";
221
+ import { checkIncreaseQuota } from "./validation/bundles/checkIncreaseQuota.js";
221
222
  import { checkMarket } from "./validation/bundles/checkMarket.js";
222
223
  import { checkObtained } from "./validation/bundles/checkObtained.js";
223
- import { checkQuotasAsked } from "./validation/bundles/checkQuotasAsked.js";
224
224
  import { checkRWAOpenRequirements } from "./validation/bundles/checkRWAOpenRequirements.js";
225
225
  import { checkRWAOpening } from "./validation/bundles/checkRWAOpening.js";
226
226
  import { checkCreditOperation } from "./validation/bundles/checkCreditOperation.js";
@@ -298,4 +298,4 @@ import { replayMulticall } from "./preview/preview/replayMulticall.js";
298
298
  import { previewOperation } from "./preview/preview/previewOperation.js";
299
299
  import "./preview/index.js";
300
300
  import "./types/index.js";
301
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, 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_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, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, 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, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, 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, checkDraw, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkQuotasAsked, checkRWAOpenRequirements, checkRWAOpening, 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, fetchRedstonePayloads, 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, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, 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, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, 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, usdToNumber, watchBlocksAsync };
301
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountState, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, 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_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, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, 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, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, 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, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, 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, fetchRedstonePayloads, 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, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, 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, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, 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, usdToNumber, watchBlocksAsync };
@@ -7,8 +7,6 @@ import "../../utils/index.js";
7
7
  import { SDKConstruct } from "../../base/SDKConstruct.js";
8
8
  import "../../base/index.js";
9
9
  import { calcBorrowApy, calcQuotaRate, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount } from "../math.js";
10
- import { KYC_REGISTRATION_LINKS } from "../../../model/rwa.js";
11
- import "../../../model/index.js";
12
10
  import { createDegenNFT } from "../rwa/createDegenNFT.js";
13
11
  import { strategyName } from "../strategyName.js";
14
12
  import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
@@ -125,25 +123,37 @@ var CreditSuite = class extends SDKConstruct {
125
123
  degenNFT() {
126
124
  const address = this.creditFacade.degenNFT;
127
125
  if (isAddressEqual(address, "0x0000000000000000000000000000000000000000")) return Promise.resolve(void 0);
126
+ const factoryNft = this.rwaFactory?.degenNFT;
127
+ if (factoryNft && isAddressEqual(factoryNft.address, address)) return Promise.resolve(factoryNft);
128
128
  if (!this.#degenNFT) this.#degenNFT = createDegenNFT(this.sdk, address);
129
129
  return this.#degenNFT;
130
130
  }
131
131
  /**
132
- * What `wallet` still has to do before the facade lets it open an account;
133
- * `null` when nothing (no degen NFT, not a KYC gate, or already eligible).
132
+ * The KYC gate of this suite's strategy; `null` when there is none.
133
+ * Wallet-independent.
134
134
  */
135
- async kycRequirement(wallet, targetCollateral) {
135
+ async kycRequirement(targetCollateral) {
136
136
  const nft = await this.degenNFT();
137
137
  if (!nft) return null;
138
- const { eligible, token } = await nft.checkKyc(wallet, targetCollateral);
139
- if (eligible) return null;
138
+ const tokens = await nft.getTokens();
139
+ const token = tokens.find((t) => isAddressEqual(t, targetCollateral)) ?? tokens[0];
140
140
  return {
141
141
  protocol: nft.protocol,
142
- token: this.tokensMeta.getToken(token),
143
- registrationLink: KYC_REGISTRATION_LINKS[nft.protocol]
142
+ token: token ? this.tokensMeta.getToken(token) : void 0,
143
+ registrationLink: nft.registrationLink
144
144
  };
145
145
  }
146
146
  /**
147
+ * Whether `wallet` may open this suite's strategy today; `true` when there
148
+ * is no KYC gate.
149
+ */
150
+ async isEligibleForStrategy(wallet, targetCollateral) {
151
+ const nft = await this.degenNFT();
152
+ if (!nft) return true;
153
+ const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: targetCollateral });
154
+ return nft.isRegistered(requirements);
155
+ }
156
+ /**
147
157
  * Builds a transaction that executes a multicall on one of this suite's
148
158
  * credit accounts.
149
159
  *
@@ -5,14 +5,23 @@ import "../../adapters/abi/index.js";
5
5
  import { iMidasDegenNFTAbi } from "../../../../abi/rwa/iMidasDegenNFT.js";
6
6
  import "./constants.js";
7
7
  import { iMidasAccessControlAbi } from "../../../../abi/rwa/iMidasAccessControl.js";
8
+ import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
9
+ import "../../../../model/index.js";
8
10
  import { decodeAbiParameters } from "viem";
9
11
  //#region src/onchain/market/rwa/midas/MidasDegenNFT.ts
10
12
  const abi = iMidasDegenNFTAbi;
13
+ /**
14
+ * Midas is an RWA protocol without a factory: accounts open through the plain
15
+ * facade. Only a Permissioned-mode gateway deploys a degen NFT, so a Midas
16
+ * strategy that does not require KYC has no NFT at all.
17
+ */
11
18
  var MidasDegenNFT = class extends BaseContract {
12
19
  protocol = "midas";
20
+ registrationLink = KYC_REGISTRATION_LINKS.midas;
13
21
  gateway;
14
22
  accessControl;
15
23
  greenlistedRole;
24
+ #mToken;
16
25
  constructor(sdk, baseParams) {
17
26
  super(sdk, {
18
27
  ...baseParams,
@@ -30,9 +39,26 @@ var MidasDegenNFT = class extends BaseContract {
30
39
  this.accessControl = accessControl;
31
40
  this.greenlistedRole = greenlistedRole;
32
41
  }
33
- /** Same predicate `MidasDegenNFT.burn` reverts on; the mToken rides along in the batch. */
34
- async checkKyc(wallet, _targetCollateral) {
35
- const [eligible, token] = await this.client.multicall({
42
+ async getTokens() {
43
+ return [await this.#mTokenAddress()];
44
+ }
45
+ /**
46
+ * Same predicate `MidasDegenNFT.burn` reverts on; the mToken rides along in
47
+ * the batch until it is cached.
48
+ */
49
+ async getOpenAccountRequirements(wallet, _props) {
50
+ const token = this.#mToken;
51
+ if (token !== void 0) return {
52
+ protocol: "midas",
53
+ token,
54
+ greenlisted: await this.client.readContract({
55
+ abi: iMidasAccessControlAbi,
56
+ address: this.accessControl,
57
+ functionName: "hasRole",
58
+ args: [this.greenlistedRole, wallet]
59
+ })
60
+ };
61
+ const [greenlisted, mToken] = await this.client.multicall({
36
62
  allowFailure: false,
37
63
  contracts: [{
38
64
  abi: iMidasAccessControlAbi,
@@ -45,11 +71,25 @@ var MidasDegenNFT = class extends BaseContract {
45
71
  functionName: "mToken"
46
72
  }]
47
73
  });
74
+ this.#mToken = mToken;
48
75
  return {
49
- eligible,
50
- token
76
+ protocol: "midas",
77
+ token: mToken,
78
+ greenlisted
51
79
  };
52
80
  }
81
+ isRegistered(requirements) {
82
+ return requirements.greenlisted;
83
+ }
84
+ getMissingRequirements() {}
85
+ async #mTokenAddress() {
86
+ if (this.#mToken === void 0) this.#mToken = await this.client.readContract({
87
+ abi: iMidasGatewayV311Abi,
88
+ address: this.gateway,
89
+ functionName: "mToken"
90
+ });
91
+ return this.#mToken;
92
+ }
53
93
  };
54
94
  //#endregion
55
95
  export { MidasDegenNFT };
@@ -1,13 +1,23 @@
1
+ import { AddressSet } from "../../../utils/AddressSet.js";
2
+ import "../../../utils/index.js";
1
3
  import { BaseContract } from "../../../base/BaseContract.js";
2
4
  import "../../../base/index.js";
5
+ import { KYC_REGISTRATION_LINKS } from "../../../../model/rwa.js";
6
+ import "../../../../model/index.js";
3
7
  import { DEGEN_NFT_SECURITIZE } from "./constants.js";
4
8
  import { iSecuritizeDegenNFTAbi } from "../../../../abi/rwa/iSecuritizeDegenNFT.js";
5
- import { isAddressEqual } from "viem";
6
9
  //#region src/onchain/market/rwa/securitize/SecuritizeDegenNFT.ts
7
10
  const abi = iSecuritizeDegenNFTAbi;
11
+ /**
12
+ * Securitize always has a factory, which deploys this NFT. DS-token data,
13
+ * registrars and cached signatures live here; the factory only builds txs
14
+ * and looks up investor/wallet addresses.
15
+ */
8
16
  var SecuritizeDegenNFT = class extends BaseContract {
9
17
  protocol = "securitize";
18
+ registrationLink = KYC_REGISTRATION_LINKS.securitize;
10
19
  factory;
20
+ #sdk;
11
21
  constructor(sdk, address, factory) {
12
22
  super(sdk, {
13
23
  addr: address,
@@ -16,19 +26,54 @@ var SecuritizeDegenNFT = class extends BaseContract {
16
26
  name: "SecuritizeDegenNFT",
17
27
  abi
18
28
  });
29
+ this.#sdk = sdk;
19
30
  this.factory = factory;
20
31
  }
21
- /** Registration on Securitize is the only KYC step; pending EIP-712 signatures are not. */
22
- async checkKyc(wallet, targetCollateral) {
23
- const { factory } = this;
24
- if (!factory.getTokens().some((t) => isAddressEqual(t, targetCollateral))) return {
25
- eligible: true,
26
- token: targetCollateral
32
+ async getTokens() {
33
+ return this.factory.getTokens();
34
+ }
35
+ /**
36
+ * Registration on Securitize is the protocol-side KYC step; pending
37
+ * EIP-712 signatures are tx-side leftover, not KYC.
38
+ */
39
+ async getOpenAccountRequirements(wallet, props) {
40
+ const tokensToRegister = new AddressSet(this.factory.getTokens()).has(props.tokenOutAddress) ? new AddressSet([props.tokenOutAddress]) : new AddressSet();
41
+ if (tokensToRegister.size === 0) return {
42
+ protocol: "securitize",
43
+ factory: this.factory.address,
44
+ securitizeTokensToRegister: [],
45
+ tokensToRegister: [],
46
+ requiredSignatures: []
47
+ };
48
+ const [investorData] = await this.#sdk.rwa.getInvestorData(wallet, [this.factory.address]);
49
+ const registredTokens = new AddressSet(investorData.registeredTokens);
50
+ const signedTokens = new AddressSet(investorData.cachedSignatures.map((s) => s.token));
51
+ const unsignedTokens = tokensToRegister.difference(signedTokens);
52
+ const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
53
+ const requiredSignatures = investorData.registerVaultMessages.filter((m) => unsignedTokens.has(m.message.token));
54
+ return {
55
+ protocol: "securitize",
56
+ factory: this.factory.address,
57
+ securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
58
+ tokensToRegister: Array.from(tokensToRegister),
59
+ requiredSignatures
27
60
  };
28
- const req = await factory.getOpenAccountRequirements(wallet, { tokenOutAddress: targetCollateral });
61
+ }
62
+ isRegistered(requirements) {
63
+ return requirements.securitizeTokensToRegister.length === 0;
64
+ }
65
+ /**
66
+ * A required signature is omitted when `providedArgs.signaturesToCache`
67
+ * already carries a signature for the same token: the transaction caches it
68
+ * on-chain as part of the operation.
69
+ */
70
+ getMissingRequirements(requirements, providedArgs) {
71
+ const providedTokens = new AddressSet((providedArgs?.signaturesToCache ?? []).map((s) => s.token));
72
+ const requiredSignatures = requirements.requiredSignatures.filter((message) => !providedTokens.has(message.message.token));
73
+ if (requiredSignatures.length === 0) return;
29
74
  return {
30
- eligible: !req || req.securitizeTokensToRegister.length === 0,
31
- token: req?.securitizeTokensToRegister[0] ?? targetCollateral
75
+ protocol: "securitize",
76
+ requiredSignatures
32
77
  };
33
78
  }
34
79
  };