@gearbox-protocol/sdk 14.5.5 → 14.5.7
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/kyc/iDSRegistryService.js +265 -0
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +53 -6
- package/dist/cjs/history/assembleOperations.js +18 -4
- package/dist/cjs/history/classifyMulticallOperations.js +20 -4
- package/dist/cjs/history/errors.js +12 -2
- package/dist/cjs/history/extractTransfers.js +12 -1
- package/dist/cjs/history/parseCreditAccountTransaction.js +3 -1
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeDegenNFT.js +41 -0
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +3 -2
- package/dist/esm/abi/kyc/iDSRegistryService.js +265 -0
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +53 -6
- package/dist/esm/history/assembleOperations.js +18 -4
- package/dist/esm/history/classifyMulticallOperations.js +25 -5
- package/dist/esm/history/errors.js +10 -1
- package/dist/esm/history/extractTransfers.js +12 -1
- package/dist/esm/history/parseCreditAccountTransaction.js +3 -1
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeDegenNFT.js +17 -0
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +3 -2
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +210 -0
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +78 -6
- package/dist/types/history/assembleOperations.d.ts +2 -0
- package/dist/types/history/classifyMulticallOperations.d.ts +2 -0
- package/dist/types/history/errors.d.ts +3 -0
- package/dist/types/history/extractTransfers.d.ts +19 -0
- package/dist/types/sdk/market/kyc/securitize/SecuritizeDegenNFT.d.ts +412 -0
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +80 -7
- package/package.json +1 -1
|
@@ -141,6 +141,271 @@ const iDSRegistryServiceAbi = [
|
|
|
141
141
|
],
|
|
142
142
|
outputs: [],
|
|
143
143
|
stateMutability: "nonpayable"
|
|
144
|
+
},
|
|
145
|
+
// Events below are copied from contract to interface
|
|
146
|
+
{
|
|
147
|
+
anonymous: false,
|
|
148
|
+
inputs: [
|
|
149
|
+
{
|
|
150
|
+
indexed: false,
|
|
151
|
+
internalType: "string",
|
|
152
|
+
name: "investorId",
|
|
153
|
+
type: "string"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
indexed: false,
|
|
157
|
+
internalType: "address",
|
|
158
|
+
name: "sender",
|
|
159
|
+
type: "address"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
name: "DSRegistryServiceInvestorAdded",
|
|
163
|
+
type: "event"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
anonymous: false,
|
|
167
|
+
inputs: [
|
|
168
|
+
{
|
|
169
|
+
indexed: false,
|
|
170
|
+
internalType: "string",
|
|
171
|
+
name: "investorId",
|
|
172
|
+
type: "string"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
indexed: false,
|
|
176
|
+
internalType: "uint256",
|
|
177
|
+
name: "attributeId",
|
|
178
|
+
type: "uint256"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
indexed: false,
|
|
182
|
+
internalType: "uint256",
|
|
183
|
+
name: "value",
|
|
184
|
+
type: "uint256"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
indexed: false,
|
|
188
|
+
internalType: "uint256",
|
|
189
|
+
name: "expiry",
|
|
190
|
+
type: "uint256"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
indexed: false,
|
|
194
|
+
internalType: "string",
|
|
195
|
+
name: "proofHash",
|
|
196
|
+
type: "string"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
indexed: false,
|
|
200
|
+
internalType: "address",
|
|
201
|
+
name: "sender",
|
|
202
|
+
type: "address"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
name: "DSRegistryServiceInvestorAttributeChanged",
|
|
206
|
+
type: "event"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
anonymous: false,
|
|
210
|
+
inputs: [
|
|
211
|
+
{
|
|
212
|
+
indexed: false,
|
|
213
|
+
internalType: "string",
|
|
214
|
+
name: "investorId",
|
|
215
|
+
type: "string"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
indexed: false,
|
|
219
|
+
internalType: "string",
|
|
220
|
+
name: "country",
|
|
221
|
+
type: "string"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
indexed: false,
|
|
225
|
+
internalType: "address",
|
|
226
|
+
name: "sender",
|
|
227
|
+
type: "address"
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
name: "DSRegistryServiceInvestorCountryChanged",
|
|
231
|
+
type: "event"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
anonymous: false,
|
|
235
|
+
inputs: [
|
|
236
|
+
{
|
|
237
|
+
indexed: false,
|
|
238
|
+
internalType: "string",
|
|
239
|
+
name: "investorId",
|
|
240
|
+
type: "string"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
indexed: false,
|
|
244
|
+
internalType: "address",
|
|
245
|
+
name: "sender",
|
|
246
|
+
type: "address"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
name: "DSRegistryServiceInvestorRemoved",
|
|
250
|
+
type: "event"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
anonymous: false,
|
|
254
|
+
inputs: [
|
|
255
|
+
{
|
|
256
|
+
indexed: false,
|
|
257
|
+
internalType: "address",
|
|
258
|
+
name: "omnibusWallet",
|
|
259
|
+
type: "address"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
indexed: false,
|
|
263
|
+
internalType: "string",
|
|
264
|
+
name: "investorId",
|
|
265
|
+
type: "string"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
indexed: false,
|
|
269
|
+
internalType: "contract IDSOmnibusWalletController",
|
|
270
|
+
name: "omnibusWalletController",
|
|
271
|
+
type: "address"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
name: "DSRegistryServiceOmnibusWalletAdded",
|
|
275
|
+
type: "event"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
anonymous: false,
|
|
279
|
+
inputs: [
|
|
280
|
+
{
|
|
281
|
+
indexed: false,
|
|
282
|
+
internalType: "address",
|
|
283
|
+
name: "omnibusWallet",
|
|
284
|
+
type: "address"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
indexed: false,
|
|
288
|
+
internalType: "string",
|
|
289
|
+
name: "investorId",
|
|
290
|
+
type: "string"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
name: "DSRegistryServiceOmnibusWalletRemoved",
|
|
294
|
+
type: "event"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
anonymous: false,
|
|
298
|
+
inputs: [
|
|
299
|
+
{
|
|
300
|
+
indexed: false,
|
|
301
|
+
internalType: "address",
|
|
302
|
+
name: "wallet",
|
|
303
|
+
type: "address"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
indexed: false,
|
|
307
|
+
internalType: "string",
|
|
308
|
+
name: "investorId",
|
|
309
|
+
type: "string"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
indexed: false,
|
|
313
|
+
internalType: "address",
|
|
314
|
+
name: "sender",
|
|
315
|
+
type: "address"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
name: "DSRegistryServiceWalletAdded",
|
|
319
|
+
type: "event"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
anonymous: false,
|
|
323
|
+
inputs: [
|
|
324
|
+
{
|
|
325
|
+
indexed: false,
|
|
326
|
+
internalType: "address",
|
|
327
|
+
name: "wallet",
|
|
328
|
+
type: "address"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
indexed: false,
|
|
332
|
+
internalType: "string",
|
|
333
|
+
name: "investorId",
|
|
334
|
+
type: "string"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
indexed: false,
|
|
338
|
+
internalType: "address",
|
|
339
|
+
name: "sender",
|
|
340
|
+
type: "address"
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
name: "DSRegistryServiceWalletRemoved",
|
|
344
|
+
type: "event"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
anonymous: false,
|
|
348
|
+
inputs: [
|
|
349
|
+
{
|
|
350
|
+
indexed: false,
|
|
351
|
+
internalType: "uint256",
|
|
352
|
+
name: "serviceId",
|
|
353
|
+
type: "uint256"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
indexed: false,
|
|
357
|
+
internalType: "address",
|
|
358
|
+
name: "serviceAddress",
|
|
359
|
+
type: "address"
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
name: "DSServiceSet",
|
|
363
|
+
type: "event"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
anonymous: false,
|
|
367
|
+
inputs: [
|
|
368
|
+
{
|
|
369
|
+
indexed: false,
|
|
370
|
+
internalType: "uint64",
|
|
371
|
+
name: "version",
|
|
372
|
+
type: "uint64"
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
name: "Initialized",
|
|
376
|
+
type: "event"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
anonymous: false,
|
|
380
|
+
inputs: [
|
|
381
|
+
{
|
|
382
|
+
indexed: true,
|
|
383
|
+
internalType: "address",
|
|
384
|
+
name: "previousOwner",
|
|
385
|
+
type: "address"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
indexed: true,
|
|
389
|
+
internalType: "address",
|
|
390
|
+
name: "newOwner",
|
|
391
|
+
type: "address"
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
name: "OwnershipTransferred",
|
|
395
|
+
type: "event"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
anonymous: false,
|
|
399
|
+
inputs: [
|
|
400
|
+
{
|
|
401
|
+
indexed: true,
|
|
402
|
+
internalType: "address",
|
|
403
|
+
name: "implementation",
|
|
404
|
+
type: "address"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
name: "Upgraded",
|
|
408
|
+
type: "event"
|
|
144
409
|
}
|
|
145
410
|
];
|
|
146
411
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -188,7 +188,28 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
type: "function",
|
|
191
|
-
name: "
|
|
191
|
+
name: "setAllCreditAccountsFrozenStatus",
|
|
192
|
+
inputs: [
|
|
193
|
+
{ name: "creditManager", type: "address", internalType: "address" },
|
|
194
|
+
{ name: "investor", type: "address", internalType: "address" },
|
|
195
|
+
{ name: "frozen", type: "bool", internalType: "bool" }
|
|
196
|
+
],
|
|
197
|
+
outputs: [],
|
|
198
|
+
stateMutability: "nonpayable"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "function",
|
|
202
|
+
name: "setAllCreditAccountsFrozenStatus",
|
|
203
|
+
inputs: [
|
|
204
|
+
{ name: "investor", type: "address", internalType: "address" },
|
|
205
|
+
{ name: "frozen", type: "bool", internalType: "bool" }
|
|
206
|
+
],
|
|
207
|
+
outputs: [],
|
|
208
|
+
stateMutability: "nonpayable"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
type: "function",
|
|
212
|
+
name: "setCreditAccountFrozenStatus",
|
|
192
213
|
inputs: [
|
|
193
214
|
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
194
215
|
{ name: "frozen", type: "bool", internalType: "bool" }
|
|
@@ -198,10 +219,31 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
198
219
|
},
|
|
199
220
|
{
|
|
200
221
|
type: "function",
|
|
201
|
-
name: "
|
|
222
|
+
name: "transferAllCreditAccounts",
|
|
223
|
+
inputs: [
|
|
224
|
+
{ name: "investor", type: "address", internalType: "address" },
|
|
225
|
+
{ name: "newInvestor", type: "address", internalType: "address" }
|
|
226
|
+
],
|
|
227
|
+
outputs: [],
|
|
228
|
+
stateMutability: "nonpayable"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: "function",
|
|
232
|
+
name: "transferAllCreditAccounts",
|
|
233
|
+
inputs: [
|
|
234
|
+
{ name: "creditManager", type: "address", internalType: "address" },
|
|
235
|
+
{ name: "investor", type: "address", internalType: "address" },
|
|
236
|
+
{ name: "newInvestor", type: "address", internalType: "address" }
|
|
237
|
+
],
|
|
238
|
+
outputs: [],
|
|
239
|
+
stateMutability: "nonpayable"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
type: "function",
|
|
243
|
+
name: "transferCreditAccount",
|
|
202
244
|
inputs: [
|
|
203
245
|
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
204
|
-
{ name: "
|
|
246
|
+
{ name: "newInvestor", type: "address", internalType: "address" }
|
|
205
247
|
],
|
|
206
248
|
outputs: [],
|
|
207
249
|
stateMutability: "nonpayable"
|
|
@@ -215,7 +257,7 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
215
257
|
},
|
|
216
258
|
{
|
|
217
259
|
type: "event",
|
|
218
|
-
name: "
|
|
260
|
+
name: "OpenKYCCreditAccount",
|
|
219
261
|
inputs: [
|
|
220
262
|
{
|
|
221
263
|
name: "creditAccount",
|
|
@@ -240,7 +282,7 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
240
282
|
},
|
|
241
283
|
{
|
|
242
284
|
type: "event",
|
|
243
|
-
name: "
|
|
285
|
+
name: "SetCreditAccountFrozenStatus",
|
|
244
286
|
inputs: [
|
|
245
287
|
{
|
|
246
288
|
name: "creditAccount",
|
|
@@ -254,7 +296,7 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
254
296
|
},
|
|
255
297
|
{
|
|
256
298
|
type: "event",
|
|
257
|
-
name: "
|
|
299
|
+
name: "TransferCreditAccount",
|
|
258
300
|
inputs: [
|
|
259
301
|
{
|
|
260
302
|
name: "creditAccount",
|
|
@@ -304,6 +346,11 @@ const iSecuritizeKYCFactoryAbi = [
|
|
|
304
346
|
name: "InvalidUnderlyingTokenException",
|
|
305
347
|
inputs: [{ name: "underlying", type: "address", internalType: "address" }]
|
|
306
348
|
},
|
|
349
|
+
{
|
|
350
|
+
type: "error",
|
|
351
|
+
name: "TooManyCreditAccountsException",
|
|
352
|
+
inputs: [{ name: "investor", type: "address", internalType: "address" }]
|
|
353
|
+
},
|
|
307
354
|
{
|
|
308
355
|
type: "error",
|
|
309
356
|
name: "UnknownCreditAccountException",
|
|
@@ -32,16 +32,24 @@ function assembleOperations(input) {
|
|
|
32
32
|
underlying,
|
|
33
33
|
liquidationRemainingFunds,
|
|
34
34
|
phantomTokens,
|
|
35
|
+
withdrawCollateralEvents = [],
|
|
35
36
|
strict
|
|
36
37
|
} = input;
|
|
37
|
-
let
|
|
38
|
+
let executeOffset = 0;
|
|
39
|
+
let withdrawOffset = 0;
|
|
38
40
|
return facadeCalls.map((fc) => {
|
|
39
41
|
if (fc.operation === "PartiallyLiquidateCreditAccount") {
|
|
40
42
|
return assemblePartialLiquidation(fc);
|
|
41
43
|
}
|
|
42
44
|
const count = countAdapterCalls(fc.innerCalls, register);
|
|
43
|
-
const sliced = executeResults.slice(
|
|
44
|
-
|
|
45
|
+
const sliced = executeResults.slice(executeOffset, executeOffset + count);
|
|
46
|
+
executeOffset += count;
|
|
47
|
+
const withdrawCount = countWithdrawCollateralCalls(fc.innerCalls);
|
|
48
|
+
const slicedWithdrawEvents = withdrawCollateralEvents.slice(
|
|
49
|
+
withdrawOffset,
|
|
50
|
+
withdrawOffset + withdrawCount
|
|
51
|
+
);
|
|
52
|
+
withdrawOffset += withdrawCount;
|
|
45
53
|
const protocolCalldatas = (0, import_extractProtocolCalls.extractProtocolCalls)(fc.trace, sliced);
|
|
46
54
|
const multicall = (0, import_classifyMulticallOperations.classifyMulticallOperations)({
|
|
47
55
|
innerCalls: fc.innerCalls,
|
|
@@ -51,7 +59,8 @@ function assembleOperations(input) {
|
|
|
51
59
|
creditAccount: fc.creditAccount,
|
|
52
60
|
underlying,
|
|
53
61
|
strict,
|
|
54
|
-
phantomTokens
|
|
62
|
+
phantomTokens,
|
|
63
|
+
withdrawCollateralEvents: slicedWithdrawEvents
|
|
55
64
|
});
|
|
56
65
|
switch (fc.operation) {
|
|
57
66
|
case "OpenCreditAccount":
|
|
@@ -86,6 +95,11 @@ function countAdapterCalls(innerCalls, register) {
|
|
|
86
95
|
return !contract || contract instanceof import_adapters.AbstractAdapterContract;
|
|
87
96
|
}).length;
|
|
88
97
|
}
|
|
98
|
+
function countWithdrawCollateralCalls(innerCalls) {
|
|
99
|
+
return innerCalls.filter(
|
|
100
|
+
(call) => call.functionName.startsWith("withdrawCollateral")
|
|
101
|
+
).length;
|
|
102
|
+
}
|
|
89
103
|
function assemblePartialLiquidation(fc) {
|
|
90
104
|
const { rawArgs } = fc.parsed;
|
|
91
105
|
return {
|
|
@@ -33,9 +33,11 @@ function classifyMulticallOperations(input) {
|
|
|
33
33
|
creditAccount,
|
|
34
34
|
underlying,
|
|
35
35
|
strict,
|
|
36
|
-
phantomTokens
|
|
36
|
+
phantomTokens,
|
|
37
|
+
withdrawCollateralEvents
|
|
37
38
|
} = input;
|
|
38
39
|
let transferIdx = 0;
|
|
40
|
+
let withdrawIdx = 0;
|
|
39
41
|
const result = [];
|
|
40
42
|
for (const call of innerCalls) {
|
|
41
43
|
const contract = register.getContract(call.target);
|
|
@@ -58,7 +60,14 @@ function classifyMulticallOperations(input) {
|
|
|
58
60
|
continue;
|
|
59
61
|
}
|
|
60
62
|
if (contract !== void 0) {
|
|
61
|
-
const
|
|
63
|
+
const isWithdraw = call.functionName.startsWith("withdrawCollateral");
|
|
64
|
+
const withdrawEvent = isWithdraw ? withdrawCollateralEvents?.[withdrawIdx++] : void 0;
|
|
65
|
+
const op = classifyFacadeInnerCall(
|
|
66
|
+
call,
|
|
67
|
+
underlying,
|
|
68
|
+
phantomTokens,
|
|
69
|
+
withdrawEvent
|
|
70
|
+
);
|
|
62
71
|
if (op) result.push(op);
|
|
63
72
|
continue;
|
|
64
73
|
}
|
|
@@ -93,9 +102,15 @@ function classifyMulticallOperations(input) {
|
|
|
93
102
|
if (transferIdx !== executeResults.length) {
|
|
94
103
|
throw new import_errors.TransferAlignmentError(executeResults.length, transferIdx);
|
|
95
104
|
}
|
|
105
|
+
if (withdrawCollateralEvents && withdrawCollateralEvents.length > 0 && withdrawIdx !== withdrawCollateralEvents.length) {
|
|
106
|
+
throw new import_errors.WithdrawCollateralAlignmentError(
|
|
107
|
+
withdrawCollateralEvents.length,
|
|
108
|
+
withdrawIdx
|
|
109
|
+
);
|
|
110
|
+
}
|
|
96
111
|
return result;
|
|
97
112
|
}
|
|
98
|
-
function classifyFacadeInnerCall(call, underlying, phantomTokens) {
|
|
113
|
+
function classifyFacadeInnerCall(call, underlying, phantomTokens, withdrawEvent) {
|
|
99
114
|
const { functionName: sig, rawArgs } = call;
|
|
100
115
|
const functionName = sig.split("(")[0];
|
|
101
116
|
switch (functionName) {
|
|
@@ -124,10 +139,11 @@ function classifyFacadeInnerCall(call, underlying, phantomTokens) {
|
|
|
124
139
|
calldataToken,
|
|
125
140
|
phantomTokens
|
|
126
141
|
);
|
|
142
|
+
const amount = withdrawEvent ? withdrawEvent.amount : rawArgs.amount;
|
|
127
143
|
return {
|
|
128
144
|
operation: "WithdrawCollateral",
|
|
129
145
|
token: depositedToken ?? calldataToken,
|
|
130
|
-
amount
|
|
146
|
+
amount,
|
|
131
147
|
to: rawArgs.to,
|
|
132
148
|
...depositedToken ? { phantomToken: calldataToken } : {}
|
|
133
149
|
};
|
|
@@ -23,7 +23,8 @@ __export(errors_exports, {
|
|
|
23
23
|
TransferAlignmentError: () => TransferAlignmentError,
|
|
24
24
|
UnexpectedFacadeEventOrderError: () => UnexpectedFacadeEventOrderError,
|
|
25
25
|
UnknownAdapterError: () => UnknownAdapterError,
|
|
26
|
-
UnknownFacadeCallError: () => UnknownFacadeCallError
|
|
26
|
+
UnknownFacadeCallError: () => UnknownFacadeCallError,
|
|
27
|
+
WithdrawCollateralAlignmentError: () => WithdrawCollateralAlignmentError
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(errors_exports);
|
|
29
30
|
class UnknownAdapterError extends Error {
|
|
@@ -42,6 +43,14 @@ class TransferAlignmentError extends Error {
|
|
|
42
43
|
this.name = "TransferAlignmentError";
|
|
43
44
|
}
|
|
44
45
|
}
|
|
46
|
+
class WithdrawCollateralAlignmentError extends Error {
|
|
47
|
+
constructor(expected, actual) {
|
|
48
|
+
super(
|
|
49
|
+
`withdrawCollateral event alignment mismatch: expected ${expected} events, consumed ${actual}`
|
|
50
|
+
);
|
|
51
|
+
this.name = "WithdrawCollateralAlignmentError";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
45
54
|
class ProtocolCallNotFoundError extends Error {
|
|
46
55
|
targetContract;
|
|
47
56
|
executeIndex;
|
|
@@ -89,5 +98,6 @@ class UnknownFacadeCallError extends Error {
|
|
|
89
98
|
TransferAlignmentError,
|
|
90
99
|
UnexpectedFacadeEventOrderError,
|
|
91
100
|
UnknownAdapterError,
|
|
92
|
-
UnknownFacadeCallError
|
|
101
|
+
UnknownFacadeCallError,
|
|
102
|
+
WithdrawCollateralAlignmentError
|
|
93
103
|
});
|
|
@@ -32,6 +32,7 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
32
32
|
const executeResults = [];
|
|
33
33
|
const directTransfers = [];
|
|
34
34
|
const phantomTokens = new import_sdk.AddressMap();
|
|
35
|
+
const withdrawCollateralEvents = [];
|
|
35
36
|
let liquidationRemainingFunds;
|
|
36
37
|
for (const log of logs) {
|
|
37
38
|
const facadeEvent = tryDecodeFacadeEvent(log, creditFacade);
|
|
@@ -62,6 +63,12 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
62
63
|
facadeEvent.args.token,
|
|
63
64
|
(0, import_viem.getAddress)(rawDeposit.token)
|
|
64
65
|
);
|
|
66
|
+
} else if (isWithdrawCollateral(facadeEvent, creditAccount)) {
|
|
67
|
+
withdrawCollateralEvents.push({
|
|
68
|
+
token: (0, import_viem.getAddress)(facadeEvent.args.token),
|
|
69
|
+
amount: facadeEvent.args.amount,
|
|
70
|
+
to: (0, import_viem.getAddress)(facadeEvent.args.to)
|
|
71
|
+
});
|
|
65
72
|
}
|
|
66
73
|
currentEntries = [];
|
|
67
74
|
continue;
|
|
@@ -86,7 +93,8 @@ function extractTransfers(logs, creditAccount, pool, creditFacade) {
|
|
|
86
93
|
executeResults,
|
|
87
94
|
directTransfers,
|
|
88
95
|
liquidationRemainingFunds,
|
|
89
|
-
phantomTokens
|
|
96
|
+
phantomTokens,
|
|
97
|
+
withdrawCollateralEvents
|
|
90
98
|
};
|
|
91
99
|
}
|
|
92
100
|
function buildOperationRanges(logs, facadeAddress, creditAccount) {
|
|
@@ -162,6 +170,9 @@ function isLiquidation(e, creditAccount) {
|
|
|
162
170
|
function isWithdrawPhantomToken(e, creditAccount) {
|
|
163
171
|
return e.eventName === "WithdrawPhantomToken" && (0, import_viem.isAddressEqual)(e.args.creditAccount, creditAccount);
|
|
164
172
|
}
|
|
173
|
+
function isWithdrawCollateral(e, creditAccount) {
|
|
174
|
+
return e.eventName === "WithdrawCollateral" && (0, import_viem.isAddressEqual)(e.args.creditAccount, creditAccount);
|
|
175
|
+
}
|
|
165
176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
177
|
0 && (module.exports = {
|
|
167
178
|
extractTransfers
|
|
@@ -51,7 +51,8 @@ function parseCreditAccountTransaction(input) {
|
|
|
51
51
|
executeResults,
|
|
52
52
|
directTransfers,
|
|
53
53
|
liquidationRemainingFunds,
|
|
54
|
-
phantomTokens
|
|
54
|
+
phantomTokens,
|
|
55
|
+
withdrawCollateralEvents
|
|
55
56
|
} = (0, import_extractTransfers.extractTransfers)(logs, creditAccount, pool, creditFacade);
|
|
56
57
|
const meta = {
|
|
57
58
|
creditManager,
|
|
@@ -67,6 +68,7 @@ function parseCreditAccountTransaction(input) {
|
|
|
67
68
|
underlying,
|
|
68
69
|
liquidationRemainingFunds,
|
|
69
70
|
phantomTokens,
|
|
71
|
+
withdrawCollateralEvents,
|
|
70
72
|
strict
|
|
71
73
|
}).map((o) => ({ ...o, ...meta }));
|
|
72
74
|
const directOps = directTransfers.map((dt) => ({
|
|
@@ -0,0 +1,41 @@
|
|
|
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 SecuritizeDegenNFT_exports = {};
|
|
20
|
+
__export(SecuritizeDegenNFT_exports, {
|
|
21
|
+
SecuritizeDegenNFT: () => SecuritizeDegenNFT
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SecuritizeDegenNFT_exports);
|
|
24
|
+
var import_iSecuritizeDegenNFT = require("../../../../abi/kyc/iSecuritizeDegenNFT.js");
|
|
25
|
+
var import_base = require("../../../base/index.js");
|
|
26
|
+
const abi = import_iSecuritizeDegenNFT.iSecuritizeDegenNFTAbi;
|
|
27
|
+
class SecuritizeDegenNFT extends import_base.BaseContract {
|
|
28
|
+
constructor(sdk, address) {
|
|
29
|
+
super(sdk, {
|
|
30
|
+
addr: address,
|
|
31
|
+
contractType: "DEGEN_NFT::SECURITIZE",
|
|
32
|
+
version: 310,
|
|
33
|
+
name: "SecuritizeDegenNFT",
|
|
34
|
+
abi
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
SecuritizeDegenNFT
|
|
41
|
+
});
|
|
@@ -26,6 +26,7 @@ var import_iSecuritizeKYCFactory = require("../../../../abi/kyc/iSecuritizeKYCFa
|
|
|
26
26
|
var import_base = require("../../../base/index.js");
|
|
27
27
|
var import_utils = require("../../../utils/index.js");
|
|
28
28
|
var import_constants = require("./constants.js");
|
|
29
|
+
var import_SecuritizeDegenNFT = require("./SecuritizeDegenNFT.js");
|
|
29
30
|
var import_types = require("./types.js");
|
|
30
31
|
const abi = import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi;
|
|
31
32
|
class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
@@ -59,7 +60,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
59
60
|
data.baseParams.serializedParams
|
|
60
61
|
);
|
|
61
62
|
this.owner = decoded[0];
|
|
62
|
-
this.degenNFT = decoded[1];
|
|
63
|
+
this.degenNFT = new import_SecuritizeDegenNFT.SecuritizeDegenNFT(sdk, decoded[1]);
|
|
63
64
|
for (const t of data.tokens) {
|
|
64
65
|
this.tokensMeta.upsert(t.addr, t);
|
|
65
66
|
}
|
|
@@ -203,7 +204,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
203
204
|
return {
|
|
204
205
|
...super.stateHuman(_raw),
|
|
205
206
|
owner: this.labelAddress(this.owner),
|
|
206
|
-
degenNFT: this.labelAddress(this.degenNFT),
|
|
207
|
+
degenNFT: this.labelAddress(this.degenNFT.address),
|
|
207
208
|
dsTokens: this.dsTokens.map((t) => ({
|
|
208
209
|
...this.tokensMeta.mustGet(t.address),
|
|
209
210
|
registrar: this.labelAddress(t.registrar),
|