@gearbox-protocol/sdk 14.12.0-next.57 → 14.12.0-next.58
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/ILiquidationCompressorV313.js +43 -1
- package/dist/cjs/abi/IWithdrawalCompressorV313.js +71 -41
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +27 -43
- package/dist/cjs/sdk/accounts/liquidations/constants.js +1 -1
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +4 -2
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +12 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +10 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/addresses.js +1 -1
- package/dist/esm/abi/ILiquidationCompressorV313.js +43 -1
- package/dist/esm/abi/IWithdrawalCompressorV313.js +71 -41
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +29 -45
- package/dist/esm/sdk/accounts/liquidations/constants.js +1 -1
- package/dist/esm/sdk/accounts/liquidations/helpers.js +4 -2
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +12 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +10 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/addresses.js +1 -1
- package/dist/types/abi/ILiquidationCompressorV313.d.ts +36 -1
- package/dist/types/abi/IWithdrawalCompressorV313.d.ts +62 -38
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +8 -1
- package/dist/types/sdk/accounts/liquidations/types.d.ts +27 -5
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +3 -3
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +62 -38
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -47,7 +47,12 @@ const iLiquidationCompressorV313Abi = [
|
|
|
47
47
|
internalType: "struct LiquidationData",
|
|
48
48
|
components: [
|
|
49
49
|
{
|
|
50
|
-
name: "
|
|
50
|
+
name: "requiredToken",
|
|
51
|
+
type: "address",
|
|
52
|
+
internalType: "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "requiredAmount",
|
|
51
56
|
type: "uint256",
|
|
52
57
|
internalType: "uint256"
|
|
53
58
|
},
|
|
@@ -102,6 +107,11 @@ const iLiquidationCompressorV313Abi = [
|
|
|
102
107
|
type: "bool",
|
|
103
108
|
internalType: "bool"
|
|
104
109
|
},
|
|
110
|
+
{
|
|
111
|
+
name: "isCreditAccountFrozen",
|
|
112
|
+
type: "bool",
|
|
113
|
+
internalType: "bool"
|
|
114
|
+
},
|
|
105
115
|
{
|
|
106
116
|
name: "kycProtocol",
|
|
107
117
|
type: "string",
|
|
@@ -116,6 +126,38 @@ const iLiquidationCompressorV313Abi = [
|
|
|
116
126
|
}],
|
|
117
127
|
stateMutability: "nonpayable"
|
|
118
128
|
},
|
|
129
|
+
{
|
|
130
|
+
type: "function",
|
|
131
|
+
name: "getRWALiquidators",
|
|
132
|
+
inputs: [{
|
|
133
|
+
name: "marketConfigurator",
|
|
134
|
+
type: "address",
|
|
135
|
+
internalType: "address"
|
|
136
|
+
}],
|
|
137
|
+
outputs: [{
|
|
138
|
+
name: "",
|
|
139
|
+
type: "tuple[]",
|
|
140
|
+
internalType: "struct RWALiquidatorInfo[]",
|
|
141
|
+
components: [
|
|
142
|
+
{
|
|
143
|
+
name: "gateway",
|
|
144
|
+
type: "address",
|
|
145
|
+
internalType: "address"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "liquidatorAddress",
|
|
149
|
+
type: "address",
|
|
150
|
+
internalType: "address"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "contractType",
|
|
154
|
+
type: "bytes32",
|
|
155
|
+
internalType: "bytes32"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}],
|
|
159
|
+
stateMutability: "view"
|
|
160
|
+
},
|
|
119
161
|
{
|
|
120
162
|
type: "function",
|
|
121
163
|
name: "version",
|
|
@@ -76,6 +76,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
76
76
|
internalType: "bytes"
|
|
77
77
|
}]
|
|
78
78
|
},
|
|
79
|
+
{
|
|
80
|
+
name: "redeemer",
|
|
81
|
+
type: "address",
|
|
82
|
+
internalType: "address"
|
|
83
|
+
},
|
|
79
84
|
{
|
|
80
85
|
name: "extraData",
|
|
81
86
|
type: "bytes",
|
|
@@ -124,6 +129,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
124
129
|
type: "uint256",
|
|
125
130
|
internalType: "uint256"
|
|
126
131
|
},
|
|
132
|
+
{
|
|
133
|
+
name: "redeemer",
|
|
134
|
+
type: "address",
|
|
135
|
+
internalType: "address"
|
|
136
|
+
},
|
|
127
137
|
{
|
|
128
138
|
name: "extraData",
|
|
129
139
|
type: "bytes",
|
|
@@ -137,9 +147,9 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
137
147
|
type: "function",
|
|
138
148
|
name: "getExternalAccountCurrentWithdrawals",
|
|
139
149
|
inputs: [{
|
|
140
|
-
name: "
|
|
141
|
-
type: "address",
|
|
142
|
-
internalType: "address"
|
|
150
|
+
name: "withdrawalTokens",
|
|
151
|
+
type: "address[]",
|
|
152
|
+
internalType: "address[]"
|
|
143
153
|
}, {
|
|
144
154
|
name: "account",
|
|
145
155
|
type: "address",
|
|
@@ -201,6 +211,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
201
211
|
internalType: "bytes"
|
|
202
212
|
}]
|
|
203
213
|
},
|
|
214
|
+
{
|
|
215
|
+
name: "redeemer",
|
|
216
|
+
type: "address",
|
|
217
|
+
internalType: "address"
|
|
218
|
+
},
|
|
204
219
|
{
|
|
205
220
|
name: "extraData",
|
|
206
221
|
type: "bytes",
|
|
@@ -249,6 +264,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
249
264
|
type: "uint256",
|
|
250
265
|
internalType: "uint256"
|
|
251
266
|
},
|
|
267
|
+
{
|
|
268
|
+
name: "redeemer",
|
|
269
|
+
type: "address",
|
|
270
|
+
internalType: "address"
|
|
271
|
+
},
|
|
252
272
|
{
|
|
253
273
|
name: "extraData",
|
|
254
274
|
type: "bytes",
|
|
@@ -262,9 +282,9 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
262
282
|
type: "function",
|
|
263
283
|
name: "getExternalAccountCurrentWithdrawals",
|
|
264
284
|
inputs: [{
|
|
265
|
-
name: "
|
|
266
|
-
type: "address
|
|
267
|
-
internalType: "address
|
|
285
|
+
name: "withdrawalToken",
|
|
286
|
+
type: "address",
|
|
287
|
+
internalType: "address"
|
|
268
288
|
}, {
|
|
269
289
|
name: "account",
|
|
270
290
|
type: "address",
|
|
@@ -326,6 +346,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
326
346
|
internalType: "bytes"
|
|
327
347
|
}]
|
|
328
348
|
},
|
|
349
|
+
{
|
|
350
|
+
name: "redeemer",
|
|
351
|
+
type: "address",
|
|
352
|
+
internalType: "address"
|
|
353
|
+
},
|
|
329
354
|
{
|
|
330
355
|
name: "extraData",
|
|
331
356
|
type: "bytes",
|
|
@@ -374,6 +399,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
374
399
|
type: "uint256",
|
|
375
400
|
internalType: "uint256"
|
|
376
401
|
},
|
|
402
|
+
{
|
|
403
|
+
name: "redeemer",
|
|
404
|
+
type: "address",
|
|
405
|
+
internalType: "address"
|
|
406
|
+
},
|
|
377
407
|
{
|
|
378
408
|
name: "extraData",
|
|
379
409
|
type: "bytes",
|
|
@@ -383,36 +413,6 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
383
413
|
}],
|
|
384
414
|
stateMutability: "view"
|
|
385
415
|
},
|
|
386
|
-
{
|
|
387
|
-
type: "function",
|
|
388
|
-
name: "getWithdrawalStatus",
|
|
389
|
-
inputs: [{
|
|
390
|
-
name: "redeemer",
|
|
391
|
-
type: "address",
|
|
392
|
-
internalType: "address"
|
|
393
|
-
}],
|
|
394
|
-
outputs: [{
|
|
395
|
-
name: "",
|
|
396
|
-
type: "uint8",
|
|
397
|
-
internalType: "enum WithdrawalStatus"
|
|
398
|
-
}],
|
|
399
|
-
stateMutability: "view"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
type: "function",
|
|
403
|
-
name: "getWithdrawalStatus",
|
|
404
|
-
inputs: [{
|
|
405
|
-
name: "redeemers",
|
|
406
|
-
type: "address[]",
|
|
407
|
-
internalType: "address[]"
|
|
408
|
-
}],
|
|
409
|
-
outputs: [{
|
|
410
|
-
name: "",
|
|
411
|
-
type: "uint8[]",
|
|
412
|
-
internalType: "enum WithdrawalStatus[]"
|
|
413
|
-
}],
|
|
414
|
-
stateMutability: "view"
|
|
415
|
-
},
|
|
416
416
|
{
|
|
417
417
|
type: "function",
|
|
418
418
|
name: "getWithdrawableAssets",
|
|
@@ -559,11 +559,6 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
559
559
|
type: "address",
|
|
560
560
|
internalType: "address"
|
|
561
561
|
},
|
|
562
|
-
{
|
|
563
|
-
name: "withdrawalToken",
|
|
564
|
-
type: "address",
|
|
565
|
-
internalType: "address"
|
|
566
|
-
},
|
|
567
562
|
{
|
|
568
563
|
name: "amount",
|
|
569
564
|
type: "uint256",
|
|
@@ -644,6 +639,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
644
639
|
type: "address",
|
|
645
640
|
internalType: "address"
|
|
646
641
|
},
|
|
642
|
+
{
|
|
643
|
+
name: "withdrawalToken",
|
|
644
|
+
type: "address",
|
|
645
|
+
internalType: "address"
|
|
646
|
+
},
|
|
647
647
|
{
|
|
648
648
|
name: "amount",
|
|
649
649
|
type: "uint256",
|
|
@@ -710,6 +710,36 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
710
710
|
}],
|
|
711
711
|
stateMutability: "view"
|
|
712
712
|
},
|
|
713
|
+
{
|
|
714
|
+
type: "function",
|
|
715
|
+
name: "getWithdrawalStatus",
|
|
716
|
+
inputs: [{
|
|
717
|
+
name: "redeemers",
|
|
718
|
+
type: "address[]",
|
|
719
|
+
internalType: "address[]"
|
|
720
|
+
}],
|
|
721
|
+
outputs: [{
|
|
722
|
+
name: "",
|
|
723
|
+
type: "uint8[]",
|
|
724
|
+
internalType: "enum WithdrawalStatus[]"
|
|
725
|
+
}],
|
|
726
|
+
stateMutability: "view"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
type: "function",
|
|
730
|
+
name: "getWithdrawalStatus",
|
|
731
|
+
inputs: [{
|
|
732
|
+
name: "redeemer",
|
|
733
|
+
type: "address",
|
|
734
|
+
internalType: "address"
|
|
735
|
+
}],
|
|
736
|
+
outputs: [{
|
|
737
|
+
name: "",
|
|
738
|
+
type: "uint8",
|
|
739
|
+
internalType: "enum WithdrawalStatus"
|
|
740
|
+
}],
|
|
741
|
+
stateMutability: "view"
|
|
742
|
+
},
|
|
713
743
|
{
|
|
714
744
|
type: "function",
|
|
715
745
|
name: "version",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_abi_ILiquidationCompressorV313 = require("../../../abi/ILiquidationCompressorV313.js");
|
|
3
|
-
const require_abi_iPhantomToken = require("../../../abi/iPhantomToken.js");
|
|
4
3
|
const require_sdk_utils_AddressSet = require("../../utils/AddressSet.js");
|
|
4
|
+
const require_sdk_utils_bytes32ToString = require("../../utils/bytes32ToString.js");
|
|
5
5
|
const require_sdk_constants_addresses = require("../../constants/addresses.js");
|
|
6
6
|
const require_sdk_constants_math = require("../../constants/math.js");
|
|
7
7
|
require("../../constants/index.js");
|
|
@@ -16,7 +16,6 @@ const require_sdk_market_rwa_securitize_constants = require("../../market/rwa/se
|
|
|
16
16
|
const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("../../market/rwa/securitize/SecuritizeLiquidatorContract.js");
|
|
17
17
|
require("../../market/rwa/securitize/index.js");
|
|
18
18
|
const require_sdk_accounts_liquidations_constants = require("./constants.js");
|
|
19
|
-
const require_abi_rwa_iRWAGateway = require("../../../abi/rwa/iRWAGateway.js");
|
|
20
19
|
const require_sdk_accounts_liquidations_helpers = require("./helpers.js");
|
|
21
20
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
22
21
|
/**
|
|
@@ -66,20 +65,21 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
|
|
|
66
65
|
return {
|
|
67
66
|
...account,
|
|
68
67
|
repaymentAmount: {
|
|
69
|
-
token: account.totalValue.token,
|
|
70
|
-
balance: data.
|
|
68
|
+
token: require_sdk_utils_hex.hexEq(data.requiredToken, "0x0000000000000000000000000000000000000000") ? account.totalValue.token : data.requiredToken,
|
|
69
|
+
balance: data.requiredAmount
|
|
71
70
|
},
|
|
72
71
|
isDelayed: data.expectedOutputs.some((o) => o.delayed),
|
|
73
72
|
receivedAssets: require_sdk_accounts_liquidations_helpers.toReceivedAssets(data.expectedOutputs),
|
|
74
73
|
isLiquidatorEligible: data.isLiquidatorEligible,
|
|
74
|
+
isCreditAccountFrozen: data.isCreditAccountFrozen,
|
|
75
75
|
kycProtocol: data.kycProtocol || void 0,
|
|
76
76
|
kycToken: require_sdk_utils_hex.hexEq(data.kycToken, "0x0000000000000000000000000000000000000000") ? void 0 : data.kycToken,
|
|
77
77
|
approve: require_sdk_accounts_liquidations_helpers.toLiquidationApproval({
|
|
78
78
|
target: data.liquidationCall.target,
|
|
79
79
|
creditFacade: suite.creditFacade.address,
|
|
80
80
|
creditManager: ca.creditManager,
|
|
81
|
-
token:
|
|
82
|
-
amount: data.
|
|
81
|
+
token: data.requiredToken,
|
|
82
|
+
amount: data.requiredAmount
|
|
83
83
|
})
|
|
84
84
|
};
|
|
85
85
|
}
|
|
@@ -107,56 +107,39 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
|
|
|
107
107
|
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
108
108
|
**/
|
|
109
109
|
async loadRWALiquidators() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
contracts: phantomTokens.map(({ addr }) => ({
|
|
119
|
-
address: addr,
|
|
120
|
-
abi: require_abi_iPhantomToken.iPhantomTokenAbi,
|
|
121
|
-
functionName: "getPhantomTokenInfo"
|
|
122
|
-
})),
|
|
123
|
-
allowFailure: false,
|
|
124
|
-
batchSize: 0
|
|
125
|
-
});
|
|
126
|
-
const gateways = phantomTokens.map(({ contractType }, i) => ({
|
|
127
|
-
gateway: ptResp[i][0],
|
|
128
|
-
contractType
|
|
129
|
-
}));
|
|
130
|
-
const gwResp = await this.client.multicall({
|
|
131
|
-
contracts: gateways.map(({ gateway }) => ({
|
|
132
|
-
address: gateway,
|
|
133
|
-
abi: require_abi_rwa_iRWAGateway.iRWAGatewayAbi,
|
|
134
|
-
functionName: "transferMaster"
|
|
110
|
+
const configurators = this.sdk.marketRegister.marketConfigurators;
|
|
111
|
+
if (configurators.length === 0) return;
|
|
112
|
+
const resp = await this.client.multicall({
|
|
113
|
+
contracts: configurators.map((mc) => ({
|
|
114
|
+
address: require_sdk_accounts_liquidations_constants.LIQUIDATION_COMPRESSOR_V313_ADDRESS,
|
|
115
|
+
abi: require_abi_ILiquidationCompressorV313.iLiquidationCompressorV313Abi,
|
|
116
|
+
functionName: "getRWALiquidators",
|
|
117
|
+
args: [mc.address]
|
|
135
118
|
})),
|
|
136
119
|
allowFailure: false,
|
|
137
120
|
batchSize: 0
|
|
138
121
|
});
|
|
139
|
-
const
|
|
140
|
-
liquidator: gwResp[i],
|
|
141
|
-
contractType
|
|
142
|
-
}));
|
|
143
|
-
for (const ref of refs) this.#createRWALiquidator(ref);
|
|
122
|
+
for (const info of resp.flat()) this.#createRWALiquidator(info);
|
|
144
123
|
}
|
|
145
124
|
/**
|
|
146
125
|
* Instantiates the liquidator contract, which registers it and labels its
|
|
147
126
|
* address (see `BaseContract`).
|
|
148
127
|
*
|
|
149
|
-
* @param
|
|
128
|
+
* @param info - Liquidator discovered by the compressor. The same gateway
|
|
129
|
+
* can be configured in several credit managers, so duplicates are expected
|
|
130
|
+
* and skipped.
|
|
150
131
|
**/
|
|
151
|
-
#createRWALiquidator(
|
|
152
|
-
const
|
|
132
|
+
#createRWALiquidator(info) {
|
|
133
|
+
const liquidator = info.liquidatorAddress;
|
|
153
134
|
if (this.sdk.getContract(liquidator)) return;
|
|
154
|
-
switch (contractType) {
|
|
155
|
-
case require_sdk_market_rwa_securitize_constants.
|
|
135
|
+
switch (require_sdk_utils_bytes32ToString.bytes32ToString(info.contractType)) {
|
|
136
|
+
case require_sdk_market_rwa_securitize_constants.RWA_LIQUIDATOR_SECURITIZE:
|
|
156
137
|
new require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract(this.sdk, liquidator);
|
|
138
|
+
this.logger?.debug(`registered Securitize liquidator ${liquidator}`);
|
|
157
139
|
return;
|
|
158
|
-
case require_sdk_market_rwa_midas_constants.
|
|
140
|
+
case require_sdk_market_rwa_midas_constants.RWA_LIQUIDATOR_MIDAS:
|
|
159
141
|
new require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract(this.sdk, liquidator);
|
|
142
|
+
this.logger?.debug(`registered Midas liquidator ${liquidator}`);
|
|
160
143
|
return;
|
|
161
144
|
}
|
|
162
145
|
}
|
|
@@ -251,7 +234,8 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
|
|
|
251
234
|
token: unwrappedUnderlying,
|
|
252
235
|
balance: require_sdk_accounts_liquidations_helpers.calcEstimatedProfit(ca.totalValue, liquidationDiscount)
|
|
253
236
|
},
|
|
254
|
-
isDelayed: ca.tokens.some((t) => t.balance > 10n && !!compressor?.getWithdrawalSourceToken(t.token))
|
|
237
|
+
isDelayed: ca.tokens.some((t) => t.balance > 10n && !!compressor?.getWithdrawalSourceToken(t.token)),
|
|
238
|
+
paused: suite.creditFacade.isPaused
|
|
255
239
|
};
|
|
256
240
|
}
|
|
257
241
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/sdk/accounts/liquidations/constants.ts
|
|
3
|
-
const LIQUIDATION_COMPRESSOR_V313_ADDRESS = "
|
|
3
|
+
const LIQUIDATION_COMPRESSOR_V313_ADDRESS = "0xB70C4500a0afF02107eB983a348F22492fB6dC94";
|
|
4
4
|
//#endregion
|
|
5
5
|
exports.LIQUIDATION_COMPRESSOR_V313_ADDRESS = LIQUIDATION_COMPRESSOR_V313_ADDRESS;
|
|
@@ -76,14 +76,16 @@ function toLiquidatorWithdrawals(current, network) {
|
|
|
76
76
|
network,
|
|
77
77
|
sourceToken: w.token,
|
|
78
78
|
token: o.token,
|
|
79
|
-
amount: o.amount
|
|
79
|
+
amount: o.amount,
|
|
80
|
+
redeemer: w.redeemer
|
|
80
81
|
});
|
|
81
82
|
for (const w of current.pending) for (const o of w.expectedOutputs) rows.push({
|
|
82
83
|
network,
|
|
83
84
|
sourceToken: w.token,
|
|
84
85
|
token: o.token,
|
|
85
86
|
amount: o.amount,
|
|
86
|
-
claimableAt: w.claimableAt
|
|
87
|
+
claimableAt: w.claimableAt,
|
|
88
|
+
redeemer: w.redeemer
|
|
87
89
|
});
|
|
88
90
|
return rows;
|
|
89
91
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_utils_AddressMap = require("../../utils/AddressMap.js");
|
|
3
|
+
require("../../constants/addresses.js");
|
|
4
|
+
require("../../constants/index.js");
|
|
5
|
+
const require_sdk_utils_hex = require("../../utils/hex.js");
|
|
3
6
|
require("../../utils/index.js");
|
|
4
7
|
const require_sdk_base_BaseContract = require("../../base/BaseContract.js");
|
|
5
8
|
require("../../base/index.js");
|
|
@@ -201,6 +204,13 @@ function toRequestableWithdrawal(resp) {
|
|
|
201
204
|
};
|
|
202
205
|
}
|
|
203
206
|
/**
|
|
207
|
+
* Normalizes the redeemer of a withdrawal: legacy compressors do not report
|
|
208
|
+
* one, and v313+ uses the zero address for "not applicable".
|
|
209
|
+
**/
|
|
210
|
+
function toRedeemer(redeemer) {
|
|
211
|
+
return !redeemer || require_sdk_utils_hex.hexEq(redeemer, "0x0000000000000000000000000000000000000000") ? void 0 : redeemer;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
204
214
|
* Normalizes a claimable withdrawal. The intent is decoded from `extraData`
|
|
205
215
|
* only when `creditManager` is provided (it is required to build
|
|
206
216
|
* {@link DelayedIntentExtended} and is only meaningful for credit account
|
|
@@ -218,6 +228,7 @@ function toClaimableWithdrawal(w, creditManager) {
|
|
|
218
228
|
withdrawalTokenSpent: w.withdrawalTokenSpent,
|
|
219
229
|
outputs: [...w.outputs],
|
|
220
230
|
claimCalls: [...w.claimCalls],
|
|
231
|
+
redeemer: toRedeemer(w.redeemer),
|
|
221
232
|
intent
|
|
222
233
|
};
|
|
223
234
|
}
|
|
@@ -236,6 +247,7 @@ function toPendingWithdrawal(w, creditManager) {
|
|
|
236
247
|
withdrawalPhantomToken: w.withdrawalPhantomToken,
|
|
237
248
|
expectedOutputs: [...w.expectedOutputs],
|
|
238
249
|
claimableAt: w.claimableAt,
|
|
250
|
+
redeemer: toRedeemer(w.redeemer),
|
|
239
251
|
intent
|
|
240
252
|
};
|
|
241
253
|
}
|
|
@@ -79,6 +79,11 @@ const iExternalWithdrawalsBatchAbi = [{
|
|
|
79
79
|
internalType: "bytes"
|
|
80
80
|
}]
|
|
81
81
|
},
|
|
82
|
+
{
|
|
83
|
+
name: "redeemer",
|
|
84
|
+
type: "address",
|
|
85
|
+
internalType: "address"
|
|
86
|
+
},
|
|
82
87
|
{
|
|
83
88
|
name: "extraData",
|
|
84
89
|
type: "bytes",
|
|
@@ -127,6 +132,11 @@ const iExternalWithdrawalsBatchAbi = [{
|
|
|
127
132
|
type: "uint256",
|
|
128
133
|
internalType: "uint256"
|
|
129
134
|
},
|
|
135
|
+
{
|
|
136
|
+
name: "redeemer",
|
|
137
|
+
type: "address",
|
|
138
|
+
internalType: "address"
|
|
139
|
+
},
|
|
130
140
|
{
|
|
131
141
|
name: "extraData",
|
|
132
142
|
type: "bytes",
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
//#region src/sdk/accounts/withdrawal-compressor/addresses.ts
|
|
3
3
|
const WITHDRAWAL_COMPRESSORS = {
|
|
4
4
|
Mainnet: {
|
|
5
|
-
address: "
|
|
5
|
+
address: "0x6FA0c5404C31D0161bb39Cc1311aac998A38ecD5",
|
|
6
6
|
version: 313
|
|
7
7
|
},
|
|
8
8
|
Monad: {
|
|
@@ -46,7 +46,12 @@ const iLiquidationCompressorV313Abi = [
|
|
|
46
46
|
internalType: "struct LiquidationData",
|
|
47
47
|
components: [
|
|
48
48
|
{
|
|
49
|
-
name: "
|
|
49
|
+
name: "requiredToken",
|
|
50
|
+
type: "address",
|
|
51
|
+
internalType: "address"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "requiredAmount",
|
|
50
55
|
type: "uint256",
|
|
51
56
|
internalType: "uint256"
|
|
52
57
|
},
|
|
@@ -101,6 +106,11 @@ const iLiquidationCompressorV313Abi = [
|
|
|
101
106
|
type: "bool",
|
|
102
107
|
internalType: "bool"
|
|
103
108
|
},
|
|
109
|
+
{
|
|
110
|
+
name: "isCreditAccountFrozen",
|
|
111
|
+
type: "bool",
|
|
112
|
+
internalType: "bool"
|
|
113
|
+
},
|
|
104
114
|
{
|
|
105
115
|
name: "kycProtocol",
|
|
106
116
|
type: "string",
|
|
@@ -115,6 +125,38 @@ const iLiquidationCompressorV313Abi = [
|
|
|
115
125
|
}],
|
|
116
126
|
stateMutability: "nonpayable"
|
|
117
127
|
},
|
|
128
|
+
{
|
|
129
|
+
type: "function",
|
|
130
|
+
name: "getRWALiquidators",
|
|
131
|
+
inputs: [{
|
|
132
|
+
name: "marketConfigurator",
|
|
133
|
+
type: "address",
|
|
134
|
+
internalType: "address"
|
|
135
|
+
}],
|
|
136
|
+
outputs: [{
|
|
137
|
+
name: "",
|
|
138
|
+
type: "tuple[]",
|
|
139
|
+
internalType: "struct RWALiquidatorInfo[]",
|
|
140
|
+
components: [
|
|
141
|
+
{
|
|
142
|
+
name: "gateway",
|
|
143
|
+
type: "address",
|
|
144
|
+
internalType: "address"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "liquidatorAddress",
|
|
148
|
+
type: "address",
|
|
149
|
+
internalType: "address"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "contractType",
|
|
153
|
+
type: "bytes32",
|
|
154
|
+
internalType: "bytes32"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}],
|
|
158
|
+
stateMutability: "view"
|
|
159
|
+
},
|
|
118
160
|
{
|
|
119
161
|
type: "function",
|
|
120
162
|
name: "version",
|