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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,10 +14,10 @@ const require_dev_detectChain = require("./detectChain.js");
14
14
  const require_dev_isOutOfSyncError = require("./isOutOfSyncError.js");
15
15
  const require_dev_isRateLimitError = require("./isRateLimitError.js");
16
16
  const require_dev_isTransientError = require("./isTransientError.js");
17
+ const require_dev_midasUtils = require("./midasUtils.js");
17
18
  const require_dev_kycUtils = require("./kycUtils.js");
18
19
  const require_dev_logSplitterTransport = require("./logSplitterTransport.js");
19
20
  const require_dev_ltUtils = require("./ltUtils.js");
20
- const require_dev_midasUtils = require("./midasUtils.js");
21
21
  const require_dev_migrateFaucet = require("./migrateFaucet.js");
22
22
  const require_dev_providers = require("./providers.js");
23
23
  const require_dev_replaceStorage = require("./replaceStorage.js");
@@ -42,6 +42,8 @@ exports.calcLiquidatableLTs = require_dev_calcLiquidatableLTs.calcLiquidatableLT
42
42
  exports.claimDSToken = require_dev_securitizeUtils.claimDSToken;
43
43
  exports.claimDSTokens = require_dev_securitizeUtils.claimDSTokens;
44
44
  exports.claimFromFaucet = require_dev_claimFromFaucet.claimFromFaucet;
45
+ exports.collectMidasGateways = require_dev_midasUtils.collectMidasGateways;
46
+ exports.collectMidasMTokens = require_dev_midasUtils.collectMidasMTokens;
45
47
  exports.createAnvilClient = require_dev_createAnvilClient.createAnvilClient;
46
48
  exports.createMinter = require_dev_mint_factory.createMinter;
47
49
  exports.deployUsingPublicCreate2 = require_dev_create2.deployUsingPublicCreate2;
@@ -86,4 +88,3 @@ exports.setLTZero = require_dev_ltUtils.setLTZero;
86
88
  exports.setLTs = require_dev_ltUtils.setLTs;
87
89
  exports.unpauseMidasIssuanceVault = require_dev_midasUtils.unpauseMidasIssuanceVault;
88
90
  exports.verifyTestnet = require_dev_verifyTestnet.verifyTestnet;
89
- exports.writeAndWait = require_dev_kycUtils.writeAndWait;
@@ -5,23 +5,12 @@ const require_onchain_OnchainSDK = require("../onchain/OnchainSDK.js");
5
5
  require("../onchain/index.js");
6
6
  const require_abi_rwa_iDSRegistryService = require("../abi/rwa/iDSRegistryService.js");
7
7
  const require_abi_rwa_iDSToken = require("../abi/rwa/iDSToken.js");
8
+ const require_dev_midasUtils = require("./midasUtils.js");
8
9
  const require_dev_withdrawalAbi = require("./withdrawalAbi.js");
9
10
  let viem = require("viem");
10
11
  let viem_accounts = require("viem/accounts");
11
12
  //#region src/dev/kycUtils.ts
12
13
  /**
13
- * Writes to a contract, mines a block and waits for the receipt
14
- */
15
- async function writeAndWait(anvil, params) {
16
- const hash = await anvil.writeContract(params);
17
- await anvil.mine({ blocks: 1 });
18
- await anvil.waitForTransactionReceipt({
19
- hash,
20
- pollingInterval: 100
21
- });
22
- return hash;
23
- }
24
- /**
25
14
  * Resolves the account that performs the DS registry writes: either the admin
26
15
  * private key, or the admin address impersonated on the fork
27
16
  */
