@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
|
@@ -75,6 +75,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
75
75
|
internalType: "bytes"
|
|
76
76
|
}]
|
|
77
77
|
},
|
|
78
|
+
{
|
|
79
|
+
name: "redeemer",
|
|
80
|
+
type: "address",
|
|
81
|
+
internalType: "address"
|
|
82
|
+
},
|
|
78
83
|
{
|
|
79
84
|
name: "extraData",
|
|
80
85
|
type: "bytes",
|
|
@@ -123,6 +128,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
123
128
|
type: "uint256",
|
|
124
129
|
internalType: "uint256"
|
|
125
130
|
},
|
|
131
|
+
{
|
|
132
|
+
name: "redeemer",
|
|
133
|
+
type: "address",
|
|
134
|
+
internalType: "address"
|
|
135
|
+
},
|
|
126
136
|
{
|
|
127
137
|
name: "extraData",
|
|
128
138
|
type: "bytes",
|
|
@@ -136,9 +146,9 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
136
146
|
type: "function",
|
|
137
147
|
name: "getExternalAccountCurrentWithdrawals",
|
|
138
148
|
inputs: [{
|
|
139
|
-
name: "
|
|
140
|
-
type: "address",
|
|
141
|
-
internalType: "address"
|
|
149
|
+
name: "withdrawalTokens",
|
|
150
|
+
type: "address[]",
|
|
151
|
+
internalType: "address[]"
|
|
142
152
|
}, {
|
|
143
153
|
name: "account",
|
|
144
154
|
type: "address",
|
|
@@ -200,6 +210,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
200
210
|
internalType: "bytes"
|
|
201
211
|
}]
|
|
202
212
|
},
|
|
213
|
+
{
|
|
214
|
+
name: "redeemer",
|
|
215
|
+
type: "address",
|
|
216
|
+
internalType: "address"
|
|
217
|
+
},
|
|
203
218
|
{
|
|
204
219
|
name: "extraData",
|
|
205
220
|
type: "bytes",
|
|
@@ -248,6 +263,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
248
263
|
type: "uint256",
|
|
249
264
|
internalType: "uint256"
|
|
250
265
|
},
|
|
266
|
+
{
|
|
267
|
+
name: "redeemer",
|
|
268
|
+
type: "address",
|
|
269
|
+
internalType: "address"
|
|
270
|
+
},
|
|
251
271
|
{
|
|
252
272
|
name: "extraData",
|
|
253
273
|
type: "bytes",
|
|
@@ -261,9 +281,9 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
261
281
|
type: "function",
|
|
262
282
|
name: "getExternalAccountCurrentWithdrawals",
|
|
263
283
|
inputs: [{
|
|
264
|
-
name: "
|
|
265
|
-
type: "address
|
|
266
|
-
internalType: "address
|
|
284
|
+
name: "withdrawalToken",
|
|
285
|
+
type: "address",
|
|
286
|
+
internalType: "address"
|
|
267
287
|
}, {
|
|
268
288
|
name: "account",
|
|
269
289
|
type: "address",
|
|
@@ -325,6 +345,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
325
345
|
internalType: "bytes"
|
|
326
346
|
}]
|
|
327
347
|
},
|
|
348
|
+
{
|
|
349
|
+
name: "redeemer",
|
|
350
|
+
type: "address",
|
|
351
|
+
internalType: "address"
|
|
352
|
+
},
|
|
328
353
|
{
|
|
329
354
|
name: "extraData",
|
|
330
355
|
type: "bytes",
|
|
@@ -373,6 +398,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
373
398
|
type: "uint256",
|
|
374
399
|
internalType: "uint256"
|
|
375
400
|
},
|
|
401
|
+
{
|
|
402
|
+
name: "redeemer",
|
|
403
|
+
type: "address",
|
|
404
|
+
internalType: "address"
|
|
405
|
+
},
|
|
376
406
|
{
|
|
377
407
|
name: "extraData",
|
|
378
408
|
type: "bytes",
|
|
@@ -382,36 +412,6 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
382
412
|
}],
|
|
383
413
|
stateMutability: "view"
|
|
384
414
|
},
|
|
385
|
-
{
|
|
386
|
-
type: "function",
|
|
387
|
-
name: "getWithdrawalStatus",
|
|
388
|
-
inputs: [{
|
|
389
|
-
name: "redeemer",
|
|
390
|
-
type: "address",
|
|
391
|
-
internalType: "address"
|
|
392
|
-
}],
|
|
393
|
-
outputs: [{
|
|
394
|
-
name: "",
|
|
395
|
-
type: "uint8",
|
|
396
|
-
internalType: "enum WithdrawalStatus"
|
|
397
|
-
}],
|
|
398
|
-
stateMutability: "view"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
type: "function",
|
|
402
|
-
name: "getWithdrawalStatus",
|
|
403
|
-
inputs: [{
|
|
404
|
-
name: "redeemers",
|
|
405
|
-
type: "address[]",
|
|
406
|
-
internalType: "address[]"
|
|
407
|
-
}],
|
|
408
|
-
outputs: [{
|
|
409
|
-
name: "",
|
|
410
|
-
type: "uint8[]",
|
|
411
|
-
internalType: "enum WithdrawalStatus[]"
|
|
412
|
-
}],
|
|
413
|
-
stateMutability: "view"
|
|
414
|
-
},
|
|
415
415
|
{
|
|
416
416
|
type: "function",
|
|
417
417
|
name: "getWithdrawableAssets",
|
|
@@ -558,11 +558,6 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
558
558
|
type: "address",
|
|
559
559
|
internalType: "address"
|
|
560
560
|
},
|
|
561
|
-
{
|
|
562
|
-
name: "withdrawalToken",
|
|
563
|
-
type: "address",
|
|
564
|
-
internalType: "address"
|
|
565
|
-
},
|
|
566
561
|
{
|
|
567
562
|
name: "amount",
|
|
568
563
|
type: "uint256",
|
|
@@ -643,6 +638,11 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
643
638
|
type: "address",
|
|
644
639
|
internalType: "address"
|
|
645
640
|
},
|
|
641
|
+
{
|
|
642
|
+
name: "withdrawalToken",
|
|
643
|
+
type: "address",
|
|
644
|
+
internalType: "address"
|
|
645
|
+
},
|
|
646
646
|
{
|
|
647
647
|
name: "amount",
|
|
648
648
|
type: "uint256",
|
|
@@ -709,6 +709,36 @@ const iWithdrawalCompressorV313Abi = [
|
|
|
709
709
|
}],
|
|
710
710
|
stateMutability: "view"
|
|
711
711
|
},
|
|
712
|
+
{
|
|
713
|
+
type: "function",
|
|
714
|
+
name: "getWithdrawalStatus",
|
|
715
|
+
inputs: [{
|
|
716
|
+
name: "redeemers",
|
|
717
|
+
type: "address[]",
|
|
718
|
+
internalType: "address[]"
|
|
719
|
+
}],
|
|
720
|
+
outputs: [{
|
|
721
|
+
name: "",
|
|
722
|
+
type: "uint8[]",
|
|
723
|
+
internalType: "enum WithdrawalStatus[]"
|
|
724
|
+
}],
|
|
725
|
+
stateMutability: "view"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
type: "function",
|
|
729
|
+
name: "getWithdrawalStatus",
|
|
730
|
+
inputs: [{
|
|
731
|
+
name: "redeemer",
|
|
732
|
+
type: "address",
|
|
733
|
+
internalType: "address"
|
|
734
|
+
}],
|
|
735
|
+
outputs: [{
|
|
736
|
+
name: "",
|
|
737
|
+
type: "uint8",
|
|
738
|
+
internalType: "enum WithdrawalStatus"
|
|
739
|
+
}],
|
|
740
|
+
stateMutability: "view"
|
|
741
|
+
},
|
|
712
742
|
{
|
|
713
743
|
type: "function",
|
|
714
744
|
name: "version",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
2
|
-
import { iPhantomTokenAbi } from "../../../abi/iPhantomToken.js";
|
|
3
2
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
3
|
+
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
4
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
5
5
|
import { WAD } from "../../constants/math.js";
|
|
6
6
|
import "../../constants/index.js";
|
|
@@ -8,14 +8,13 @@ import { hexEq } from "../../utils/hex.js";
|
|
|
8
8
|
import "../../utils/index.js";
|
|
9
9
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
10
10
|
import "../../base/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { RWA_LIQUIDATOR_MIDAS } from "../../market/rwa/midas/constants.js";
|
|
12
12
|
import { MidasLiquidatorContract } from "../../market/rwa/midas/MidasLiquidatorContract.js";
|
|
13
13
|
import "../../market/rwa/midas/index.js";
|
|
14
|
-
import {
|
|
14
|
+
import { RWA_LIQUIDATOR_SECURITIZE } from "../../market/rwa/securitize/constants.js";
|
|
15
15
|
import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/SecuritizeLiquidatorContract.js";
|
|
16
16
|
import "../../market/rwa/securitize/index.js";
|
|
17
17
|
import { LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
18
|
-
import { iRWAGatewayAbi } from "../../../abi/rwa/iRWAGateway.js";
|
|
19
18
|
import { calcEstimatedProfit, calcRepaymentAmount, liquidationCallToRawTx, pickMainAsset, toLiquidationApproval, toLiquidatorWithdrawals, toReceivedAssets } from "./helpers.js";
|
|
20
19
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
21
20
|
/**
|
|
@@ -65,20 +64,21 @@ var LiquidationsService = class extends SDKConstruct {
|
|
|
65
64
|
return {
|
|
66
65
|
...account,
|
|
67
66
|
repaymentAmount: {
|
|
68
|
-
token: account.totalValue.token,
|
|
69
|
-
balance: data.
|
|
67
|
+
token: hexEq(data.requiredToken, "0x0000000000000000000000000000000000000000") ? account.totalValue.token : data.requiredToken,
|
|
68
|
+
balance: data.requiredAmount
|
|
70
69
|
},
|
|
71
70
|
isDelayed: data.expectedOutputs.some((o) => o.delayed),
|
|
72
71
|
receivedAssets: toReceivedAssets(data.expectedOutputs),
|
|
73
72
|
isLiquidatorEligible: data.isLiquidatorEligible,
|
|
73
|
+
isCreditAccountFrozen: data.isCreditAccountFrozen,
|
|
74
74
|
kycProtocol: data.kycProtocol || void 0,
|
|
75
75
|
kycToken: hexEq(data.kycToken, "0x0000000000000000000000000000000000000000") ? void 0 : data.kycToken,
|
|
76
76
|
approve: toLiquidationApproval({
|
|
77
77
|
target: data.liquidationCall.target,
|
|
78
78
|
creditFacade: suite.creditFacade.address,
|
|
79
79
|
creditManager: ca.creditManager,
|
|
80
|
-
token:
|
|
81
|
-
amount: data.
|
|
80
|
+
token: data.requiredToken,
|
|
81
|
+
amount: data.requiredAmount
|
|
82
82
|
})
|
|
83
83
|
};
|
|
84
84
|
}
|
|
@@ -106,56 +106,39 @@ var LiquidationsService = class extends SDKConstruct {
|
|
|
106
106
|
* {@inheritDoc ILiquidationsService.loadRWALiquidators}
|
|
107
107
|
**/
|
|
108
108
|
async loadRWALiquidators() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
contracts: phantomTokens.map(({ addr }) => ({
|
|
118
|
-
address: addr,
|
|
119
|
-
abi: iPhantomTokenAbi,
|
|
120
|
-
functionName: "getPhantomTokenInfo"
|
|
121
|
-
})),
|
|
122
|
-
allowFailure: false,
|
|
123
|
-
batchSize: 0
|
|
124
|
-
});
|
|
125
|
-
const gateways = phantomTokens.map(({ contractType }, i) => ({
|
|
126
|
-
gateway: ptResp[i][0],
|
|
127
|
-
contractType
|
|
128
|
-
}));
|
|
129
|
-
const gwResp = await this.client.multicall({
|
|
130
|
-
contracts: gateways.map(({ gateway }) => ({
|
|
131
|
-
address: gateway,
|
|
132
|
-
abi: iRWAGatewayAbi,
|
|
133
|
-
functionName: "transferMaster"
|
|
109
|
+
const configurators = this.sdk.marketRegister.marketConfigurators;
|
|
110
|
+
if (configurators.length === 0) return;
|
|
111
|
+
const resp = await this.client.multicall({
|
|
112
|
+
contracts: configurators.map((mc) => ({
|
|
113
|
+
address: LIQUIDATION_COMPRESSOR_V313_ADDRESS,
|
|
114
|
+
abi: iLiquidationCompressorV313Abi,
|
|
115
|
+
functionName: "getRWALiquidators",
|
|
116
|
+
args: [mc.address]
|
|
134
117
|
})),
|
|
135
118
|
allowFailure: false,
|
|
136
119
|
batchSize: 0
|
|
137
120
|
});
|
|
138
|
-
const
|
|
139
|
-
liquidator: gwResp[i],
|
|
140
|
-
contractType
|
|
141
|
-
}));
|
|
142
|
-
for (const ref of refs) this.#createRWALiquidator(ref);
|
|
121
|
+
for (const info of resp.flat()) this.#createRWALiquidator(info);
|
|
143
122
|
}
|
|
144
123
|
/**
|
|
145
124
|
* Instantiates the liquidator contract, which registers it and labels its
|
|
146
125
|
* address (see `BaseContract`).
|
|
147
126
|
*
|
|
148
|
-
* @param
|
|
127
|
+
* @param info - Liquidator discovered by the compressor. The same gateway
|
|
128
|
+
* can be configured in several credit managers, so duplicates are expected
|
|
129
|
+
* and skipped.
|
|
149
130
|
**/
|
|
150
|
-
#createRWALiquidator(
|
|
151
|
-
const
|
|
131
|
+
#createRWALiquidator(info) {
|
|
132
|
+
const liquidator = info.liquidatorAddress;
|
|
152
133
|
if (this.sdk.getContract(liquidator)) return;
|
|
153
|
-
switch (contractType) {
|
|
154
|
-
case
|
|
134
|
+
switch (bytes32ToString(info.contractType)) {
|
|
135
|
+
case RWA_LIQUIDATOR_SECURITIZE:
|
|
155
136
|
new SecuritizeLiquidatorContract(this.sdk, liquidator);
|
|
137
|
+
this.logger?.debug(`registered Securitize liquidator ${liquidator}`);
|
|
156
138
|
return;
|
|
157
|
-
case
|
|
139
|
+
case RWA_LIQUIDATOR_MIDAS:
|
|
158
140
|
new MidasLiquidatorContract(this.sdk, liquidator);
|
|
141
|
+
this.logger?.debug(`registered Midas liquidator ${liquidator}`);
|
|
159
142
|
return;
|
|
160
143
|
}
|
|
161
144
|
}
|
|
@@ -250,7 +233,8 @@ var LiquidationsService = class extends SDKConstruct {
|
|
|
250
233
|
token: unwrappedUnderlying,
|
|
251
234
|
balance: calcEstimatedProfit(ca.totalValue, liquidationDiscount)
|
|
252
235
|
},
|
|
253
|
-
isDelayed: ca.tokens.some((t) => t.balance > 10n && !!compressor?.getWithdrawalSourceToken(t.token))
|
|
236
|
+
isDelayed: ca.tokens.some((t) => t.balance > 10n && !!compressor?.getWithdrawalSourceToken(t.token)),
|
|
237
|
+
paused: suite.creditFacade.isPaused
|
|
254
238
|
};
|
|
255
239
|
}
|
|
256
240
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/sdk/accounts/liquidations/constants.ts
|
|
2
|
-
const LIQUIDATION_COMPRESSOR_V313_ADDRESS = "
|
|
2
|
+
const LIQUIDATION_COMPRESSOR_V313_ADDRESS = "0xB70C4500a0afF02107eB983a348F22492fB6dC94";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { LIQUIDATION_COMPRESSOR_V313_ADDRESS };
|
|
@@ -75,14 +75,16 @@ function toLiquidatorWithdrawals(current, network) {
|
|
|
75
75
|
network,
|
|
76
76
|
sourceToken: w.token,
|
|
77
77
|
token: o.token,
|
|
78
|
-
amount: o.amount
|
|
78
|
+
amount: o.amount,
|
|
79
|
+
redeemer: w.redeemer
|
|
79
80
|
});
|
|
80
81
|
for (const w of current.pending) for (const o of w.expectedOutputs) rows.push({
|
|
81
82
|
network,
|
|
82
83
|
sourceToken: w.token,
|
|
83
84
|
token: o.token,
|
|
84
85
|
amount: o.amount,
|
|
85
|
-
claimableAt: w.claimableAt
|
|
86
|
+
claimableAt: w.claimableAt,
|
|
87
|
+
redeemer: w.redeemer
|
|
86
88
|
});
|
|
87
89
|
return rows;
|
|
88
90
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
|
+
import "../../constants/addresses.js";
|
|
3
|
+
import "../../constants/index.js";
|
|
4
|
+
import { hexEq } from "../../utils/hex.js";
|
|
2
5
|
import "../../utils/index.js";
|
|
3
6
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
7
|
import "../../base/index.js";
|
|
@@ -200,6 +203,13 @@ function toRequestableWithdrawal(resp) {
|
|
|
200
203
|
};
|
|
201
204
|
}
|
|
202
205
|
/**
|
|
206
|
+
* Normalizes the redeemer of a withdrawal: legacy compressors do not report
|
|
207
|
+
* one, and v313+ uses the zero address for "not applicable".
|
|
208
|
+
**/
|
|
209
|
+
function toRedeemer(redeemer) {
|
|
210
|
+
return !redeemer || hexEq(redeemer, "0x0000000000000000000000000000000000000000") ? void 0 : redeemer;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
203
213
|
* Normalizes a claimable withdrawal. The intent is decoded from `extraData`
|
|
204
214
|
* only when `creditManager` is provided (it is required to build
|
|
205
215
|
* {@link DelayedIntentExtended} and is only meaningful for credit account
|
|
@@ -217,6 +227,7 @@ function toClaimableWithdrawal(w, creditManager) {
|
|
|
217
227
|
withdrawalTokenSpent: w.withdrawalTokenSpent,
|
|
218
228
|
outputs: [...w.outputs],
|
|
219
229
|
claimCalls: [...w.claimCalls],
|
|
230
|
+
redeemer: toRedeemer(w.redeemer),
|
|
220
231
|
intent
|
|
221
232
|
};
|
|
222
233
|
}
|
|
@@ -235,6 +246,7 @@ function toPendingWithdrawal(w, creditManager) {
|
|
|
235
246
|
withdrawalPhantomToken: w.withdrawalPhantomToken,
|
|
236
247
|
expectedOutputs: [...w.expectedOutputs],
|
|
237
248
|
claimableAt: w.claimableAt,
|
|
249
|
+
redeemer: toRedeemer(w.redeemer),
|
|
238
250
|
intent
|
|
239
251
|
};
|
|
240
252
|
}
|
|
@@ -78,6 +78,11 @@ const iExternalWithdrawalsBatchAbi = [{
|
|
|
78
78
|
internalType: "bytes"
|
|
79
79
|
}]
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
name: "redeemer",
|
|
83
|
+
type: "address",
|
|
84
|
+
internalType: "address"
|
|
85
|
+
},
|
|
81
86
|
{
|
|
82
87
|
name: "extraData",
|
|
83
88
|
type: "bytes",
|
|
@@ -126,6 +131,11 @@ const iExternalWithdrawalsBatchAbi = [{
|
|
|
126
131
|
type: "uint256",
|
|
127
132
|
internalType: "uint256"
|
|
128
133
|
},
|
|
134
|
+
{
|
|
135
|
+
name: "redeemer",
|
|
136
|
+
type: "address",
|
|
137
|
+
internalType: "address"
|
|
138
|
+
},
|
|
129
139
|
{
|
|
130
140
|
name: "extraData",
|
|
131
141
|
type: "bytes",
|
|
@@ -39,7 +39,11 @@ declare const iLiquidationCompressorV313Abi: readonly [{
|
|
|
39
39
|
readonly type: "tuple";
|
|
40
40
|
readonly internalType: "struct LiquidationData";
|
|
41
41
|
readonly components: readonly [{
|
|
42
|
-
readonly name: "
|
|
42
|
+
readonly name: "requiredToken";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
readonly internalType: "address";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "requiredAmount";
|
|
43
47
|
readonly type: "uint256";
|
|
44
48
|
readonly internalType: "uint256";
|
|
45
49
|
}, {
|
|
@@ -84,6 +88,10 @@ declare const iLiquidationCompressorV313Abi: readonly [{
|
|
|
84
88
|
readonly name: "isLiquidatorEligible";
|
|
85
89
|
readonly type: "bool";
|
|
86
90
|
readonly internalType: "bool";
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "isCreditAccountFrozen";
|
|
93
|
+
readonly type: "bool";
|
|
94
|
+
readonly internalType: "bool";
|
|
87
95
|
}, {
|
|
88
96
|
readonly name: "kycProtocol";
|
|
89
97
|
readonly type: "string";
|
|
@@ -95,6 +103,33 @@ declare const iLiquidationCompressorV313Abi: readonly [{
|
|
|
95
103
|
}];
|
|
96
104
|
}];
|
|
97
105
|
readonly stateMutability: "nonpayable";
|
|
106
|
+
}, {
|
|
107
|
+
readonly type: "function";
|
|
108
|
+
readonly name: "getRWALiquidators";
|
|
109
|
+
readonly inputs: readonly [{
|
|
110
|
+
readonly name: "marketConfigurator";
|
|
111
|
+
readonly type: "address";
|
|
112
|
+
readonly internalType: "address";
|
|
113
|
+
}];
|
|
114
|
+
readonly outputs: readonly [{
|
|
115
|
+
readonly name: "";
|
|
116
|
+
readonly type: "tuple[]";
|
|
117
|
+
readonly internalType: "struct RWALiquidatorInfo[]";
|
|
118
|
+
readonly components: readonly [{
|
|
119
|
+
readonly name: "gateway";
|
|
120
|
+
readonly type: "address";
|
|
121
|
+
readonly internalType: "address";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "liquidatorAddress";
|
|
124
|
+
readonly type: "address";
|
|
125
|
+
readonly internalType: "address";
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: "contractType";
|
|
128
|
+
readonly type: "bytes32";
|
|
129
|
+
readonly internalType: "bytes32";
|
|
130
|
+
}];
|
|
131
|
+
}];
|
|
132
|
+
readonly stateMutability: "view";
|
|
98
133
|
}, {
|
|
99
134
|
readonly type: "function";
|
|
100
135
|
readonly name: "version";
|
|
@@ -63,6 +63,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
63
63
|
readonly type: "bytes";
|
|
64
64
|
readonly internalType: "bytes";
|
|
65
65
|
}];
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "redeemer";
|
|
68
|
+
readonly type: "address";
|
|
69
|
+
readonly internalType: "address";
|
|
66
70
|
}, {
|
|
67
71
|
readonly name: "extraData";
|
|
68
72
|
readonly type: "bytes";
|
|
@@ -101,6 +105,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
101
105
|
readonly name: "claimableAt";
|
|
102
106
|
readonly type: "uint256";
|
|
103
107
|
readonly internalType: "uint256";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "redeemer";
|
|
110
|
+
readonly type: "address";
|
|
111
|
+
readonly internalType: "address";
|
|
104
112
|
}, {
|
|
105
113
|
readonly name: "extraData";
|
|
106
114
|
readonly type: "bytes";
|
|
@@ -112,9 +120,9 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
112
120
|
readonly type: "function";
|
|
113
121
|
readonly name: "getExternalAccountCurrentWithdrawals";
|
|
114
122
|
readonly inputs: readonly [{
|
|
115
|
-
readonly name: "
|
|
116
|
-
readonly type: "address";
|
|
117
|
-
readonly internalType: "address";
|
|
123
|
+
readonly name: "withdrawalTokens";
|
|
124
|
+
readonly type: "address[]";
|
|
125
|
+
readonly internalType: "address[]";
|
|
118
126
|
}, {
|
|
119
127
|
readonly name: "account";
|
|
120
128
|
readonly type: "address";
|
|
@@ -166,6 +174,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
166
174
|
readonly type: "bytes";
|
|
167
175
|
readonly internalType: "bytes";
|
|
168
176
|
}];
|
|
177
|
+
}, {
|
|
178
|
+
readonly name: "redeemer";
|
|
179
|
+
readonly type: "address";
|
|
180
|
+
readonly internalType: "address";
|
|
169
181
|
}, {
|
|
170
182
|
readonly name: "extraData";
|
|
171
183
|
readonly type: "bytes";
|
|
@@ -204,6 +216,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
204
216
|
readonly name: "claimableAt";
|
|
205
217
|
readonly type: "uint256";
|
|
206
218
|
readonly internalType: "uint256";
|
|
219
|
+
}, {
|
|
220
|
+
readonly name: "redeemer";
|
|
221
|
+
readonly type: "address";
|
|
222
|
+
readonly internalType: "address";
|
|
207
223
|
}, {
|
|
208
224
|
readonly name: "extraData";
|
|
209
225
|
readonly type: "bytes";
|
|
@@ -215,9 +231,9 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
215
231
|
readonly type: "function";
|
|
216
232
|
readonly name: "getExternalAccountCurrentWithdrawals";
|
|
217
233
|
readonly inputs: readonly [{
|
|
218
|
-
readonly name: "
|
|
219
|
-
readonly type: "address
|
|
220
|
-
readonly internalType: "address
|
|
234
|
+
readonly name: "withdrawalToken";
|
|
235
|
+
readonly type: "address";
|
|
236
|
+
readonly internalType: "address";
|
|
221
237
|
}, {
|
|
222
238
|
readonly name: "account";
|
|
223
239
|
readonly type: "address";
|
|
@@ -269,6 +285,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
269
285
|
readonly type: "bytes";
|
|
270
286
|
readonly internalType: "bytes";
|
|
271
287
|
}];
|
|
288
|
+
}, {
|
|
289
|
+
readonly name: "redeemer";
|
|
290
|
+
readonly type: "address";
|
|
291
|
+
readonly internalType: "address";
|
|
272
292
|
}, {
|
|
273
293
|
readonly name: "extraData";
|
|
274
294
|
readonly type: "bytes";
|
|
@@ -307,6 +327,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
307
327
|
readonly name: "claimableAt";
|
|
308
328
|
readonly type: "uint256";
|
|
309
329
|
readonly internalType: "uint256";
|
|
330
|
+
}, {
|
|
331
|
+
readonly name: "redeemer";
|
|
332
|
+
readonly type: "address";
|
|
333
|
+
readonly internalType: "address";
|
|
310
334
|
}, {
|
|
311
335
|
readonly name: "extraData";
|
|
312
336
|
readonly type: "bytes";
|
|
@@ -314,34 +338,6 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
314
338
|
}];
|
|
315
339
|
}];
|
|
316
340
|
readonly stateMutability: "view";
|
|
317
|
-
}, {
|
|
318
|
-
readonly type: "function";
|
|
319
|
-
readonly name: "getWithdrawalStatus";
|
|
320
|
-
readonly inputs: readonly [{
|
|
321
|
-
readonly name: "redeemer";
|
|
322
|
-
readonly type: "address";
|
|
323
|
-
readonly internalType: "address";
|
|
324
|
-
}];
|
|
325
|
-
readonly outputs: readonly [{
|
|
326
|
-
readonly name: "";
|
|
327
|
-
readonly type: "uint8";
|
|
328
|
-
readonly internalType: "enum WithdrawalStatus";
|
|
329
|
-
}];
|
|
330
|
-
readonly stateMutability: "view";
|
|
331
|
-
}, {
|
|
332
|
-
readonly type: "function";
|
|
333
|
-
readonly name: "getWithdrawalStatus";
|
|
334
|
-
readonly inputs: readonly [{
|
|
335
|
-
readonly name: "redeemers";
|
|
336
|
-
readonly type: "address[]";
|
|
337
|
-
readonly internalType: "address[]";
|
|
338
|
-
}];
|
|
339
|
-
readonly outputs: readonly [{
|
|
340
|
-
readonly name: "";
|
|
341
|
-
readonly type: "uint8[]";
|
|
342
|
-
readonly internalType: "enum WithdrawalStatus[]";
|
|
343
|
-
}];
|
|
344
|
-
readonly stateMutability: "view";
|
|
345
341
|
}, {
|
|
346
342
|
readonly type: "function";
|
|
347
343
|
readonly name: "getWithdrawableAssets";
|
|
@@ -461,10 +457,6 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
461
457
|
readonly name: "token";
|
|
462
458
|
readonly type: "address";
|
|
463
459
|
readonly internalType: "address";
|
|
464
|
-
}, {
|
|
465
|
-
readonly name: "withdrawalToken";
|
|
466
|
-
readonly type: "address";
|
|
467
|
-
readonly internalType: "address";
|
|
468
460
|
}, {
|
|
469
461
|
readonly name: "amount";
|
|
470
462
|
readonly type: "uint256";
|
|
@@ -530,6 +522,10 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
530
522
|
readonly name: "token";
|
|
531
523
|
readonly type: "address";
|
|
532
524
|
readonly internalType: "address";
|
|
525
|
+
}, {
|
|
526
|
+
readonly name: "withdrawalToken";
|
|
527
|
+
readonly type: "address";
|
|
528
|
+
readonly internalType: "address";
|
|
533
529
|
}, {
|
|
534
530
|
readonly name: "amount";
|
|
535
531
|
readonly type: "uint256";
|
|
@@ -584,6 +580,34 @@ declare const iWithdrawalCompressorV313Abi: readonly [{
|
|
|
584
580
|
}];
|
|
585
581
|
}];
|
|
586
582
|
readonly stateMutability: "view";
|
|
583
|
+
}, {
|
|
584
|
+
readonly type: "function";
|
|
585
|
+
readonly name: "getWithdrawalStatus";
|
|
586
|
+
readonly inputs: readonly [{
|
|
587
|
+
readonly name: "redeemers";
|
|
588
|
+
readonly type: "address[]";
|
|
589
|
+
readonly internalType: "address[]";
|
|
590
|
+
}];
|
|
591
|
+
readonly outputs: readonly [{
|
|
592
|
+
readonly name: "";
|
|
593
|
+
readonly type: "uint8[]";
|
|
594
|
+
readonly internalType: "enum WithdrawalStatus[]";
|
|
595
|
+
}];
|
|
596
|
+
readonly stateMutability: "view";
|
|
597
|
+
}, {
|
|
598
|
+
readonly type: "function";
|
|
599
|
+
readonly name: "getWithdrawalStatus";
|
|
600
|
+
readonly inputs: readonly [{
|
|
601
|
+
readonly name: "redeemer";
|
|
602
|
+
readonly type: "address";
|
|
603
|
+
readonly internalType: "address";
|
|
604
|
+
}];
|
|
605
|
+
readonly outputs: readonly [{
|
|
606
|
+
readonly name: "";
|
|
607
|
+
readonly type: "uint8";
|
|
608
|
+
readonly internalType: "enum WithdrawalStatus";
|
|
609
|
+
}];
|
|
610
|
+
readonly stateMutability: "view";
|
|
587
611
|
}, {
|
|
588
612
|
readonly type: "function";
|
|
589
613
|
readonly name: "version";
|
|
@@ -22,6 +22,13 @@ type OnchainLiquidationOutput = OnchainLiquidationData["expectedOutputs"][number
|
|
|
22
22
|
* Single call built by the liquidation compressor.
|
|
23
23
|
**/
|
|
24
24
|
type OnchainLiquidationCall = OnchainLiquidationData["liquidationCall"];
|
|
25
|
+
/**
|
|
26
|
+
* A dedicated RWA liquidator contract (Midas / Securitize) discovered by
|
|
27
|
+
* `LiquidationCompressor.getRWALiquidators`. `contractType` is the bytes32
|
|
28
|
+
* contract type of the liquidator itself (e.g. `RWA_LIQUIDATOR::MIDAS`),
|
|
29
|
+
* not of the phantom token it was found through.
|
|
30
|
+
**/
|
|
31
|
+
type RWALiquidatorInfo = ContractFunctionReturnType<typeof iLiquidationCompressorV313Abi, "view", "getRWALiquidators">[number];
|
|
25
32
|
/**
|
|
26
33
|
* Token balances at or below this threshold are treated as dust and ignored,
|
|
27
34
|
* consistent with the rest of the SDK (see `filterDust`).
|
|
@@ -130,4 +137,4 @@ declare function toLiquidationApproval(props: ToLiquidationApprovalProps): Liqui
|
|
|
130
137
|
**/
|
|
131
138
|
declare function liquidationCallToRawTx(call: OnchainLiquidationCall, description?: string): RawTx;
|
|
132
139
|
//#endregion
|
|
133
|
-
export { DUST_THRESHOLD, LIQUIDATION_APPROVAL_BUFFER, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, ToLiquidationApprovalProps, calcEstimatedProfit, calcRepaymentAmount, liquidationCallToRawTx, pickMainAsset, toLiquidationApproval, toLiquidatorWithdrawals, toReceivedAssets };
|
|
140
|
+
export { DUST_THRESHOLD, LIQUIDATION_APPROVAL_BUFFER, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo, ToLiquidationApprovalProps, calcEstimatedProfit, calcRepaymentAmount, liquidationCallToRawTx, pickMainAsset, toLiquidationApproval, toLiquidatorWithdrawals, toReceivedAssets };
|