@gearbox-protocol/sdk 14.12.0-next.55 → 14.12.0-next.57

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.
Files changed (75) hide show
  1. package/dist/cjs/abi/compressors/liquidationCompressor.js +43 -1
  2. package/dist/cjs/abi/compressors/rwaCompressor.js +4 -4
  3. package/dist/cjs/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +43 -1
  4. package/dist/cjs/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +43 -1
  5. package/dist/cjs/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +20 -0
  6. package/dist/cjs/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +20 -0
  7. package/dist/cjs/abi/compressors/withdrawalCompressor.js +30 -0
  8. package/dist/cjs/abi/iPhantomToken.js +19 -0
  9. package/dist/cjs/abi/rwa/iRWAGateway.js +19 -0
  10. package/dist/cjs/plugins/adapters/abi/actionAbi.js +8 -2
  11. package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +8 -2
  12. package/dist/cjs/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +67 -36
  13. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +65 -0
  14. package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +10 -0
  15. package/dist/cjs/sdk/base/token-types.js +1 -0
  16. package/dist/cjs/sdk/index.js +6 -4
  17. package/dist/cjs/sdk/market/index.js +6 -4
  18. package/dist/cjs/sdk/market/rwa/index.js +6 -4
  19. package/dist/cjs/sdk/market/rwa/midas/{MidasLiquidator.js → MidasLiquidatorContract.js} +3 -3
  20. package/dist/cjs/sdk/market/rwa/midas/constants.js +2 -0
  21. package/dist/cjs/sdk/market/rwa/midas/index.js +3 -2
  22. package/dist/cjs/sdk/market/rwa/securitize/{SecuritizeLiquidator.js → SecuritizeLiquidatorContract.js} +3 -3
  23. package/dist/cjs/sdk/market/rwa/securitize/constants.js +2 -0
  24. package/dist/cjs/sdk/market/rwa/securitize/index.js +3 -2
  25. package/dist/esm/abi/compressors/liquidationCompressor.js +43 -1
  26. package/dist/esm/abi/compressors/rwaCompressor.js +4 -4
  27. package/dist/esm/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +43 -1
  28. package/dist/esm/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +43 -1
  29. package/dist/esm/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.js +20 -0
  30. package/dist/esm/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.js +20 -0
  31. package/dist/esm/abi/compressors/withdrawalCompressor.js +30 -0
  32. package/dist/esm/abi/iPhantomToken.js +18 -0
  33. package/dist/esm/abi/rwa/iRWAGateway.js +18 -0
  34. package/dist/esm/plugins/adapters/abi/actionAbi.js +8 -2
  35. package/dist/esm/plugins/adapters/abi/conctructorAbi.js +8 -2
  36. package/dist/esm/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.js +67 -36
  37. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +65 -0
  38. package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +10 -0
  39. package/dist/esm/sdk/base/token-types.js +1 -0
  40. package/dist/esm/sdk/index.js +5 -5
  41. package/dist/esm/sdk/market/index.js +5 -5
  42. package/dist/esm/sdk/market/rwa/index.js +5 -5
  43. package/dist/esm/sdk/market/rwa/midas/{MidasLiquidator.js → MidasLiquidatorContract.js} +3 -3
  44. package/dist/esm/sdk/market/rwa/midas/constants.js +2 -1
  45. package/dist/esm/sdk/market/rwa/midas/index.js +3 -3
  46. package/dist/esm/sdk/market/rwa/securitize/{SecuritizeLiquidator.js → SecuritizeLiquidatorContract.js} +3 -3
  47. package/dist/esm/sdk/market/rwa/securitize/constants.js +2 -1
  48. package/dist/esm/sdk/market/rwa/securitize/index.js +3 -3
  49. package/dist/types/abi/compressors/liquidationCompressor.d.ts +36 -1
  50. package/dist/types/abi/compressors/rwaCompressor.d.ts +4 -4
  51. package/dist/types/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.d.ts +36 -1
  52. package/dist/types/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.d.ts +36 -1
  53. package/dist/types/abi/compressors/subcompressors/withdrawal/midasWithdrawalSubcompressor.d.ts +16 -0
  54. package/dist/types/abi/compressors/subcompressors/withdrawal/securitizeRedemptionSubcompressor.d.ts +16 -0
  55. package/dist/types/abi/compressors/withdrawalCompressor.d.ts +24 -0
  56. package/dist/types/abi/iPhantomToken.d.ts +18 -0
  57. package/dist/types/abi/rwa/iRWAGateway.d.ts +18 -0
  58. package/dist/types/permissionless/bindings/compressors/withdrawal-compressor.d.ts +24 -0
  59. package/dist/types/plugins/adapters/contracts/MidasRedemptionVaultAdapterContract.d.ts +8 -5
  60. package/dist/types/sdk/accounts/index.d.ts +2 -2
  61. package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +4 -0
  62. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +5 -1
  63. package/dist/types/sdk/accounts/liquidations/index.d.ts +2 -2
  64. package/dist/types/sdk/accounts/liquidations/types.d.ts +13 -1
  65. package/dist/types/sdk/base/token-types.d.ts +1 -1
  66. package/dist/types/sdk/index.d.ts +6 -6
  67. package/dist/types/sdk/market/index.d.ts +5 -5
  68. package/dist/types/sdk/market/rwa/index.d.ts +5 -5
  69. package/dist/types/sdk/market/rwa/midas/{MidasLiquidator.d.ts → MidasLiquidatorContract.d.ts} +3 -3
  70. package/dist/types/sdk/market/rwa/midas/constants.d.ts +2 -1
  71. package/dist/types/sdk/market/rwa/midas/index.d.ts +3 -3
  72. package/dist/types/sdk/market/rwa/securitize/{SecuritizeLiquidator.d.ts → SecuritizeLiquidatorContract.d.ts} +3 -3
  73. package/dist/types/sdk/market/rwa/securitize/constants.d.ts +2 -1
  74. package/dist/types/sdk/market/rwa/securitize/index.d.ts +3 -3
  75. package/package.json +1 -1
