@gearbox-protocol/sdk 16.6.0-next.2 → 16.6.0-next.4

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.
@@ -79,11 +79,7 @@ const iFaucetAbi = [
79
79
  internalType: "uint256"
80
80
  }]
81
81
  }],
82
- outputs: [{
83
- name: "",
84
- type: "bool",
85
- internalType: "bool"
86
- }],
82
+ outputs: [],
87
83
  stateMutability: "nonpayable"
88
84
  },
89
85
  {
@@ -98,11 +94,7 @@ const iFaucetAbi = [
98
94
  type: "uint256",
99
95
  internalType: "uint256"
100
96
  }],
101
- outputs: [{
102
- name: "",
103
- type: "bool",
104
- internalType: "bool"
105
- }],
97
+ outputs: [],
106
98
  stateMutability: "nonpayable"
107
99
  },
108
100
  {
@@ -113,11 +105,7 @@ const iFaucetAbi = [
113
105
  type: "address",
114
106
  internalType: "address"
115
107
  }],
116
- outputs: [{
117
- name: "",
118
- type: "bool",
119
- internalType: "bool"
120
- }],
108
+ outputs: [],
121
109
  stateMutability: "nonpayable"
122
110
  },
123
111
  {
@@ -189,6 +177,17 @@ const iFaucetAbi = [
189
177
  }],
190
178
  stateMutability: "view"
191
179
  },
180
+ {
181
+ type: "function",
182
+ name: "owner",
183
+ inputs: [],
184
+ outputs: [{
185
+ name: "",
186
+ type: "address",
187
+ internalType: "address"
188
+ }],
189
+ stateMutability: "view"
190
+ },
192
191
  {
193
192
  type: "function",
194
193
  name: "prices",
@@ -261,8 +261,7 @@ async function greenlistMidasGateway(props) {
261
261
  }
262
262
  /**
263
263
  * Finds the Midas gateway that issues `token` by scanning the Midas gateway
264
- * adapters of all loaded credit managers, same as the foundry tests do with
265
- * `ICreditConfiguratorV3.allowedAdapters`
264
+ * adapters of all loaded credit managers and the gateways of Midas degen NFTs
266
265
  */
267
266
  async function findMidasGateway(props) {
268
267
  const { anvil, token, marketConfigurators, logger } = props;
@@ -274,8 +273,8 @@ async function findMidasGateway(props) {
274
273
  });
275
274
  await sdk.attach({ marketConfigurators });
276
275
  }
