@gearbox-protocol/sdk 16.6.0-next.2 → 16.6.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/dev/kycUtils.js
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
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
|
/**
|
package/dist/esm/dev/kycUtils.js
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
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
|
/**
|
|
@@ -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
|
-
*
|
|
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
|
*/
|