@@ -90,7 +90,12 @@ const liquidationCompressorAbi = [
90
90
  internalType: "struct LiquidationData",
91
91
  components: [
92
92
  {
93
- name: "requiredUnderlyingAmount",
93
+ name: "requiredToken",
94
+ type: "address",
95
+ internalType: "address"
96
+ },
97
+ {
98
+ name: "requiredAmount",
94
99
  type: "uint256",
95
100
  internalType: "uint256"
96
101
  },
@@ -145,6 +150,11 @@ const liquidationCompressorAbi = [
145
150
  type: "bool",
146
151
  internalType: "bool"
147
152
  },
153
+ {
154
+ name: "isCreditAccountFrozen",
155
+ type: "bool",
156
+ internalType: "bool"
157
+ },
148
158
  {
149
159
  name: "kycProtocol",
150
160
  type: "string",
@@ -159,6 +169,38 @@ const liquidationCompressorAbi = [
159
169
  }],
160
170
  stateMutability: "nonpayable"
161
171
  },
172
+ {
173
+ type: "function",
174
+ name: "getRWALiquidators",
175
+ inputs: [{
176
+ name: "marketConfigurator",
177
+ type: "address",
178
+ internalType: "address"
179
+ }],
180
+ outputs: [{
181
+ name: "liquidators",
182
+ type: "tuple[]",
183
+ internalType: "struct RWALiquidatorInfo[]",
184
+ components: [
185
+ {
186
+ name: "gateway",
187
+ type: "address",
188
+ internalType: "address"
189
+ },
190
+ {
191
+ name: "liquidatorAddress",
192
+ type: "address",
193
+ internalType: "address"
194
+ },
195
+ {
196
+ name: "contractType",
197
+ type: "bytes32",
198
+ internalType: "bytes32"
199
+ }
200
+ ]
201
+ }],
202
+ stateMutability: "view"
203
+ },
162
204
  {
163
205
  type: "function",
164
206
  name: "liquidatableTypeToCompressorType",
@@ -260,18 +260,18 @@ const rwaCompressorAbi = [
260
260
  },
261
261
  {
262
262
  type: "error",
263
- name: "InvalidRWAFactoryException",
263
+ name: "InvalidMarketConfiguratorException",
264
264
  inputs: [{
265
- name: "factory",
265
+ name: "marketConfigurator",
266
266
  type: "address",
267
267
  internalType: "address"
268
268
  }]
269
269
  },
270
270
  {
271
271
  type: "error",
272
- name: "InvalidMarketConfiguratorException",
272
+ name: "InvalidRWAFactoryException",
273
273
  inputs: [{
274
- name: "marketConfigurator",
274
+ name: "factory",
275
275
  type: "address",
276
276
  internalType: "address"
277
277
  }]
@@ -52,7 +52,12 @@ const midasLiquidationSubcompressorAbi = [
52
52
  internalType: "struct LiquidationData",
53
53
  components: [
54
54
  {
55
- name: "requiredUnderlyingAmount",
55
+ name: "requiredToken",
56
+ type: "address",
57
+ internalType: "address"
58
+ },
59
+ {
60
+ name: "requiredAmount",
56
61
  type: "uint256",
57
62
  internalType: "uint256"
58
63
  },
@@ -107,6 +112,11 @@ const midasLiquidationSubcompressorAbi = [
107
112
  type: "bool",
108
113
  internalType: "bool"
109
114
  },
115
+ {
116
+ name: "isCreditAccountFrozen",
117
+ type: "bool",
118
+ internalType: "bool"
119
+ },
110
120
  {
111
121
  name: "kycProtocol",
112
122
  type: "string",
@@ -121,6 +131,38 @@ const midasLiquidationSubcompressorAbi = [
121
131
  }],
122
132
  stateMutability: "nonpayable"
123
133
  },
134
+ {
135
+ type: "function",
136
+ name: "getRWALiquidatorInfo",
137
+ inputs: [{
138
+ name: "token",
139
+ type: "address",
140
+ internalType: "address"
141
+ }],
142
+ outputs: [{
143
+ name: "info",
144
+ type: "tuple",
145
+ internalType: "struct RWALiquidatorInfo",
146
+ components: [
147
+ {
148
+ name: "gateway",
149
+ type: "address",
150
+ internalType: "address"
151
+ },
152
+ {
153
+ name: "liquidatorAddress",
154
+ type: "address",
155
+ internalType: "address"
156
+ },
157
+ {
158
+ name: "contractType",
159
+ type: "bytes32",
160
+ internalType: "bytes32"
161
+ }
162
+ ]
163
+ }],
164
+ stateMutability: "view"
165
+ },
124
166
  {
125
167
  type: "function",
126
168
  name: "version",
@@ -52,7 +52,12 @@ const securitizeLiquidationSubcompressorAbi = [
52
52
  internalType: "struct LiquidationData",
53
53
  components: [
54
54
  {
55
- name: "requiredUnderlyingAmount",
55
+ name: "requiredToken",
56
+ type: "address",
57
+ internalType: "address"
58
+ },
59
+ {
60
+ name: "requiredAmount",
56
61
  type: "uint256",
57
62
  internalType: "uint256"
58
63
  },
@@ -107,6 +112,11 @@ const securitizeLiquidationSubcompressorAbi = [
107
112
  type: "bool",
108
113
  internalType: "bool"
109
114
  },
115
+ {
116
+ name: "isCreditAccountFrozen",
117
+ type: "bool",
118
+ internalType: "bool"
119
+ },
110
120
  {
111
121
  name: "kycProtocol",
112
122
  type: "string",
@@ -121,6 +131,38 @@ const securitizeLiquidationSubcompressorAbi = [
121
131
  }],
122
132
  stateMutability: "nonpayable"
123
133
  },
134
+ {
135
+ type: "function",
136
+ name: "getRWALiquidatorInfo",
137
+ inputs: [{
138
+ name: "token",
139
+ type: "address",
140
+ internalType: "address"
141
+ }],
142
+ outputs: [{
143
+ name: "info",
144
+ type: "tuple",
145
+ internalType: "struct RWALiquidatorInfo",
146
+ components: [
147
+ {
148
+ name: "gateway",
149
+ type: "address",
150
+ internalType: "address"
151
+ },
152
+ {
153
+ name: "liquidatorAddress",
154
+ type: "address",
155
+ internalType: "address"
156
+ },
157
+ {
158
+ name: "contractType",
159
+ type: "bytes32",
160
+ internalType: "bytes32"
161
+ }
162
+ ]
163
+ }],
164
+ stateMutability: "view"
165
+ },
124
166
  {
125
167
  type: "function",
126
168
  name: "version",
@@ -80,6 +80,11 @@ const midasWithdrawalSubcompressorAbi = [
80
80
  internalType: "bytes"
81
81
  }]
82
82
  },
83
+ {
84
+ name: "redeemer",
85
+ type: "address",
86
+ internalType: "address"
87
+ },
83
88
  {
84
89
  name: "extraData",
85
90
  type: "bytes",
@@ -128,6 +133,11 @@ const midasWithdrawalSubcompressorAbi = [
128
133
  type: "uint256",
129
134
  internalType: "uint256"
130
135
  },
136
+ {
137
+ name: "redeemer",
138
+ type: "address",
139
+ internalType: "address"
140
+ },
131
141
  {
132
142
  name: "extraData",
133
143
  type: "bytes",
@@ -205,6 +215,11 @@ const midasWithdrawalSubcompressorAbi = [
205
215
  internalType: "bytes"
206
216
  }]
207
217
  },
218
+ {
219
+ name: "redeemer",
220
+ type: "address",
221
+ internalType: "address"
222
+ },
208
223
  {
209
224
  name: "extraData",
210
225
  type: "bytes",
@@ -253,6 +268,11 @@ const midasWithdrawalSubcompressorAbi = [
253
268
  type: "uint256",
254
269
  internalType: "uint256"
255
270
  },
271
+ {
272
+ name: "redeemer",
273
+ type: "address",
274
+ internalType: "address"
275
+ },
256
276
  {
257
277
  name: "extraData",
258
278
  type: "bytes",
@@ -80,6 +80,11 @@ const securitizeRedemptionSubcompressorAbi = [
80
80
  internalType: "bytes"
81
81
  }]
82
82
  },
83
+ {
84
+ name: "redeemer",
85
+ type: "address",
86
+ internalType: "address"
87
+ },
83
88
  {
84
89
  name: "extraData",
85
90
  type: "bytes",
@@ -128,6 +133,11 @@ const securitizeRedemptionSubcompressorAbi = [
128
133
  type: "uint256",
129
134
  internalType: "uint256"
130
135
  },
136
+ {
137
+ name: "redeemer",
138
+ type: "address",
139
+ internalType: "address"
140
+ },
131
141
  {
132
142
  name: "extraData",
133
143
  type: "bytes",
@@ -205,6 +215,11 @@ const securitizeRedemptionSubcompressorAbi = [
205
215
  internalType: "bytes"
206
216
  }]
207
217
  },
218
+ {
219
+ name: "redeemer",
220
+ type: "address",
221
+ internalType: "address"
222
+ },
208
223
  {
209
224
  name: "extraData",
210
225
  type: "bytes",
@@ -253,6 +268,11 @@ const securitizeRedemptionSubcompressorAbi = [
253
268
  type: "uint256",
254
269
  internalType: "uint256"
255
270
  },
271
+ {
272
+ name: "redeemer",
273
+ type: "address",
274
+ internalType: "address"
275
+ },
256
276
  {
257
277
  name: "extraData",
258
278
  type: "bytes",
@@ -119,6 +119,11 @@ const withdrawalCompressorAbi = [
119
119
  internalType: "bytes"
120
120
  }]
121
121
  },
122
+ {
123
+ name: "redeemer",
124
+ type: "address",
125
+ internalType: "address"
126
+ },
122
127
  {
123
128
  name: "extraData",
124
129
  type: "bytes",
@@ -167,6 +172,11 @@ const withdrawalCompressorAbi = [
167
172
  type: "uint256",
168
173
  internalType: "uint256"
169
174
  },
175
+ {
176
+ name: "redeemer",
177
+ type: "address",
178
+ internalType: "address"
179
+ },
170
180
  {
171
181
  name: "extraData",
172
182
  type: "bytes",
@@ -244,6 +254,11 @@ const withdrawalCompressorAbi = [
244
254
  internalType: "bytes"
245
255
  }]
246
256
  },
257
+ {
258
+ name: "redeemer",
259
+ type: "address",
260
+ internalType: "address"
261
+ },
247
262
  {
248
263
  name: "extraData",
249
264
  type: "bytes",
@@ -292,6 +307,11 @@ const withdrawalCompressorAbi = [
292
307
  type: "uint256",
293
308
  internalType: "uint256"
294
309
  },
310
+ {
311
+ name: "redeemer",
312
+ type: "address",
313
+ internalType: "address"
314
+ },
295
315
  {
296
316
  name: "extraData",
297
317
  type: "bytes",
@@ -369,6 +389,11 @@ const withdrawalCompressorAbi = [
369
389
  internalType: "bytes"
370
390
  }]
371
391
  },
392
+ {
393
+ name: "redeemer",
394
+ type: "address",
395
+ internalType: "address"
396
+ },
372
397
  {
373
398
  name: "extraData",
374
399
  type: "bytes",
@@ -417,6 +442,11 @@ const withdrawalCompressorAbi = [
417
442
  type: "uint256",
418
443
  internalType: "uint256"
419
444
  },
445
+ {
446
+ name: "redeemer",
447
+ type: "address",
448
+ internalType: "address"
449
+ },
420
450
  {
421
451
  name: "extraData",
422
452
  type: "bytes",
@@ -0,0 +1,19 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/abi/iPhantomToken.ts
3
+ const iPhantomTokenAbi = [{
4
+ type: "function",
5
+ inputs: [],
6
+ name: "getPhantomTokenInfo",
7
+ outputs: [{
8
+ name: "target",
9
+ internalType: "address",
10
+ type: "address"
11
+ }, {
12
+ name: "depositedToken",
13
+ internalType: "address",
14
+ type: "address"
15
+ }],
16
+ stateMutability: "view"
17
+ }];
18
+ //#endregion
19
+ exports.iPhantomTokenAbi = iPhantomTokenAbi;
@@ -0,0 +1,19 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/abi/rwa/iRWAGateway.ts
3
+ /**
4
+ * Minimal ABI shared by RWA delayed-withdrawal gateways (Midas, Securitize).
5
+ * Only holds `transferMaster`, which is the gateway's dedicated liquidator.
6
+ */
7
+ const iRWAGatewayAbi = [{
8
+ type: "function",
9
+ inputs: [],
10
+ name: "transferMaster",
11
+ outputs: [{
12
+ name: "",
13
+ internalType: "address",
14
+ type: "address"
15
+ }],
16
+ stateMutability: "view"
17
+ }];
18
+ //#endregion
19
+ exports.iRWAGatewayAbi = iRWAGatewayAbi;
@@ -20,8 +20,14 @@ const adapterActionSignatures = {
20
20
  ["KELP_WITHDRAWAL"]: { 310: "function setTokensOutBatchStatus((address,address,bool)[])" },
21
21
  ["MELLOW_CLAIMER"]: { 310: "function setMultiVaultStatusBatch((address,address,bool)[])" },
22
22
  ["MELLOW_WRAPPER"]: { 310: "function setVaultStatusBatch((address,bool)[])" },
23
- ["MIDAS_ISSUANCE_VAULT"]: { 310: "function setTokenAllowedStatusBatch(address[],bool[])" },
24
- ["MIDAS_REDEMPTION_VAULT"]: { 310: "function setTokenAllowedStatusBatch((address,address,bool)[])" },
23
+ ["MIDAS_ISSUANCE_VAULT"]: {
24
+ 310: "function setTokenAllowedStatusBatch(address[],bool[])",
25
+ 311: "function setInputTokenStatusBatch(address[],bool[])"
26
+ },
27
+ ["MIDAS_REDEMPTION_VAULT"]: {
28
+ 310: "function setTokenAllowedStatusBatch((address,address,bool)[])",
29
+ 311: "function setOutputTokenStatusBatch(address[],bool[])"
30
+ },
25
31
  ["PENDLE_ROUTER"]: {
26
32
  310: "function setPairStatusBatch((address,address,address,uint8)[])",
27
33
  311: "function setPairStatusBatch((address,address,address,uint8,uint8)[])"
@@ -20,7 +20,10 @@ const adapterConstructorAbi = {
20
20
  ["INFINIFI_GATEWAY"]: { 310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
21
21
  ["LIDO_V1"]: { 310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
22
22
  ["LIDO_WSTETH_V1"]: { 310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
23
- ["MIDAS_REDEMPTION_VAULT"]: { 310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI },
23
+ ["MIDAS_REDEMPTION_VAULT"]: {
24
+ 310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI,
25
+ 311: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI
26
+ },
24
27
  ["PENDLE_ROUTER"]: {
25
28
  310: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI,
26
29
  311: require_plugins_adapters_abi_conctructorAbiPatterns.BASIC_ADAPTER_ABI
@@ -65,7 +68,10 @@ const adapterConstructorAbi = {
65
68
  311: require_plugins_adapters_abi_conctructorAbiPatterns.PHANTOM_TOKEN_ADAPTER_ABI
66
69
  },
67
70
  ["STAKING_REWARDS"]: { 312: require_plugins_adapters_abi_conctructorAbiPatterns.STAKING_REWARDS_ADAPTER_ABI },
68
- ["MIDAS_ISSUANCE_VAULT"]: { 310: require_plugins_adapters_abi_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI },
71
+ ["MIDAS_ISSUANCE_VAULT"]: {
72
+ 310: require_plugins_adapters_abi_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI,
73
+ 311: require_plugins_adapters_abi_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI
74
+ },
69
75
  ["MIDAS_GATEWAY"]: { 311: require_plugins_adapters_abi_conctructorAbiPatterns.REFERER_ID_ADAPTER_ABI }
70
76
  };
71
77
  //#endregion
@@ -9,6 +9,7 @@ let viem = require("viem");
9
9
  const abi = require_plugins_adapters_abi_adapters_iMidasRedemptionVaultAdapterV310.iMidasRedemptionVaultAdapterV310Abi;
10
10
  const protocolAbi = require_plugins_adapters_abi_adapters_iMidasRedemptionVaultAdapterV310.iMidasRedemptionVaultGatewayV310Abi;
11
11
  var MidasRedemptionVaultAdapterContract = class extends require_plugins_adapters_contracts_AbstractAdapter.AbstractAdapterContract {
12
+ #version;
12
13
  #gateway;
13
14
  #mToken;
14
15
  #allowedTokens;
@@ -19,41 +20,68 @@ var MidasRedemptionVaultAdapterContract = class extends require_plugins_adapters
19
20
  protocolAbi
20
21
  });
21
22
  if (args.baseParams.serializedParams) {
22
- const decoded = (0, viem.decodeAbiParameters)([
23
- {
24
- type: "address",
25
- name: "creditManager"
26
- },
27
- {
28
- type: "address",
29
- name: "targetContract"
30
- },
31
- {
32
- type: "address",
33
- name: "gateway"
34
- },
35
- {
36
- type: "address",
37
- name: "mToken"
38
- },
39
- {
40
- type: "address[]",
41
- name: "allowedTokens"
42
- },
43
- {
44
- type: "address[]",
45
- name: "allowedPhantomTokens"
46
- }
47
- ], args.baseParams.serializedParams);
48
- this.#gateway = decoded[2];
49
- this.#mToken = decoded[3];
50
- this.#allowedTokens = decoded[4].map((token, index) => ({
51
- token,
52
- phantomToken: decoded[5][index]
53
- }));
23
+ const version = Number(args.baseParams.version);
24
+ this.#version = version;
25
+ if (version <= 310) {
26
+ const decoded = (0, viem.decodeAbiParameters)([
27
+ {
28
+ type: "address",
29
+ name: "creditManager"
30
+ },
31
+ {
32
+ type: "address",
33
+ name: "targetContract"
34
+ },
35
+ {
36
+ type: "address",
37
+ name: "gateway"
38
+ },
39
+ {
40
+ type: "address",
41
+ name: "mToken"
42
+ },
43
+ {
44
+ type: "address[]",
45
+ name: "allowedTokens"
46
+ },
47
+ {
48
+ type: "address[]",
49
+ name: "allowedPhantomTokens"
50
+ }
51
+ ], args.baseParams.serializedParams);
52
+ this.#gateway = decoded[2];
53
+ this.#mToken = decoded[3];
54
+ this.#allowedTokens = decoded[4].map((token, index) => ({
55
+ token,
56
+ phantomToken: decoded[5][index]
57
+ }));
58
+ } else {
59
+ const decoded = (0, viem.decodeAbiParameters)([
60
+ {
61
+ type: "address",
62
+ name: "creditManager"
63
+ },
64
+ {
65
+ type: "address",
66
+ name: "targetContract"
67
+ },
68
+ {
69
+ type: "address",
70
+ name: "mToken"
71
+ },
72
+ {
73
+ type: "address[]",
74
+ name: "supportedInputTokens"
75
+ }
76
+ ], args.baseParams.serializedParams);
77
+ this.#mToken = decoded[2];
78
+ this.#allowedTokens = [...decoded[3]];
79
+ }
54
80
  }
55
81
  }
56
82
  get gateway() {
83
+ if (!this.#version) throw new require_sdk_base_errors.MissingSerializedParamsError("version");
84
+ if (this.#version > 310) return void 0;
57
85
  if (!this.#gateway) throw new require_sdk_base_errors.MissingSerializedParamsError("gateway");
58
86
  return this.#gateway;
59
87
  }
@@ -70,10 +98,13 @@ var MidasRedemptionVaultAdapterContract = class extends require_plugins_adapters
70
98
  ...super.stateHuman(raw),
71
99
  gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
72
100
  mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
73
- allowedTokens: this.#allowedTokens?.map((t) => ({
74
- token: this.labelAddress(t.token),
75
- phantomToken: this.labelAddress(t.phantomToken)
76
- }))
101
+ allowedTokens: this.#allowedTokens?.map((t) => {
102
+ if (typeof t === "object") return {
103
+ token: this.labelAddress(t.token),
104
+ phantomToken: this.labelAddress(t.phantomToken)
105
+ };
106
+ return { token: this.labelAddress(t) };
107
+ })
77
108
  };
78
109
  }
79
110
  async applyBalanceChanges(balances, decoded) {
@@ -1,5 +1,6 @@
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");
3
4
  const require_sdk_utils_AddressSet = require("../../utils/AddressSet.js");
4
5
  const require_sdk_constants_addresses = require("../../constants/addresses.js");
5
6
  const require_sdk_constants_math = require("../../constants/math.js");
@@ -8,7 +9,14 @@ const require_sdk_utils_hex = require("../../utils/hex.js");
8
9
  require("../../utils/index.js");
9
10
  const require_sdk_base_SDKConstruct = require("../../base/SDKConstruct.js");
10
11
  require("../../base/index.js");
12
+ const require_sdk_market_rwa_midas_constants = require("../../market/rwa/midas/constants.js");
13
+ const require_sdk_market_rwa_midas_MidasLiquidatorContract = require("../../market/rwa/midas/MidasLiquidatorContract.js");
14
+ require("../../market/rwa/midas/index.js");
15
+ const require_sdk_market_rwa_securitize_constants = require("../../market/rwa/securitize/constants.js");
16
+ const require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract = require("../../market/rwa/securitize/SecuritizeLiquidatorContract.js");
17
+ require("../../market/rwa/securitize/index.js");
11
18
  const require_sdk_accounts_liquidations_constants = require("./constants.js");
19
+ const require_abi_rwa_iRWAGateway = require("../../../abi/rwa/iRWAGateway.js");
12
20
  const require_sdk_accounts_liquidations_helpers = require("./helpers.js");
13
21
  //#region src/sdk/accounts/liquidations/LiquidationsService.ts
14
22
  /**
@@ -95,6 +103,63 @@ var LiquidationsService = class extends require_sdk_base_SDKConstruct.SDKConstru
95
103
  const current = await compressor.getExternalAccountCurrentWithdrawals(props.liquidator, ...phantomTokens.asArray());
96
104
  return require_sdk_accounts_liquidations_helpers.toLiquidatorWithdrawals(current, this.sdk.networkType);
97
105
  }
106
+ /**
107
+ * {@inheritDoc ILiquidationsService.loadRWALiquidators}
108
+ **/
109
+ async loadRWALiquidators() {
110
+ await this.sdk.tokensMeta.loadTokenData();
111
+ const phantomTokens = [];
112
+ for (const meta of this.sdk.tokensMeta.phantomTokens.values()) switch (meta.contractType) {
113
+ case require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION:
114
+ case require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION: phantomTokens.push(meta);
115
+ }
116
+ if (phantomTokens.length === 0) return;
117
+ const ptResp = await this.client.multicall({
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"
135
+ })),
136
+ allowFailure: false,
137
+ batchSize: 0
138
+ });
139
+ const refs = gateways.map(({ contractType }, i) => ({
140
+ liquidator: gwResp[i],
141
+ contractType
142
+ }));
143
+ for (const ref of refs) this.#createRWALiquidator(ref);
144
+ }
145
+ /**
146
+ * Instantiates the liquidator contract, which registers it and labels its
147
+ * address (see `BaseContract`).
148
+ *
149
+ * @param ref - Discovered liquidator address and its phantom token type
150
+ **/
151
+ #createRWALiquidator(ref) {
152
+ const { liquidator, contractType } = ref;
153
+ if (this.sdk.getContract(liquidator)) return;
154
+ switch (contractType) {
155
+ case require_sdk_market_rwa_securitize_constants.PHANTOM_TOKEN_SECURITIZE_REDEMPTION:
156
+ new require_sdk_market_rwa_securitize_SecuritizeLiquidatorContract.SecuritizeLiquidatorContract(this.sdk, liquidator);
157
+ return;
158
+ case require_sdk_market_rwa_midas_constants.PHANTOM_TOKEN_MIDAS_REDEMPTION:
159
+ new require_sdk_market_rwa_midas_MidasLiquidatorContract.MidasLiquidatorContract(this.sdk, liquidator);
160
+ return;
161
+ }
162
+ }
98
163
  async #getCreditAccountData(creditAccount) {
99
164
  const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
100
165
  if (!ca) throw new Error(`credit account ${creditAccount} not found`);