277
- const candidates = require_dev_midasUtils.collectMidasGateways(sdk);
278
- if (candidates.length === 0) throw new Error("no midas gateway adapters found in loaded markets");
276
+ const candidates = await require_dev_midasUtils.collectMidasGateways(sdk);
277
+ if (candidates.length === 0) throw new Error("no midas gateway adapters or midas degen NFTs found in loaded markets");
279
278
  const index = (await anvil.multicall({
280
279
  allowFailure: false,
281
280
  contracts: candidates.map((address) => ({
@@ -320,7 +319,7 @@ async function registerRWAInvestor(props) {
320
319
  });
321
320
  }
322
321
  else if (dsTokens.size > 0) logger?.warn(`securitize: no registry admin, skipping ${dsTokens.size} DSToken(s)`);
323
- const gateways = require_dev_midasUtils.collectMidasGateways(sdk);
322
+ const gateways = await require_dev_midasUtils.collectMidasGateways(sdk);
324
323
  for (const gateway of gateways) try {
325
324
  await greenlistMidasGateway({
326
325
  anvil,
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_utils_AddressSet = require("../onchain/utils/AddressSet.js");
3
3
  const require_onchain_market_adapters_contracts_MidasGatewayAdapterContract = require("../onchain/market/adapters/contracts/MidasGatewayAdapterContract.js");
4
+ const require_onchain_market_rwa_midas_MidasDegenNFT = require("../onchain/market/rwa/midas/MidasDegenNFT.js");
4
5
  require("../onchain/index.js");
5
6
  let viem = require("viem");
6
7
  //#region src/dev/midasUtils.ts
@@ -151,11 +152,13 @@ function* midasGatewayAdapters(sdk) {
151
152
  }
152
153
  /**
153
154
  * Target contracts of all Midas gateway adapters of the loaded credit managers,
154
- * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
155
+ * plus gateways of Midas degen NFTs (permissioned-mode suites with no gateway adapter).
155
156
  */
156
- function collectMidasGateways(sdk) {
157
+ async function collectMidasGateways(sdk) {
157
158
  const gateways = new require_onchain_utils_AddressSet.AddressSet();
158
159
  for (const adapter of midasGatewayAdapters(sdk)) gateways.add(adapter.targetContract);
160
+ const nfts = await Promise.all(sdk.marketRegister.creditManagers.map((cm) => cm.degenNFT()));
161
+ for (const nft of nfts) if (nft instanceof require_onchain_market_rwa_midas_MidasDegenNFT.MidasDegenNFT) gateways.add(nft.gateway);
159
162
  return gateways.asArray();
160
163
  }
161
164
  /**
@@ -78,11 +78,7 @@ const iFaucetAbi = [
78
78
  internalType: "uint256"
79
79
  }]
80
80
  }],
81
- outputs: [{
82
- name: "",
83
- type: "bool",
84
- internalType: "bool"
85
- }],
81
+ outputs: [],
86
82
  stateMutability: "nonpayable"
87
83
  },
88
84
  {
@@ -97,11 +93,7 @@ const iFaucetAbi = [
97
93
  type: "uint256",
98
94
  internalType: "uint256"
99
95
  }],
100
- outputs: [{
101
- name: "",
102
- type: "bool",
103
- internalType: "bool"
104
- }],
96
+ outputs: [],
105
97
  stateMutability: "nonpayable"
106
98
  },
107
99
  {
@@ -112,11 +104,7 @@ const iFaucetAbi = [
112
104
  type: "address",
113
105
  internalType: "address"
114
106
  }],
115
- outputs: [{
116
- name: "",
117
- type: "bool",
118
- internalType: "bool"
119
- }],
107
+ outputs: [],
120
108
  stateMutability: "nonpayable"
121
109
  },
122
110
  {
@@ -188,6 +176,17 @@ const iFaucetAbi = [
188
176
  }],
189
177
  stateMutability: "view"
190
178
  },
179
+ {
180
+ type: "function",
181
+ name: "owner",
182
+ inputs: [],
183
+ outputs: [{
184
+ name: "",
185
+ type: "address",
186
+ internalType: "address"
187
+ }],
188
+ stateMutability: "view"
189
+ },
191
190
  {
192
191
  type: "function",
193
192
  name: "prices",
@@ -260,8 +260,7 @@ async function greenlistMidasGateway(props) {
260
260
  }
261
261
  /**
262
262
  * Finds the Midas gateway that issues `token` by scanning the Midas gateway
263
- * adapters of all loaded credit managers, same as the foundry tests do with
264
- * `ICreditConfiguratorV3.allowedAdapters`
263
+ * adapters of all loaded credit managers and the gateways of Midas degen NFTs
265
264
  */
266
265
  async function findMidasGateway(props) {
267
266
  const { anvil, token, marketConfigurators, logger } = props;
@@ -273,8 +272,8 @@ async function findMidasGateway(props) {
273
272
  });
274
273
  await sdk.attach({ marketConfigurators });
275
274
  }
276
- const candidates = collectMidasGateways(sdk);
277
- if (candidates.length === 0) throw new Error("no midas gateway adapters found in loaded markets");
275
+ const candidates = await collectMidasGateways(sdk);
276
+ if (candidates.length === 0) throw new Error("no midas gateway adapters or midas degen NFTs found in loaded markets");
278
277
  const index = (await anvil.multicall({
279
278
  allowFailure: false,
280
279
  contracts: candidates.map((address) => ({
@@ -319,7 +318,7 @@ async function registerRWAInvestor(props) {
319
318
  });
320
319
  }
321
320
  else if (dsTokens.size > 0) logger?.warn(`securitize: no registry admin, skipping ${dsTokens.size} DSToken(s)`);
322
- const gateways = collectMidasGateways(sdk);
321
+ const gateways = await collectMidasGateways(sdk);
323
322
  for (const gateway of gateways) try {
324
323
  await greenlistMidasGateway({
325
324
  anvil,
@@ -1,5 +1,6 @@
1
1
  import { AddressSet } from "../onchain/utils/AddressSet.js";
2
2
  import { MidasGatewayAdapterContract } from "../onchain/market/adapters/contracts/MidasGatewayAdapterContract.js";
3
+ import { MidasDegenNFT } from "../onchain/market/rwa/midas/MidasDegenNFT.js";
3
4
  import "../onchain/index.js";
4
5
  import { parseAbi, parseEther, toFunctionSelector } from "viem";
5
6
  //#region src/dev/midasUtils.ts
@@ -150,11 +151,13 @@ function* midasGatewayAdapters(sdk) {
150
151
  }
151
152
  /**
152
153
  * Target contracts of all Midas gateway adapters of the loaded credit managers,
153
- * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
154
+ * plus gateways of Midas degen NFTs (permissioned-mode suites with no gateway adapter).
154
155
  */
155
- function collectMidasGateways(sdk) {
156
+ async function collectMidasGateways(sdk) {
156
157
  const gateways = new AddressSet();
157
158
  for (const adapter of midasGatewayAdapters(sdk)) gateways.add(adapter.targetContract);
159
+ const nfts = await Promise.all(sdk.marketRegister.creditManagers.map((cm) => cm.degenNFT()));
160
+ for (const nft of nfts) if (nft instanceof MidasDegenNFT) gateways.add(nft.gateway);
158
161
  return gateways.asArray();
159
162
  }
160
163
  /**
@@ -108,11 +108,7 @@ declare const iFaucetAbi: readonly [{
108
108
  readonly internalType: "uint256";
109
109
  }];
110
110
  }];
111
- readonly outputs: readonly [{
112
- readonly name: "";
113
- readonly type: "bool";
114
- readonly internalType: "bool";
115
- }];
111
+ readonly outputs: readonly [];
116
112
  readonly stateMutability: "nonpayable";
117
113
  }, {
118
114
  readonly type: "function";
@@ -126,11 +122,7 @@ declare const iFaucetAbi: readonly [{
126
122
  readonly type: "uint256";
127
123
  readonly internalType: "uint256";
128
124
  }];
129
- readonly outputs: readonly [{
130
- readonly name: "";
131
- readonly type: "bool";
132
- readonly internalType: "bool";
133
- }];
125
+ readonly outputs: readonly [];
134
126
  readonly stateMutability: "nonpayable";
135
127
  }, {
136
128
  readonly type: "function";
@@ -140,11 +132,7 @@ declare const iFaucetAbi: readonly [{
140
132
  readonly type: "address";
141
133
  readonly internalType: "address";
142
134
  }];
143
- readonly outputs: readonly [{
144
- readonly name: "";
145
- readonly type: "bool";
146
- readonly internalType: "bool";
147
- }];
135
+ readonly outputs: readonly [];
148
136
  readonly stateMutability: "nonpayable";
149
137
  }, {
150
138
  readonly type: "function";
@@ -207,6 +195,16 @@ declare const iFaucetAbi: readonly [{
207
195
  readonly internalType: "uint256";
208
196
  }];
209
197
  readonly stateMutability: "view";
198
+ }, {
199
+ readonly type: "function";
200
+ readonly name: "owner";
201
+ readonly inputs: readonly [];
202
+ readonly outputs: readonly [{
203
+ readonly name: "";
204
+ readonly type: "address";
205
+ readonly internalType: "address";
206
+ }];
207
+ readonly stateMutability: "view";
210
208
  }, {
211
209
  readonly type: "function";
212
210
  readonly name: "prices";
@@ -35,9 +35,9 @@ type RestoreMidasIssuanceVaultPause = () => Promise<void>;
35
35
  declare function unpauseMidasIssuanceVault(props: UnpauseMidasIssuanceVaultProps): Promise<RestoreMidasIssuanceVaultPause>;
36
36
  /**
37
37
  * Target contracts of all Midas gateway adapters of the loaded credit managers,
38
- * same as the foundry tests do with `ICreditConfiguratorV3.allowedAdapters`
38
+ * plus gateways of Midas degen NFTs (permissioned-mode suites with no gateway adapter).
39
39
  */
40
- declare function collectMidasGateways(sdk: OnchainSDK): Address[];
40
+ declare function collectMidasGateways(sdk: OnchainSDK): Promise<Address[]>;
41
41
  /**
42
42
  * mTokens of all Midas gateway adapters of the loaded credit managers
43
43
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.6.0-next.2",
3
+ "version": "16.6.0-next.4",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {