@gearbox-protocol/sdk 13.0.0-next.2 → 13.0.0-next.20
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/abi/310/iSecuritizeKYCFactory.js +356 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +138 -118
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +9 -4
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +158 -19
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +110 -6
- package/dist/cjs/sdk/market/index.js +5 -1
- package/dist/cjs/sdk/market/kyc/SecuritizeKYCFactory.js +64 -0
- package/dist/cjs/sdk/market/kyc/index.js +22 -0
- package/dist/cjs/sdk/market/types.js +16 -0
- package/dist/cjs/sdk/pools/PoolService.js +180 -99
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +16 -0
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +332 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +140 -118
- package/dist/esm/sdk/accounts/CreditAccountsServiceV300.js +9 -4
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +9 -4
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +162 -18
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/{pools/extraZappers.js → market/ZapperRegister.js} +109 -2
- package/dist/esm/sdk/market/index.js +2 -0
- package/dist/esm/sdk/market/kyc/SecuritizeKYCFactory.js +40 -0
- package/dist/esm/sdk/market/kyc/index.js +1 -0
- package/dist/esm/sdk/market/types.js +0 -0
- package/dist/esm/sdk/pools/PoolService.js +181 -106
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/viem/sendRawTx.js +19 -1
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +431 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +45 -25
- package/dist/types/sdk/accounts/types.d.ts +28 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +30 -5
- package/dist/types/sdk/base/token-types.d.ts +9 -2
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/ZapperRegister.d.ts +17 -0
- package/dist/types/sdk/market/index.d.ts +2 -0
- package/dist/types/sdk/market/kyc/SecuritizeKYCFactory.d.ts +445 -0
- package/dist/types/sdk/market/kyc/index.d.ts +1 -0
- package/dist/types/sdk/market/types.d.ts +10 -0
- package/dist/types/sdk/pools/PoolService.d.ts +4 -4
- package/dist/types/sdk/pools/types.d.ts +25 -16
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +5 -1
- package/package.json +1 -1
- package/dist/types/sdk/pools/extraZappers.d.ts +0 -9
|
@@ -22,20 +22,34 @@ __export(TokensMeta_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(TokensMeta_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
+
var import_iSecuritizeKYCFactory = require("../../abi/310/iSecuritizeKYCFactory.js");
|
|
25
26
|
var import_iStateSerializer = require("../../abi/iStateSerializer.js");
|
|
26
27
|
var import_iVersion = require("../../abi/iVersion.js");
|
|
27
|
-
var import__ = require("../index.js");
|
|
28
28
|
var import_utils = require("../utils/index.js");
|
|
29
|
+
var import_token_types = require("./token-types.js");
|
|
29
30
|
class TokensMeta extends import_utils.AddressMap {
|
|
30
31
|
#client;
|
|
31
|
-
#tokenDataLoaded =
|
|
32
|
-
|
|
32
|
+
#tokenDataLoaded = new import_utils.AddressSet();
|
|
33
|
+
#logger;
|
|
34
|
+
constructor(client, logger) {
|
|
33
35
|
super(void 0, "tokensMeta");
|
|
34
36
|
this.#client = client;
|
|
37
|
+
this.#logger = logger?.child?.({ name: "TokensMeta" }) ?? logger;
|
|
35
38
|
}
|
|
36
39
|
reset() {
|
|
37
40
|
this.clear();
|
|
38
|
-
this.#tokenDataLoaded
|
|
41
|
+
this.#tokenDataLoaded.clear();
|
|
42
|
+
}
|
|
43
|
+
upsert(address, value) {
|
|
44
|
+
let v = value;
|
|
45
|
+
const existing = this.get(address);
|
|
46
|
+
if (existing && v) {
|
|
47
|
+
v = {
|
|
48
|
+
...existing,
|
|
49
|
+
...v
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
super.upsert(address, v);
|
|
39
53
|
}
|
|
40
54
|
symbol(token) {
|
|
41
55
|
return this.mustGet(token).symbol;
|
|
@@ -43,21 +57,48 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
43
57
|
decimals(token) {
|
|
44
58
|
return this.mustGet(token).decimals;
|
|
45
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if the token is a phantom token, throws if the token data is not loaded
|
|
62
|
+
* @param t
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
46
65
|
isPhantomToken(t) {
|
|
47
|
-
if (!this.#tokenDataLoaded) {
|
|
48
|
-
throw new Error(
|
|
66
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
69
|
+
);
|
|
49
70
|
}
|
|
50
71
|
return "contractType" in t && t.contractType.startsWith("PHANTOM_TOKEN::");
|
|
51
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
75
|
+
* @param t
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
52
78
|
isKYCUnderlying(t) {
|
|
53
|
-
if (!this.#tokenDataLoaded) {
|
|
54
|
-
throw new Error(
|
|
79
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
82
|
+
);
|
|
55
83
|
}
|
|
56
84
|
return "contractType" in t && t.contractType.startsWith("KYC_UNDERLYING::");
|
|
57
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the token is a DSToken, throws if the token data is not loaded
|
|
88
|
+
* @param t
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
isDSToken(t) {
|
|
92
|
+
if (!this.#tokenDataLoaded.has(t.addr)) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`extended token data not loaded for ${t.symbol} (${t.addr})`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return !!t.isDSToken;
|
|
98
|
+
}
|
|
58
99
|
/**
|
|
59
100
|
* Returns a map of all phantom tokens
|
|
60
|
-
* Throws if
|
|
101
|
+
* Throws if token data is not loaded
|
|
61
102
|
*/
|
|
62
103
|
get phantomTokens() {
|
|
63
104
|
const result = new import_utils.AddressMap();
|
|
@@ -68,6 +109,10 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
68
109
|
}
|
|
69
110
|
return result;
|
|
70
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns a map of all KYC underlying tokens
|
|
114
|
+
* Throws if token data is not loaded
|
|
115
|
+
*/
|
|
71
116
|
get kycUnderlyings() {
|
|
72
117
|
const result = new import_utils.AddressMap();
|
|
73
118
|
for (const [token, meta] of this.entries()) {
|
|
@@ -77,6 +122,15 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
77
122
|
}
|
|
78
123
|
return result;
|
|
79
124
|
}
|
|
125
|
+
get dsTokens() {
|
|
126
|
+
const result = new import_utils.AddressMap();
|
|
127
|
+
for (const [token, meta] of this.entries()) {
|
|
128
|
+
if (this.isDSToken(meta)) {
|
|
129
|
+
result.upsert(token, meta);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
80
134
|
formatBN(arg0, arg1, arg2) {
|
|
81
135
|
const token = typeof arg0 === "object" ? arg0.token : arg0;
|
|
82
136
|
const amount = typeof arg0 === "object" ? arg0.balance : arg1;
|
|
@@ -96,12 +150,18 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
96
150
|
return meta;
|
|
97
151
|
}
|
|
98
152
|
/**
|
|
99
|
-
* Loads token information about phantom
|
|
153
|
+
* Loads token information about phantom tokens, KYC underlying tokens and DSTokens
|
|
154
|
+
*
|
|
155
|
+
* @param tokens - tokens to load data for, defaults to all tokens
|
|
100
156
|
*/
|
|
101
|
-
async loadTokenData() {
|
|
102
|
-
const
|
|
157
|
+
async loadTokenData(...tokens) {
|
|
158
|
+
const tokenz = new import_utils.AddressSet(tokens.length > 0 ? tokens : this.keys());
|
|
159
|
+
const tokensToLoad = Array.from(tokenz.difference(this.#tokenDataLoaded));
|
|
160
|
+
if (tokensToLoad.length === 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
103
163
|
const resp = await this.#client.multicall({
|
|
104
|
-
contracts:
|
|
164
|
+
contracts: tokensToLoad.flatMap(
|
|
105
165
|
(t) => [
|
|
106
166
|
{
|
|
107
167
|
address: t,
|
|
@@ -118,15 +178,26 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
118
178
|
allowFailure: true,
|
|
119
179
|
batchSize: 0
|
|
120
180
|
});
|
|
121
|
-
|
|
122
|
-
|
|
181
|
+
this.#logger?.debug(`loaded ${resp.length} contract types`);
|
|
182
|
+
const kycFactories = new import_utils.AddressSet();
|
|
183
|
+
for (let i = 0; i < tokensToLoad.length; i++) {
|
|
184
|
+
const meta = this.#overrideTokenMeta(
|
|
185
|
+
tokensToLoad[i],
|
|
186
|
+
resp[2 * i],
|
|
187
|
+
resp[2 * i + 1]
|
|
188
|
+
);
|
|
189
|
+
this.#tokenDataLoaded.add(tokensToLoad[i]);
|
|
190
|
+
if (this.isKYCUnderlying(meta)) {
|
|
191
|
+
kycFactories.add(meta.kycFactory);
|
|
192
|
+
}
|
|
123
193
|
}
|
|
124
|
-
this.#
|
|
194
|
+
this.#logger?.debug(`found ${kycFactories.size} KYC factories`);
|
|
195
|
+
await this.#loadDSTokens(kycFactories);
|
|
125
196
|
}
|
|
126
197
|
#overrideTokenMeta(token, contractTypeResp, serializeResp) {
|
|
127
198
|
const meta = this.mustGet(token);
|
|
128
199
|
if (contractTypeResp.status === "success") {
|
|
129
|
-
const contractType = (0,
|
|
200
|
+
const contractType = (0, import_utils.bytes32ToString)(contractTypeResp.result);
|
|
130
201
|
if (contractType.startsWith("KYC_UNDERLYING::")) {
|
|
131
202
|
if (serializeResp.status === "success") {
|
|
132
203
|
this.#overrideKYCUnderlying(meta, contractType, serializeResp.result);
|
|
@@ -141,10 +212,12 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
141
212
|
contractType
|
|
142
213
|
});
|
|
143
214
|
}
|
|
215
|
+
this.#logger?.debug(`token ${meta.symbol} is ${contractType}`);
|
|
144
216
|
}
|
|
217
|
+
return this.mustGet(token);
|
|
145
218
|
}
|
|
146
219
|
#overrideKYCUnderlying(meta, contractType, serialized) {
|
|
147
|
-
if (contractType ===
|
|
220
|
+
if (contractType === import_token_types.KYC_UNDERLYING_DEFAULT) {
|
|
148
221
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
149
222
|
[
|
|
150
223
|
{ type: "address", name: "kycFactory" },
|
|
@@ -158,7 +231,7 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
158
231
|
kycFactory: decoded[0],
|
|
159
232
|
asset: decoded[1]
|
|
160
233
|
});
|
|
161
|
-
} else if (contractType ===
|
|
234
|
+
} else if (contractType === import_token_types.KYC_UNDERLYING_ON_DEMAND) {
|
|
162
235
|
const decoded = (0, import_viem.decodeAbiParameters)(
|
|
163
236
|
[
|
|
164
237
|
{ type: "address", name: "kycFactory" },
|
|
@@ -178,6 +251,72 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
178
251
|
});
|
|
179
252
|
}
|
|
180
253
|
}
|
|
254
|
+
async #loadDSTokens(kycFactories) {
|
|
255
|
+
const resp = await this.#client.multicall({
|
|
256
|
+
contracts: kycFactories.map((address) => ({
|
|
257
|
+
address,
|
|
258
|
+
abi: import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi,
|
|
259
|
+
functionName: "getDSTokens"
|
|
260
|
+
})),
|
|
261
|
+
allowFailure: false,
|
|
262
|
+
batchSize: 0
|
|
263
|
+
});
|
|
264
|
+
const dsToken = new import_utils.AddressSet(resp.flat());
|
|
265
|
+
const tokensToLoad = dsToken.difference(new Set(this.keys()));
|
|
266
|
+
this.#logger?.debug(
|
|
267
|
+
`found ${dsToken.size} DSTokens in KYC factories, need to load ${tokensToLoad.size} basic metadata`
|
|
268
|
+
);
|
|
269
|
+
await this.#loadWithoutCompressor(tokensToLoad);
|
|
270
|
+
for (const token of dsToken) {
|
|
271
|
+
const meta = this.mustGet(token);
|
|
272
|
+
this.upsert(token, {
|
|
273
|
+
...meta,
|
|
274
|
+
isDSToken: true
|
|
275
|
+
});
|
|
276
|
+
this.#tokenDataLoaded.add(token);
|
|
277
|
+
this.#logger?.debug(`token ${meta.symbol} (${token}) is a DSToken`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async #loadWithoutCompressor(tokens_) {
|
|
281
|
+
if (tokens_.size === 0) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const tokens = Array.from(tokens_);
|
|
285
|
+
const resp = await this.#client.multicall({
|
|
286
|
+
contracts: tokens.flatMap(
|
|
287
|
+
(t) => [
|
|
288
|
+
{
|
|
289
|
+
address: t,
|
|
290
|
+
abi: import_viem.erc20Abi,
|
|
291
|
+
functionName: "symbol"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
address: t,
|
|
295
|
+
abi: import_viem.erc20Abi,
|
|
296
|
+
functionName: "name"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
address: t,
|
|
300
|
+
abi: import_viem.erc20Abi,
|
|
301
|
+
functionName: "decimals"
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
),
|
|
305
|
+
allowFailure: false,
|
|
306
|
+
batchSize: 0
|
|
307
|
+
});
|
|
308
|
+
this.#logger?.debug(
|
|
309
|
+
`loaded ${resp.length} basic metadata without compressor`
|
|
310
|
+
);
|
|
311
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
312
|
+
this.upsert(tokens[i], {
|
|
313
|
+
addr: tokens[i],
|
|
314
|
+
symbol: resp[3 * i],
|
|
315
|
+
name: resp[3 * i + 1],
|
|
316
|
+
decimals: resp[3 * i + 2]
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
181
320
|
}
|
|
182
321
|
// Annotate the CommonJS export names for ESM import in node:
|
|
183
322
|
0 && (module.exports = {
|
|
@@ -22,13 +22,13 @@ __export(MarketRegister_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(MarketRegister_exports);
|
|
24
24
|
var import_marketCompressor = require("../../abi/compressors/marketCompressor.js");
|
|
25
|
-
var import_base = require("../base/index.js");
|
|
26
25
|
var import_constants = require("../constants/index.js");
|
|
27
26
|
var import_utils = require("../utils/index.js");
|
|
28
27
|
var import_viem = require("../utils/viem/index.js");
|
|
29
28
|
var import_MarketConfiguratorContract = require("./MarketConfiguratorContract.js");
|
|
30
29
|
var import_MarketSuite = require("./MarketSuite.js");
|
|
31
|
-
|
|
30
|
+
var import_ZapperRegister = require("./ZapperRegister.js");
|
|
31
|
+
class MarketRegister extends import_ZapperRegister.ZapperRegister {
|
|
32
32
|
/**
|
|
33
33
|
* Mapping pool.address -> MarketSuite
|
|
34
34
|
*/
|
|
@@ -16,12 +16,115 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var ZapperRegister_exports = {};
|
|
20
|
+
__export(ZapperRegister_exports, {
|
|
21
|
+
ZapperRegister: () => ZapperRegister
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
|
|
23
|
+
module.exports = __toCommonJS(ZapperRegister_exports);
|
|
24
|
+
var import_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
25
|
+
var import_base = require("../base/index.js");
|
|
26
|
+
var import_constants = require("../constants/index.js");
|
|
27
|
+
var import_utils = require("../utils/index.js");
|
|
28
|
+
class ZapperRegister extends import_base.SDKConstruct {
|
|
29
|
+
/**
|
|
30
|
+
* Mapping pool.address -> ZapperData[]
|
|
31
|
+
* Needs to be loaded explicitly using loadZappers method
|
|
32
|
+
*/
|
|
33
|
+
#zappers;
|
|
34
|
+
/**
|
|
35
|
+
* Load zappers for all pools using periphery compressor, adds hardcoded zappers
|
|
36
|
+
*/
|
|
37
|
+
async loadZappers(force) {
|
|
38
|
+
if (!force && this.#zappers) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const [pcAddr] = this.sdk.addressProvider.mustGetLatest(
|
|
42
|
+
import_constants.AP_PERIPHERY_COMPRESSOR,
|
|
43
|
+
import_constants.VERSION_RANGE_310
|
|
44
|
+
);
|
|
45
|
+
this.logger?.debug(`loading zappers with periphery compressor ${pcAddr}`);
|
|
46
|
+
const markets = this.sdk.marketRegister.markets;
|
|
47
|
+
const resp = await this.client.multicall({
|
|
48
|
+
contracts: markets.map(
|
|
49
|
+
(m) => ({
|
|
50
|
+
abi: import_peripheryCompressor.peripheryCompressorAbi,
|
|
51
|
+
address: pcAddr,
|
|
52
|
+
functionName: "getZappers",
|
|
53
|
+
args: [m.configurator.address, m.pool.pool.address]
|
|
54
|
+
})
|
|
55
|
+
),
|
|
56
|
+
allowFailure: true,
|
|
57
|
+
batchSize: 0
|
|
58
|
+
});
|
|
59
|
+
this.#zappers = new import_utils.AddressMap(void 0, "zappers");
|
|
60
|
+
for (let i = 0; i < resp.length; i++) {
|
|
61
|
+
const { status, result, error } = resp[i];
|
|
62
|
+
const marketConfigurator = markets[i].configurator.address;
|
|
63
|
+
const pool = markets[i].pool.pool.address;
|
|
64
|
+
if (status === "success") {
|
|
65
|
+
for (const z of result) {
|
|
66
|
+
this.#addZapper({ ...z, pool, type: "base" });
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
this.logger?.error(
|
|
70
|
+
`failed to load zapper for market configurator ${this.labelAddress(
|
|
71
|
+
marketConfigurator
|
|
72
|
+
)} and pool ${this.labelAddress(pool)}: ${error}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
for (const z of KYC_ZAPPERS[this.networkType] ?? []) {
|
|
77
|
+
this.#addZapper({ ...z, type: "kyc" });
|
|
78
|
+
}
|
|
79
|
+
for (const z of MIGRATION_ZAPPERS[this.networkType] ?? []) {
|
|
80
|
+
this.#addZapper({ ...z, type: "migration" });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
#addZapper(z) {
|
|
84
|
+
if (BROKEN_ZAPPERS.has(z.baseParams.addr)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const existing = this.zappers.get(z.pool);
|
|
88
|
+
if (existing) {
|
|
89
|
+
const hasZapper = existing.some(
|
|
90
|
+
(zz) => (0, import_utils.hexEq)(zz.baseParams.addr, z.baseParams.addr)
|
|
91
|
+
);
|
|
92
|
+
if (!hasZapper) {
|
|
93
|
+
existing.push(z);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
this.zappers.upsert(z.pool, [z]);
|
|
97
|
+
}
|
|
98
|
+
const zappersTokens = [z.tokenIn, z.tokenOut];
|
|
99
|
+
for (const t of zappersTokens) {
|
|
100
|
+
this.sdk.tokensMeta.upsert(t.addr, t);
|
|
101
|
+
this.sdk.setAddressLabel(t.addr, t.symbol);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get zappers() {
|
|
105
|
+
if (!this.#zappers) {
|
|
106
|
+
throw new Error("zappers not loaded, call loadZappers first");
|
|
107
|
+
}
|
|
108
|
+
return this.#zappers;
|
|
109
|
+
}
|
|
110
|
+
poolZappers(pool) {
|
|
111
|
+
return this.zappers.get(pool) ?? [];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Can return multiple zappers if there are multiple zappers for the same tokenIn and tokenOut
|
|
115
|
+
*/
|
|
116
|
+
getZapper(pool, tokenIn, tokenOut) {
|
|
117
|
+
const zappers = this.zappers.get(pool)?.filter(
|
|
118
|
+
(z) => (0, import_utils.hexEq)(z.tokenIn.addr, tokenIn) && (0, import_utils.hexEq)(z.tokenOut.addr, tokenOut)
|
|
119
|
+
);
|
|
120
|
+
return zappers;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const BROKEN_ZAPPERS = new import_utils.AddressMap(
|
|
124
|
+
[["0x90D66b03EC4D462e42e3c7741049FB46a4a03B69", true]],
|
|
125
|
+
"brokenZappers"
|
|
126
|
+
);
|
|
127
|
+
const MIGRATION_ZAPPERS = {
|
|
25
128
|
Mainnet: [
|
|
26
129
|
{
|
|
27
130
|
baseParams: {
|
|
@@ -130,7 +233,8 @@ const extraZappers = {
|
|
|
130
233
|
}
|
|
131
234
|
]
|
|
132
235
|
};
|
|
236
|
+
const KYC_ZAPPERS = {};
|
|
133
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
134
238
|
0 && (module.exports = {
|
|
135
|
-
|
|
239
|
+
ZapperRegister
|
|
136
240
|
});
|
|
@@ -17,18 +17,22 @@ var market_exports = {};
|
|
|
17
17
|
module.exports = __toCommonJS(market_exports);
|
|
18
18
|
__reExport(market_exports, require("./adapters/index.js"), module.exports);
|
|
19
19
|
__reExport(market_exports, require("./credit/index.js"), module.exports);
|
|
20
|
+
__reExport(market_exports, require("./kyc/index.js"), module.exports);
|
|
20
21
|
__reExport(market_exports, require("./MarketRegister.js"), module.exports);
|
|
21
22
|
__reExport(market_exports, require("./MarketSuite.js"), module.exports);
|
|
22
23
|
__reExport(market_exports, require("./oracle/index.js"), module.exports);
|
|
23
24
|
__reExport(market_exports, require("./pool/index.js"), module.exports);
|
|
24
25
|
__reExport(market_exports, require("./pricefeeds/index.js"), module.exports);
|
|
26
|
+
__reExport(market_exports, require("./types.js"), module.exports);
|
|
25
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
28
|
0 && (module.exports = {
|
|
27
29
|
...require("./adapters/index.js"),
|
|
28
30
|
...require("./credit/index.js"),
|
|
31
|
+
...require("./kyc/index.js"),
|
|
29
32
|
...require("./MarketRegister.js"),
|
|
30
33
|
...require("./MarketSuite.js"),
|
|
31
34
|
...require("./oracle/index.js"),
|
|
32
35
|
...require("./pool/index.js"),
|
|
33
|
-
...require("./pricefeeds/index.js")
|
|
36
|
+
...require("./pricefeeds/index.js"),
|
|
37
|
+
...require("./types.js")
|
|
34
38
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SecuritizeKYCFactory_exports = {};
|
|
20
|
+
__export(SecuritizeKYCFactory_exports, {
|
|
21
|
+
SecuritizeKYCFactory: () => SecuritizeKYCFactory
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SecuritizeKYCFactory_exports);
|
|
24
|
+
var import_iSecuritizeKYCFactory = require("../../../abi/310/iSecuritizeKYCFactory.js");
|
|
25
|
+
var import_base = require("../../base/index.js");
|
|
26
|
+
const abi = import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi;
|
|
27
|
+
class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
28
|
+
constructor(options, address) {
|
|
29
|
+
super(options, {
|
|
30
|
+
addr: address,
|
|
31
|
+
name: "SecuritizeKYCFactory",
|
|
32
|
+
abi
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async precomputeWalletAddress(creditManager, investor) {
|
|
36
|
+
return this.contract.read.precomputeWalletAddress([
|
|
37
|
+
creditManager,
|
|
38
|
+
investor
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
async getWallet(creditAccount) {
|
|
42
|
+
return this.contract.read.getWallet([creditAccount]);
|
|
43
|
+
}
|
|
44
|
+
async getDSTokens() {
|
|
45
|
+
const tokens = await this.contract.read.getDSTokens();
|
|
46
|
+
return [...tokens];
|
|
47
|
+
}
|
|
48
|
+
multicall(creditAccount, calls, tokensToRegister) {
|
|
49
|
+
return this.createRawTx({
|
|
50
|
+
functionName: "multicall",
|
|
51
|
+
args: [creditAccount, calls, tokensToRegister]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
openCreditAccount(creditManager, calls, tokensToRegister) {
|
|
55
|
+
return this.createRawTx({
|
|
56
|
+
functionName: "openCreditAccount",
|
|
57
|
+
args: [creditManager, calls, tokensToRegister]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
SecuritizeKYCFactory
|
|
64
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var kyc_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(kyc_exports);
|
|
18
|
+
__reExport(kyc_exports, require("./SecuritizeKYCFactory.js"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./SecuritizeKYCFactory.js")
|
|
22
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|