@@ -99,36 +88,39 @@ async function registerSecuritizeInvestor(props) {
99
88
  const { account, release } = await useSecuritizeAdmin(props);
100
89
  try {
101
90
  if (!investorExists) {
102
- await writeAndWait(anvil, {
91
+ await anvil.writeContractSync({
103
92
  account,
104
93
  chain: anvil.chain,
105
94
  address: registryService,
106
95
  abi: require_abi_rwa_iDSRegistryService.iDSRegistryServiceAbi,
107
96
  functionName: "registerInvestor",
108
- args: [investorId, investorId]
97
+ args: [investorId, investorId],
98
+ throwOnReceiptRevert: true
109
99
  });
110
100
  logger?.debug(`Registered investor "${investorId}"`);
111
101
  }
112
- await writeAndWait(anvil, {
102
+ await anvil.writeContractSync({
113
103
  account,
114
104
  chain: anvil.chain,
115
105
  address: registryService,
116
106
  abi: require_abi_rwa_iDSRegistryService.iDSRegistryServiceAbi,
117
107
  functionName: "addWallet",
118
- args: [investor, investorId]
108
+ args: [investor, investorId],
109
+ throwOnReceiptRevert: true
119
110
  });
120
111
  logger?.debug(`Added wallet ${investor} for investor "${investorId}"`);
121
112
  try {
122
- await writeAndWait(anvil, {
113
+ await anvil.writeContractSync({
123
114
  account,
124
115
  chain: anvil.chain,
125
116
  address: registryService,
126
117
  abi: require_abi_rwa_iDSRegistryService.iDSRegistryServiceAbi,
127
118
  functionName: "setCountry",
128
- args: [investorId, "US"]
119
+ args: [investorId, "US"],
120
+ throwOnReceiptRevert: true
129
121
  });
130
122
  logger?.debug(`Set country for investor "${investorId}" to "US"`);
131
- await writeAndWait(anvil, {
123
+ await anvil.writeContractSync({
132
124
  account,
133
125
  chain: anvil.chain,
134
126
  address: registryService,
@@ -140,7 +132,8 @@ async function registerSecuritizeInvestor(props) {
140
132
  BigInt(APPROVED),
141
133
  require_onchain_constants_math.MAX_UINT256,
142
134
  "fake proof"
143
- ]
135
+ ],
136
+ throwOnReceiptRevert: true
144
137
  });
145
138
  logger?.debug(`Set attributes for investor "${investorId}"`);
146
139
  } catch (e) {
@@ -242,13 +235,14 @@ async function greenlistMidasGateway(props) {
242
235
  logger?.debug(`midas: ${account} already has role ${role}`);
243
236
  continue;
244
237
  }
245
- await writeAndWait(anvil, {
238
+ await anvil.writeContractSync({
246
239
  account: admin,
247
240
  chain: anvil.chain,
248
241
  address: accessControl,
249
242
  abi: iMidasAccessControlAbi,
250
243
  functionName: "grantRole",
251
- args: [role, account]
244
+ args: [role, account],
245
+ throwOnReceiptRevert: true
252
246
  });
253
247
  logger?.debug(`midas: granted role ${role} to ${account}`);
254
248
  }
@@ -280,7 +274,7 @@ async function findMidasGateway(props) {
280
274
  });
281
275
  await sdk.attach({ marketConfigurators });
282
276
  }
283
- const candidates = collectMidasGateways(sdk);
277
+ const candidates = require_dev_midasUtils.collectMidasGateways(sdk);
284
278
  if (candidates.length === 0) throw new Error("no midas gateway adapters found in loaded markets");
285
279
  const index = (await anvil.multicall({
286
280
  allowFailure: false,
@@ -295,16 +289,6 @@ async function findMidasGateway(props) {
295
289
  return candidates[index];
296
290
  }
297
291
  /**
298
- * Collects the target contracts of all Midas gateway adapters of the loaded
299
- * credit managers, same as the foundry tests do with
300
- * `ICreditConfiguratorV3.allowedAdapters`
301
- */
302
- function collectMidasGateways(sdk) {
303
- const gateways = new require_onchain_utils_AddressSet.AddressSet();
304
- for (const cm of sdk.marketRegister.creditManagers) for (const adapter of cm.creditManager.adapters.values()) if (adapter.contractType === "ADAPTER::MIDAS_GATEWAY") gateways.add(adapter.targetContract);
305
- return gateways.asArray();
306
- }
307
- /**
308
292
  * Registers a wallet as an investor (fake KYC) in every Securitize DSToken and
309
293
  * every Midas gateway of the markets loaded by `sdk`.
310
294
  *
@@ -336,7 +320,7 @@ async function registerRWAInvestor(props) {
336
320
  });
337
321
  }
338
322
  else if (dsTokens.size > 0) logger?.warn(`securitize: no registry admin, skipping ${dsTokens.size} DSToken(s)`);
339
- const gateways = collectMidasGateways(sdk);
323
+ const gateways = require_dev_midasUtils.collectMidasGateways(sdk);
340
324
  for (const gateway of gateways) try {
341
325
  await greenlistMidasGateway({
342
326
  anvil,
@@ -366,4 +350,3 @@ exports.greenlistMidasGateway = greenlistMidasGateway;
366
350
  exports.registerMidasInvestor = registerMidasInvestor;
367
351
  exports.registerRWAInvestor = registerRWAInvestor;
368
352
  exports.registerSecuritizeInvestor = registerSecuritizeInvestor;
369
- exports.writeAndWait = writeAndWait;
@@ -1,5 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dev_kycUtils = require("./kycUtils.js");
2
+ const require_onchain_utils_AddressSet = require("../onchain/utils/AddressSet.js");
3
+ const require_onchain_market_adapters_contracts_MidasGatewayAdapterContract = require("../onchain/market/adapters/contracts/MidasGatewayAdapterContract.js");
4
+ require("../onchain/index.js");
3
5
  let viem = require("viem");
4
6
  //#region src/dev/midasUtils.ts
5
7
  /**
@@ -78,30 +80,33 @@ async function unpauseMidasIssuanceVault(props) {
78
80
  value: (0, viem.parseEther)("100")
79
81
  });
80
82
  if (!isPauseAdmin) {
81
- await require_dev_kycUtils.writeAndWait(anvil, {
83
+ await anvil.writeContractSync({
82
84
  account: admin,
83
85
  chain: anvil.chain,
84
86
  address: accessControl,
85
87
  abi: iMidasAccessControlAbi,
86
88
  functionName: "grantRole",
87
- args: [pauseAdminRole, admin]
89
+ args: [pauseAdminRole, admin],
90
+ throwOnReceiptRevert: true
88
91
  });
89
92
  logger?.debug(`midas: granted pause admin role to ${admin}`);
90
93
  }
91
- if (paused) await require_dev_kycUtils.writeAndWait(anvil, {
94
+ if (paused) await anvil.writeContractSync({
92
95
  account: admin,
93
96
  chain: anvil.chain,
94
97
  address: vault,
95
98
  abi: iMidasPausableVaultAbi,
96
- functionName: "unpause"
99
+ functionName: "unpause",
100
+ throwOnReceiptRevert: true
97
101
  });
98
- if (depositInstantPaused) await require_dev_kycUtils.writeAndWait(anvil, {
102
+ if (depositInstantPaused) await anvil.writeContractSync({
99
103
  account: admin,
100
104
  chain: anvil.chain,
101
105
  address: vault,
102
106
  abi: iMidasPausableVaultAbi,
103
107
  functionName: "unpauseFn",
104
- args: [DEPOSIT_INSTANT_SELECTOR]
108
+ args: [DEPOSIT_INSTANT_SELECTOR],
109
+ throwOnReceiptRevert: true
105
110
  });
106
111
  } finally {
107
112
  await anvil.stopImpersonatingAccount({ address: admin });
@@ -117,20 +122,22 @@ async function unpauseMidasIssuanceVault(props) {
117
122
  address: admin,
118
123
  value: (0, viem.parseEther)("100")
119
124
  });
120
- if (paused) await require_dev_kycUtils.writeAndWait(anvil, {
125
+ if (paused) await anvil.writeContractSync({
121
126
  account: admin,
122
127
  chain: anvil.chain,
123
128
  address: vault,
124
129
  abi: iMidasPausableVaultAbi,
125
- functionName: "pause"
130
+ functionName: "pause",
131
+ throwOnReceiptRevert: true
126
132
  });
127
- if (depositInstantPaused) await require_dev_kycUtils.writeAndWait(anvil, {
133
+ if (depositInstantPaused) await anvil.writeContractSync({
128
134
  account: admin,
129
135
  chain: anvil.chain,
130
136
  address: vault,
131
137
  abi: iMidasPausableVaultAbi,
132
138
  functionName: "pauseFn",
133
- args: [DEPOSIT_INSTANT_SELECTOR]
139
+ args: [DEPOSIT_INSTANT_SELECTOR],
140
+ throwOnReceiptRevert: true
134
141
  });
135
142
  } catch (e) {
136
143
  logger?.warn(`midas: failed to pause issuance vault ${vault} back: ${e}`);
@@ -139,5 +146,27 @@ async function unpauseMidasIssuanceVault(props) {
139
146
  }
140
147
  };
141
148
  }
149
+ function* midasGatewayAdapters(sdk) {
150
+ for (const cm of sdk.marketRegister.creditManagers) for (const adapter of cm.creditManager.adapters.values()) if (adapter instanceof require_onchain_market_adapters_contracts_MidasGatewayAdapterContract.MidasGatewayAdapterContract) yield adapter;
151
+ }
152
+ /**
153
+ * Target contracts of all Midas gateway adapters of the loaded credit managers,
154
+ * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
155
+ */
156
+ function collectMidasGateways(sdk) {
157
+ const gateways = new require_onchain_utils_AddressSet.AddressSet();
158
+ for (const adapter of midasGatewayAdapters(sdk)) gateways.add(adapter.targetContract);
159
+ return gateways.asArray();
160
+ }
161
+ /**
162
+ * mTokens of all Midas gateway adapters of the loaded credit managers
163
+ */
164
+ function collectMidasMTokens(sdk) {
165
+ const mTokens = new require_onchain_utils_AddressSet.AddressSet();
166
+ for (const adapter of midasGatewayAdapters(sdk)) mTokens.add(adapter.mToken);
167
+ return mTokens.asArray();
168
+ }
142
169
  //#endregion
170
+ exports.collectMidasGateways = collectMidasGateways;
171
+ exports.collectMidasMTokens = collectMidasMTokens;
143
172
  exports.unpauseMidasIssuanceVault = unpauseMidasIssuanceVault;
@@ -65,7 +65,7 @@ async function issueDSTokens(props) {
65
65
  const { timestamp } = await anvil.getBlock();
66
66
  const issuanceTime = timestamp - lockPeriod - 1n;
67
67
  try {
68
- const hash = await require_dev_kycUtils.writeAndWait(anvil, {
68
+ const receipt = await anvil.writeContractSync({
69
69
  account,
70
70
  chain: anvil.chain,
71
71
  address: token,
@@ -78,14 +78,15 @@ async function issueDSTokens(props) {
78
78
  0n,
79
79
  "",
80
80
  0n
81
- ]
81
+ ],
82
+ throwOnReceiptRevert: true
82
83
  });
83
84
  logger?.debug({
84
85
  issuanceTime,
85
86
  investor,
86
87
  amount
87
88
  }, "issueTokensCustom successful");
88
- return hash;
89
+ return receipt.transactionHash;
89
90
  } catch (e) {
90
91
  logger?.debug(`issueTokensCustom failed: ${e}`);
91
92
  }
@@ -94,14 +95,15 @@ async function issueDSTokens(props) {
94
95
  investor,
95
96
  amount
96
97
  }, "Falling back to issueTokens");
97
- return require_dev_kycUtils.writeAndWait(anvil, {
98
+ return (await anvil.writeContractSync({
98
99
  account,
99
100
  chain: anvil.chain,
100
101
  address: token,
101
102
  abi: require_abi_rwa_iDSToken.iDSTokenAbi,
102
103
  functionName: "issueTokens",
103
- args: [investor, amount]
104
- });
104
+ args: [investor, amount],
105
+ throwOnReceiptRevert: true
106
+ })).transactionHash;
105
107
  }
106
108
  /**
107
109
  * Resolves unique compliance configuration services of `tokens`: several
@@ -161,13 +163,14 @@ async function enableDSTokenBackDating(props) {
161
163
  continue;
162
164
  }
163
165
  logger?.info(`Allowing back-dating on ${service}`);
164
- await require_dev_kycUtils.writeAndWait(anvil, {
166
+ await anvil.writeContractSync({
165
167
  account,
166
168
  chain: anvil.chain,
167
169
  address: service,
168
170
  abi: iDSComplianceConfigurationServiceAbi,
169
171
  functionName: "setDisallowBackDating",
170
- args: [false]
172
+ args: [false],
173
+ throwOnReceiptRevert: true
171
174
  });
172
175
  toRestore.push(service);
173
176
  }
@@ -177,13 +180,14 @@ async function enableDSTokenBackDating(props) {
177
180
  for (const service of services) {
178
181
  logger?.info(`Disallowing back-dating on ${service}`);
179
182
  try {
180
- await require_dev_kycUtils.writeAndWait(anvil, {
183
+ await anvil.writeContractSync({
181
184
  account,
182
185
  chain: anvil.chain,
183
186
  address: service,
184
187
  abi: iDSComplianceConfigurationServiceAbi,
185
188
  functionName: "setDisallowBackDating",
186
- args: [true]
189
+ args: [true],
190
+ throwOnReceiptRevert: true
187
191
  });
188
192
  } catch (e) {
189
193
  logger?.warn(`Failed to restore disallowBackDating on ${service}: ${e}`);
@@ -205,18 +205,15 @@ async function fulfillMidasRedeemer(anvil, redeemer, logger) {
205
205
  address: MIDAS_VAULT_ADMIN,
206
206
  value: (0, viem.parseEther)("100")
207
207
  });
208
- const hash = await anvil.writeContract({
208
+ await anvil.writeContractSync({
209
209
  chain: anvil.chain,
210
210
  address: midasRedemptionVault,
211
211
  account: MIDAS_VAULT_ADMIN,
212
212
  abi: iMidasRedemptionVaultExtAbi,
213
213
  functionName: "safeApproveRequest",
214
- args: [requestId, mTokenRate]
214
+ args: [requestId, mTokenRate],
215
+ throwOnReceiptRevert: true
215
216
  });
216
- if ((await anvil.waitForTransactionReceipt({
217
- hash,
218
- pollingInterval: 100
219
- })).status !== "success") throw new Error(`midas: safeApproveRequest tx ${hash} reverted`);
220
217
  await anvil.stopImpersonatingAccount({ address: MIDAS_VAULT_ADMIN });
221
218
  }
222
219
  /**
@@ -213,7 +213,6 @@ var CreditAccountsServiceV310 = class extends require_onchain_base_SDKConstruct.
213
213
  }),
214
214
  ...callsAfter ?? []
215
215
  ];
216
- calls = await this.#prependMidasReceiveGreenlist(cm.address, calls);
217
216
  calls = await this.prependPriceUpdates(cm.address, calls);
218
217
  const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls, rwaOptions) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions);
219
218
  tx.value = ethAmount.toString(10);
@@ -7,13 +7,11 @@ require("../helpers/index.js");
7
7
  //#region src/onchain/validation/bundles/checkMidasAccountGreenlist.ts
8
8
  /**
9
9
  * Whether the credit account already holds the Midas greenlisted role
10
- * this permissioned mToken requires of its holder, or the transaction
11
- * grants it via `receiveGreenlist()`.
10
+ * this permissioned mToken requires of its holder.
12
11
  */
13
12
  async function checkMidasAccountGreenlist(input) {
14
13
  const { sdk, preview, nft, tokens } = input;
15
14
  if (nft.protocol !== "midas") return [];
16
- if (preview.midasGreenlistsAccount) return [];
17
15
  if (tokens.length === 0) return [];
18
16
  const account = preview.creditAccount;
19
17
  if (!account) return tokens.map((token) => require_model_errors_operation_errors.accountNotMidasGreenlisted({
@@ -13,10 +13,10 @@ import { detectChain } from "./detectChain.js";
13
13
  import { isOutOfSyncError } from "./isOutOfSyncError.js";
14
14
  import { isRateLimitError } from "./isRateLimitError.js";
15
15
  import { isTransientError } from "./isTransientError.js";
16
- import { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
16
+ import { collectMidasGateways, collectMidasMTokens, unpauseMidasIssuanceVault } from "./midasUtils.js";
17
+ import { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor } from "./kycUtils.js";
17
18
  import { isRangeError, logSplitterTransport } from "./logSplitterTransport.js";
18
19
  import { setLTZero, setLTs } from "./ltUtils.js";
19
- import { unpauseMidasIssuanceVault } from "./midasUtils.js";
20
20
  import { migrateFaucet } from "./migrateFaucet.js";
21
21
  import { SUPPORTED_RPC_PROVIDERS, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getRpcProviderUrl, getThirdWebUrl, rpcProvidersSchema } from "./providers.js";
22
22
  import { replaceStorage } from "./replaceStorage.js";
@@ -25,4 +25,4 @@ import { claimDSToken, claimDSTokens, enableDSTokenBackDating } from "./securiti
25
25
  import "./types.js";
26
26
  import { ONCHAIN_EXECUTION_ID_ADDRESS, verifyTestnet } from "./verifyTestnet.js";
27
27
  import { makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
28
- export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
28
+ export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, collectMidasGateways, collectMidasMTokens, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet };
@@ -4,23 +4,12 @@ import { OnchainSDK } from "../onchain/OnchainSDK.js";
4
4
  import "../onchain/index.js";
5
5
  import { iDSRegistryServiceAbi } from "../abi/rwa/iDSRegistryService.js";
6
6
  import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
7
+ import { collectMidasGateways } from "./midasUtils.js";
7
8
  import { midasGatewayAbi } from "./withdrawalAbi.js";
8
9
  import { isAddressEqual, parseAbi, parseEther, zeroAddress } from "viem";
9
10
  import { privateKeyToAccount } from "viem/accounts";
10
11
  //#region src/dev/kycUtils.ts
11
12
  /**
12
- * Writes to a contract, mines a block and waits for the receipt
13
- */
14
- async function writeAndWait(anvil, params) {
15
- const hash = await anvil.writeContract(params);
16
- await anvil.mine({ blocks: 1 });
17
- await anvil.waitForTransactionReceipt({
18
- hash,
19
- pollingInterval: 100
20
- });
21
- return hash;
22
- }
23
- /**
24
13
  * Resolves the account that performs the DS registry writes: either the admin
25
14
  * private key, or the admin address impersonated on the fork
26
15
  */
@@ -98,36 +87,39 @@ async function registerSecuritizeInvestor(props) {
98
87
  const { account, release } = await useSecuritizeAdmin(props);
99
88
  try {
100
89
  if (!investorExists) {
101
- await writeAndWait(anvil, {
90
+ await anvil.writeContractSync({
102
91
  account,
103
92
  chain: anvil.chain,
104
93
  address: registryService,
105
94
  abi: iDSRegistryServiceAbi,
106
95
  functionName: "registerInvestor",
107
- args: [investorId, investorId]
96
+ args: [investorId, investorId],
97
+ throwOnReceiptRevert: true
108
98
  });
109
99
  logger?.debug(`Registered investor "${investorId}"`);
110
100
  }
111
- await writeAndWait(anvil, {
101
+ await anvil.writeContractSync({
112
102
  account,
113
103
  chain: anvil.chain,
114
104
  address: registryService,
115
105
  abi: iDSRegistryServiceAbi,
116
106
  functionName: "addWallet",
117
- args: [investor, investorId]
107
+ args: [investor, investorId],
108
+ throwOnReceiptRevert: true
118
109
  });
119
110
  logger?.debug(`Added wallet ${investor} for investor "${investorId}"`);
120
111
  try {
121
- await writeAndWait(anvil, {
112
+ await anvil.writeContractSync({
122
113
  account,
123
114
  chain: anvil.chain,
124
115
  address: registryService,
125
116
  abi: iDSRegistryServiceAbi,
126
117
  functionName: "setCountry",
127
- args: [investorId, "US"]
118
+ args: [investorId, "US"],
119
+ throwOnReceiptRevert: true
128
120
  });
129
121
  logger?.debug(`Set country for investor "${investorId}" to "US"`);
130
- await writeAndWait(anvil, {
122
+ await anvil.writeContractSync({
131
123
  account,
132
124
  chain: anvil.chain,
133
125
  address: registryService,
@@ -139,7 +131,8 @@ async function registerSecuritizeInvestor(props) {
139
131
  BigInt(APPROVED),
140
132
  MAX_UINT256,
141
133
  "fake proof"
142
- ]
134
+ ],
135
+ throwOnReceiptRevert: true
143
136
  });
144
137
  logger?.debug(`Set attributes for investor "${investorId}"`);
145
138
  } catch (e) {
@@ -241,13 +234,14 @@ async function greenlistMidasGateway(props) {
241
234
  logger?.debug(`midas: ${account} already has role ${role}`);
242
235
  continue;
243
236
  }
244
- await writeAndWait(anvil, {
237
+ await anvil.writeContractSync({
245
238
  account: admin,
246
239
  chain: anvil.chain,
247
240
  address: accessControl,
248
241
  abi: iMidasAccessControlAbi,
249
242
  functionName: "grantRole",
250
- args: [role, account]
243
+ args: [role, account],
244
+ throwOnReceiptRevert: true
251
245
  });
252
246
  logger?.debug(`midas: granted role ${role} to ${account}`);
253
247
  }
@@ -294,16 +288,6 @@ async function findMidasGateway(props) {
294
288
  return candidates[index];
295
289
  }
296
290
  /**
297
- * Collects the target contracts of all Midas gateway adapters of the loaded
298
- * credit managers, same as the foundry tests do with
299
- * `ICreditConfiguratorV3.allowedAdapters`
300
- */
301
- function collectMidasGateways(sdk) {
302
- const gateways = new AddressSet();
303
- for (const cm of sdk.marketRegister.creditManagers) for (const adapter of cm.creditManager.adapters.values()) if (adapter.contractType === "ADAPTER::MIDAS_GATEWAY") gateways.add(adapter.targetContract);
304
- return gateways.asArray();
305
- }
306
- /**
307
291
  * Registers a wallet as an investor (fake KYC) in every Securitize DSToken and
308
292
  * every Midas gateway of the markets loaded by `sdk`.
309
293
  *
@@ -361,4 +345,4 @@ async function registerRWAInvestor(props) {
361
345
  };
362
346
  }
363
347
  //#endregion
364
- export { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait };
348
+ export { greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor };
@@ -1,4 +1,6 @@
1
- import { writeAndWait } from "./kycUtils.js";
1
+ import { AddressSet } from "../onchain/utils/AddressSet.js";
2
+ import { MidasGatewayAdapterContract } from "../onchain/market/adapters/contracts/MidasGatewayAdapterContract.js";
3
+ import "../onchain/index.js";
2
4
  import { parseAbi, parseEther, toFunctionSelector } from "viem";
3
5
  //#region src/dev/midasUtils.ts
4
6
  /**
@@ -77,30 +79,33 @@ async function unpauseMidasIssuanceVault(props) {
77
79
  value: parseEther("100")
78
80
  });
79
81
  if (!isPauseAdmin) {
80
- await writeAndWait(anvil, {
82
+ await anvil.writeContractSync({
81
83
  account: admin,
82
84
  chain: anvil.chain,
83
85
  address: accessControl,
84
86
  abi: iMidasAccessControlAbi,
85
87
  functionName: "grantRole",
86
- args: [pauseAdminRole, admin]
88
+ args: [pauseAdminRole, admin],
89
+ throwOnReceiptRevert: true
87
90
  });
88
91
  logger?.debug(`midas: granted pause admin role to ${admin}`);
89
92
  }
90
- if (paused) await writeAndWait(anvil, {
93
+ if (paused) await anvil.writeContractSync({
91
94
  account: admin,
92
95
  chain: anvil.chain,
93
96
  address: vault,
94
97
  abi: iMidasPausableVaultAbi,
95
- functionName: "unpause"
98
+ functionName: "unpause",
99
+ throwOnReceiptRevert: true
96
100
  });
97
- if (depositInstantPaused) await writeAndWait(anvil, {
101
+ if (depositInstantPaused) await anvil.writeContractSync({
98
102
  account: admin,
99
103
  chain: anvil.chain,
100
104
  address: vault,
101
105
  abi: iMidasPausableVaultAbi,
102
106
  functionName: "unpauseFn",
103
- args: [DEPOSIT_INSTANT_SELECTOR]
107
+ args: [DEPOSIT_INSTANT_SELECTOR],
108
+ throwOnReceiptRevert: true
104
109
  });
105
110
  } finally {
106
111
  await anvil.stopImpersonatingAccount({ address: admin });
@@ -116,20 +121,22 @@ async function unpauseMidasIssuanceVault(props) {
116
121
  address: admin,
117
122
  value: parseEther("100")
118
123
  });
119
- if (paused) await writeAndWait(anvil, {
124
+ if (paused) await anvil.writeContractSync({
120
125
  account: admin,
121
126
  chain: anvil.chain,
122
127
  address: vault,
123
128
  abi: iMidasPausableVaultAbi,
124
- functionName: "pause"
129
+ functionName: "pause",
130
+ throwOnReceiptRevert: true
125
131
  });
126
- if (depositInstantPaused) await writeAndWait(anvil, {
132
+ if (depositInstantPaused) await anvil.writeContractSync({
127
133
  account: admin,
128
134
  chain: anvil.chain,
129
135
  address: vault,
130
136
  abi: iMidasPausableVaultAbi,
131
137
  functionName: "pauseFn",
132
- args: [DEPOSIT_INSTANT_SELECTOR]
138
+ args: [DEPOSIT_INSTANT_SELECTOR],
139
+ throwOnReceiptRevert: true
133
140
  });
134
141
  } catch (e) {
135
142
  logger?.warn(`midas: failed to pause issuance vault ${vault} back: ${e}`);
@@ -138,5 +145,25 @@ async function unpauseMidasIssuanceVault(props) {
138
145
  }
139
146
  };
140
147
  }
148
+ function* midasGatewayAdapters(sdk) {
149
+ for (const cm of sdk.marketRegister.creditManagers) for (const adapter of cm.creditManager.adapters.values()) if (adapter instanceof MidasGatewayAdapterContract) yield adapter;
150
+ }
151
+ /**
152
+ * Target contracts of all Midas gateway adapters of the loaded credit managers,
153
+ * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
154
+ */
155
+ function collectMidasGateways(sdk) {
156
+ const gateways = new AddressSet();
157
+ for (const adapter of midasGatewayAdapters(sdk)) gateways.add(adapter.targetContract);
158
+ return gateways.asArray();
159
+ }
160
+ /**
161
+ * mTokens of all Midas gateway adapters of the loaded credit managers
162
+ */
163
+ function collectMidasMTokens(sdk) {
164
+ const mTokens = new AddressSet();
165
+ for (const adapter of midasGatewayAdapters(sdk)) mTokens.add(adapter.mToken);
166
+ return mTokens.asArray();
167
+ }
141
168
  //#endregion
142
- export { unpauseMidasIssuanceVault };
169
+ export { collectMidasGateways, collectMidasMTokens, unpauseMidasIssuanceVault };
@@ -2,7 +2,7 @@ import { AddressSet } from "../onchain/utils/AddressSet.js";
2
2
  import { OnchainSDK } from "../onchain/OnchainSDK.js";
3
3
  import "../onchain/index.js";
4
4
  import { iDSTokenAbi } from "../abi/rwa/iDSToken.js";
5
- import { registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
5
+ import { registerSecuritizeInvestor } from "./kycUtils.js";
6
6
  import { erc20Abi, isAddressEqual, parseAbi, zeroAddress } from "viem";
7
7
  import { privateKeyToAccount } from "viem/accounts";
8
8
  //#region src/dev/securitizeUtils.ts
@@ -64,7 +64,7 @@ async function issueDSTokens(props) {
64
64
  const { timestamp } = await anvil.getBlock();
65
65
  const issuanceTime = timestamp - lockPeriod - 1n;
66
66
  try {
67
- const hash = await writeAndWait(anvil, {
67
+ const receipt = await anvil.writeContractSync({
68
68
  account,
69
69
  chain: anvil.chain,
70
70
  address: token,
@@ -77,14 +77,15 @@ async function issueDSTokens(props) {
77
77
  0n,
78
78
  "",
79
79
  0n
80
- ]
80
+ ],
81
+ throwOnReceiptRevert: true
81
82
  });
82
83
  logger?.debug({
83
84
  issuanceTime,
84
85
  investor,
85
86
  amount
86
87
  }, "issueTokensCustom successful");
87
- return hash;
88
+ return receipt.transactionHash;
88
89
  } catch (e) {
89
90
  logger?.debug(`issueTokensCustom failed: ${e}`);
90
91
  }
@@ -93,14 +94,15 @@ async function issueDSTokens(props) {
93
94
  investor,
94
95
  amount
95
96
  }, "Falling back to issueTokens");
96
- return writeAndWait(anvil, {
97
+ return (await anvil.writeContractSync({
97
98
  account,
98
99
  chain: anvil.chain,
99
100
  address: token,
100
101
  abi: iDSTokenAbi,
101
102
  functionName: "issueTokens",
102
- args: [investor, amount]
103
- });
103
+ args: [investor, amount],
104
+ throwOnReceiptRevert: true
105
+ })).transactionHash;
104
106
  }
105
107
  /**
106
108
  * Resolves unique compliance configuration services of `tokens`: several
@@ -160,13 +162,14 @@ async function enableDSTokenBackDating(props) {
160
162
  continue;
161
163
  }
162
164
  logger?.info(`Allowing back-dating on ${service}`);
163
- await writeAndWait(anvil, {
165
+ await anvil.writeContractSync({
164
166
  account,
165
167
  chain: anvil.chain,
166
168
  address: service,
167
169
  abi: iDSComplianceConfigurationServiceAbi,
168
170
  functionName: "setDisallowBackDating",
169
- args: [false]
171
+ args: [false],
172
+ throwOnReceiptRevert: true
170
173
  });
171
174
  toRestore.push(service);
172
175
  }
@@ -176,13 +179,14 @@ async function enableDSTokenBackDating(props) {
176
179
  for (const service of services) {
177
180
  logger?.info(`Disallowing back-dating on ${service}`);
178
181
  try {
179
- await writeAndWait(anvil, {
182
+ await anvil.writeContractSync({
180
183
  account,
181
184
  chain: anvil.chain,
182
185
  address: service,
183
186
  abi: iDSComplianceConfigurationServiceAbi,
184
187
  functionName: "setDisallowBackDating",
185
- args: [true]
188
+ args: [true],
189
+ throwOnReceiptRevert: true
186
190
  });
187
191
  } catch (e) {
188
192
  logger?.warn(`Failed to restore disallowBackDating on ${service}: ${e}`);
@@ -204,18 +204,15 @@ async function fulfillMidasRedeemer(anvil, redeemer, logger) {
204
204
  address: MIDAS_VAULT_ADMIN,
205
205
  value: parseEther("100")
206
206
  });
207
- const hash = await anvil.writeContract({
207
+ await anvil.writeContractSync({
208
208
  chain: anvil.chain,
209
209
  address: midasRedemptionVault,
210
210
  account: MIDAS_VAULT_ADMIN,
211
211
  abi: iMidasRedemptionVaultExtAbi,
212
212
  functionName: "safeApproveRequest",
213
- args: [requestId, mTokenRate]
213
+ args: [requestId, mTokenRate],
214
+ throwOnReceiptRevert: true
214
215
  });
215
- if ((await anvil.waitForTransactionReceipt({
216
- hash,
217
- pollingInterval: 100
218
- })).status !== "success") throw new Error(`midas: safeApproveRequest tx ${hash} reverted`);
219
216
  await anvil.stopImpersonatingAccount({ address: MIDAS_VAULT_ADMIN });
220
217
  }
221
218
  /**
@@ -212,7 +212,6 @@ var CreditAccountsServiceV310 = class extends SDKConstruct {
212
212
  }),
213
213
  ...callsAfter ?? []
214
214
  ];
215
- calls = await this.#prependMidasReceiveGreenlist(cm.address, calls);
216
215
  calls = await this.prependPriceUpdates(cm.address, calls);
217
216
  const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls, rwaOptions) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions);
218
217
  tx.value = ethAmount.toString(10);
@@ -6,13 +6,11 @@ import "../helpers/index.js";
6
6
  //#region src/onchain/validation/bundles/checkMidasAccountGreenlist.ts
7
7
  /**
8
8
  * Whether the credit account already holds the Midas greenlisted role
9
- * this permissioned mToken requires of its holder, or the transaction
10
- * grants it via `receiveGreenlist()`.
9
+ * this permissioned mToken requires of its holder.
11
10
  */
12
11
  async function checkMidasAccountGreenlist(input) {
13
12
  const { sdk, preview, nft, tokens } = input;
14
13
  if (nft.protocol !== "midas") return [];
15
- if (preview.midasGreenlistsAccount) return [];
16
14
  if (tokens.length === 0) return [];
17
15
  const account = preview.creditAccount;
18
16
  if (!account) return tokens.map((token) => accountNotMidasGreenlisted({
@@ -11,10 +11,10 @@ import { detectChain } from "./detectChain.js";
11
11
  import { isOutOfSyncError } from "./isOutOfSyncError.js";
12
12
  import { isRateLimitError } from "./isRateLimitError.js";
13
13
  import { isTransientError } from "./isTransientError.js";
14
- import { GreenlistMidasGatewayProps, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait } from "./kycUtils.js";
14
+ import { GreenlistMidasGatewayProps, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor } from "./kycUtils.js";
15
15
  import { LogSplitterTransportOptions, isRangeError, logSplitterTransport } from "./logSplitterTransport.js";
16
16
  import { setLTZero, setLTs } from "./ltUtils.js";
17
- import { RestoreMidasIssuanceVaultPause, UnpauseMidasIssuanceVaultProps, unpauseMidasIssuanceVault } from "./midasUtils.js";
17
+ import { RestoreMidasIssuanceVaultPause, UnpauseMidasIssuanceVaultProps, collectMidasGateways, collectMidasMTokens, unpauseMidasIssuanceVault } from "./midasUtils.js";
18
18
  import { migrateFaucet } from "./migrateFaucet.js";
19
19
  import { IMinter } from "./mint/types.js";
20
20
  import { createMinter } from "./mint/factory.js";
@@ -26,4 +26,4 @@ import { EnableDSTokenBackDatingProps, RestoreDSTokenBackDating, claimDSToken, c
26
26
  import { httpTransportOptionsSchema } from "./transports.js";
27
27
  import { ONCHAIN_EXECUTION_ID_ADDRESS, VerifyTestnetParams, verifyTestnet } from "./verifyTestnet.js";
28
28
  import { MakePendingWithdrawalsClaimableOptions, makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
29
- export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnableDSTokenBackDatingProps, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RestoreDSTokenBackDating, RestoreMidasIssuanceVaultPause, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, UnpauseMidasIssuanceVaultProps, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
29
+ export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnableDSTokenBackDatingProps, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RestoreDSTokenBackDating, RestoreMidasIssuanceVaultPause, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, UnpauseMidasIssuanceVaultProps, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, collectMidasGateways, collectMidasMTokens, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet };
@@ -4,10 +4,6 @@ import "../onchain/index.js";
4
4
  import { AnvilClient } from "./createAnvilClient.js";
5
5
  import { Address, Hex } from "viem";
6
6
  //#region src/dev/kycUtils.d.ts
7
- /**
8
- * Writes to a contract, mines a block and waits for the receipt
9
- */
10
- declare function writeAndWait(anvil: AnvilClient, params: Parameters<AnvilClient["writeContract"]>[0]): Promise<Hex>;
11
7
  interface RegisterSecuritizeInvestorProps {
12
8
  anvil: AnvilClient;
13
9
  /**
@@ -138,4 +134,4 @@ interface RegisterRWAInvestorResult {
138
134
  */
139
135
  declare function registerRWAInvestor(props: RegisterRWAInvestorProps): Promise<RegisterRWAInvestorResult>;
140
136
  //#endregion
141
- export { GreenlistMidasGatewayProps, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, writeAndWait };
137
+ export { GreenlistMidasGatewayProps, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, greenlistMidasGateway, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor };
@@ -1,4 +1,5 @@
1
1
  import { ILogger } from "../onchain/types/logger.js";
2
+ import { OnchainSDK } from "../onchain/OnchainSDK.js";
2
3
  import "../onchain/index.js";
3
4
  import { AnvilClient } from "./createAnvilClient.js";
4
5
  import { Address } from "viem";
@@ -32,5 +33,14 @@ type RestoreMidasIssuanceVaultPause = () => Promise<void>;
32
33
  * reverted by the callback, only the pause state is.
33
34
  */
34
35
  declare function unpauseMidasIssuanceVault(props: UnpauseMidasIssuanceVaultProps): Promise<RestoreMidasIssuanceVaultPause>;
36
+ /**
37
+ * Target contracts of all Midas gateway adapters of the loaded credit managers,
38
+ * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
39
+ */
40
+ declare function collectMidasGateways(sdk: OnchainSDK): Address[];
41
+ /**
42
+ * mTokens of all Midas gateway adapters of the loaded credit managers
43
+ */
44
+ declare function collectMidasMTokens(sdk: OnchainSDK): Address[];
35
45
  //#endregion
36
- export { RestoreMidasIssuanceVaultPause, UnpauseMidasIssuanceVaultProps, unpauseMidasIssuanceVault };
46
+ export { RestoreMidasIssuanceVaultPause, UnpauseMidasIssuanceVaultProps, collectMidasGateways, collectMidasMTokens, unpauseMidasIssuanceVault };
@@ -15,8 +15,7 @@ interface CheckMidasAccountGreenlistInput {
15
15
  }
16
16
  /**
17
17
  * Whether the credit account already holds the Midas greenlisted role
18
- * this permissioned mToken requires of its holder, or the transaction
19
- * grants it via `receiveGreenlist()`.
18
+ * this permissioned mToken requires of its holder.
20
19
  */
21
20
  declare function checkMidasAccountGreenlist(input: CheckMidasAccountGreenlistInput): Promise<(AccountNotMidasGreenlistedError | UnexpectedFailureError)[]>;
22
21
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.4.0-next.7",
3
+ "version": "16.4.0-next.9",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {