@gearbox-protocol/sdk 14.12.0-next.47 → 14.12.0-next.49
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 +103 -0
- package/dist/cjs/abi/compressors/liquidationCompressor.js +215 -0
- package/dist/cjs/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +104 -0
- package/dist/cjs/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +104 -0
- package/dist/cjs/dev/withdrawalAbi.js +104 -66
- package/dist/cjs/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +2 -306
- package/dist/cjs/plugins/adapters/abi/index.js +2 -0
- package/dist/cjs/plugins/adapters/abi/midas/iMidasGatewayV311.js +194 -0
- package/dist/cjs/plugins/adapters/abi/midas/index.js +22 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.js +184 -24
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +2 -1
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +81 -58
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +6 -0
- package/dist/cjs/sdk/accounts/liquidations/constants.js +29 -0
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +49 -2
- package/dist/cjs/sdk/accounts/liquidations/index.js +2 -2
- package/dist/esm/abi/ILiquidationCompressorV313.js +79 -0
- package/dist/esm/abi/compressors/liquidationCompressor.js +191 -0
- package/dist/esm/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +80 -0
- package/dist/esm/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +80 -0
- package/dist/esm/dev/withdrawalAbi.js +104 -66
- package/dist/esm/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +1 -304
- package/dist/esm/plugins/adapters/abi/index.js +1 -0
- package/dist/esm/plugins/adapters/abi/midas/iMidasGatewayV311.js +170 -0
- package/dist/esm/plugins/adapters/abi/midas/index.js +1 -0
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.js +184 -24
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +2 -4
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +87 -61
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +6 -0
- package/dist/esm/sdk/accounts/liquidations/constants.js +5 -0
- package/dist/esm/sdk/accounts/liquidations/helpers.js +46 -2
- package/dist/esm/sdk/accounts/liquidations/index.js +1 -1
- package/dist/types/abi/ILiquidationCompressorV313.d.ts +107 -0
- package/dist/types/abi/compressors/liquidationCompressor.d.ts +262 -0
- package/dist/types/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.d.ts +111 -0
- package/dist/types/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.d.ts +111 -0
- package/dist/types/dev/withdrawalAbi.d.ts +81 -53
- package/dist/types/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.d.ts +0 -233
- package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
- package/dist/types/plugins/adapters/abi/midas/iMidasGatewayV311.d.ts +261 -0
- package/dist/types/plugins/adapters/abi/midas/index.d.ts +1 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.d.ts +24 -0
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +28 -0
- package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +24 -0
- package/dist/types/rewards/rewards/merkl-api.d.ts +1 -1
- package/dist/types/sdk/MultichainSDK.d.ts +1 -1
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +6 -1
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +11 -6
- package/dist/types/sdk/accounts/liquidations/constants.d.ts +6 -0
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +73 -2
- package/dist/types/sdk/accounts/liquidations/index.d.ts +1 -1
- package/dist/types/sdk/accounts/liquidations/types.d.ts +142 -30
- package/package.json +9 -9
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
const iMidasGatewayV311Abi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "accessControl",
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
7
|
+
stateMutability: "view"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: "function",
|
|
11
|
+
name: "contractType",
|
|
12
|
+
inputs: [],
|
|
13
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
14
|
+
stateMutability: "view"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "function",
|
|
18
|
+
name: "depositInstant",
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: "amountToken", type: "uint256", internalType: "uint256" },
|
|
21
|
+
{ name: "minReceiveAmount", type: "uint256", internalType: "uint256" },
|
|
22
|
+
{ name: "referrerId", type: "bytes32", internalType: "bytes32" }
|
|
23
|
+
],
|
|
24
|
+
outputs: [],
|
|
25
|
+
stateMutability: "nonpayable"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: "function",
|
|
29
|
+
name: "isEligibleAccountOwner",
|
|
30
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
31
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
32
|
+
stateMutability: "view"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "function",
|
|
36
|
+
name: "mToken",
|
|
37
|
+
inputs: [],
|
|
38
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
39
|
+
stateMutability: "view"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "function",
|
|
43
|
+
name: "mode",
|
|
44
|
+
inputs: [],
|
|
45
|
+
outputs: [{ name: "", type: "uint8", internalType: "enum MidasMode" }],
|
|
46
|
+
stateMutability: "view"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "function",
|
|
50
|
+
name: "pendingAndClaimableTokenOutAmounts",
|
|
51
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
52
|
+
outputs: [
|
|
53
|
+
{ name: "pendingAmount", type: "uint256", internalType: "uint256" },
|
|
54
|
+
{ name: "claimableAmount", type: "uint256", internalType: "uint256" }
|
|
55
|
+
],
|
|
56
|
+
stateMutability: "view"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "function",
|
|
60
|
+
name: "pendingRedeemers",
|
|
61
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
62
|
+
outputs: [
|
|
63
|
+
{ name: "redeemers", type: "address[]", internalType: "address[]" }
|
|
64
|
+
],
|
|
65
|
+
stateMutability: "view"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "phantomToken",
|
|
70
|
+
inputs: [],
|
|
71
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
72
|
+
stateMutability: "view"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "function",
|
|
76
|
+
name: "quoteToken",
|
|
77
|
+
inputs: [],
|
|
78
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
79
|
+
stateMutability: "view"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: "function",
|
|
83
|
+
name: "redeemInstant",
|
|
84
|
+
inputs: [
|
|
85
|
+
{ name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
|
|
86
|
+
{ name: "minReceiveAmount", type: "uint256", internalType: "uint256" }
|
|
87
|
+
],
|
|
88
|
+
outputs: [],
|
|
89
|
+
stateMutability: "nonpayable"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "function",
|
|
93
|
+
name: "redemptionLogger",
|
|
94
|
+
inputs: [],
|
|
95
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
96
|
+
stateMutability: "view"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "function",
|
|
100
|
+
name: "requestRedeem",
|
|
101
|
+
inputs: [
|
|
102
|
+
{ name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
|
|
103
|
+
{ name: "extraData", type: "bytes", internalType: "bytes" }
|
|
104
|
+
],
|
|
105
|
+
outputs: [],
|
|
106
|
+
stateMutability: "nonpayable"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "function",
|
|
110
|
+
name: "transferMaster",
|
|
111
|
+
inputs: [],
|
|
112
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
113
|
+
stateMutability: "view"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: "function",
|
|
117
|
+
name: "transferRedeemer",
|
|
118
|
+
inputs: [
|
|
119
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
120
|
+
{ name: "newAccount", type: "address", internalType: "address" }
|
|
121
|
+
],
|
|
122
|
+
outputs: [],
|
|
123
|
+
stateMutability: "nonpayable"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "function",
|
|
127
|
+
name: "version",
|
|
128
|
+
inputs: [],
|
|
129
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
130
|
+
stateMutability: "view"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: "function",
|
|
134
|
+
name: "withdraw",
|
|
135
|
+
inputs: [{ name: "amount", type: "uint256", internalType: "uint256" }],
|
|
136
|
+
outputs: [],
|
|
137
|
+
stateMutability: "nonpayable"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
type: "function",
|
|
141
|
+
name: "withdrawFromRedeemer",
|
|
142
|
+
inputs: [
|
|
143
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
144
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
145
|
+
],
|
|
146
|
+
outputs: [],
|
|
147
|
+
stateMutability: "nonpayable"
|
|
148
|
+
},
|
|
149
|
+
{ type: "error", name: "AccessControlNotSetException", inputs: [] },
|
|
150
|
+
{
|
|
151
|
+
type: "error",
|
|
152
|
+
name: "ArbitraryCAAllowedInPermissionedModeException",
|
|
153
|
+
inputs: []
|
|
154
|
+
},
|
|
155
|
+
{ type: "error", name: "CreditAccountNotEligibleException", inputs: [] },
|
|
156
|
+
{ type: "error", name: "IncompatibleAccessControlsException", inputs: [] },
|
|
157
|
+
{
|
|
158
|
+
type: "error",
|
|
159
|
+
name: "IncompatibleIssuanceAndRedemptionVaultsException",
|
|
160
|
+
inputs: []
|
|
161
|
+
},
|
|
162
|
+
{ type: "error", name: "InsufficientBalanceException", inputs: [] },
|
|
163
|
+
{ type: "error", name: "MaxPendingRedeemersPerAccountException", inputs: [] },
|
|
164
|
+
{ type: "error", name: "NewAccountNotGreenlistedException", inputs: [] },
|
|
165
|
+
{ type: "error", name: "RedeemerNotOwnedByAccountException", inputs: [] },
|
|
166
|
+
{ type: "error", name: "RedeemerTransferNotAllowedException", inputs: [] }
|
|
167
|
+
];
|
|
168
|
+
export {
|
|
169
|
+
iMidasGatewayV311Abi
|
|
170
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./iMidasGatewayV311.js";
|
|
@@ -3,7 +3,11 @@ const iSecuritizeRedemptionGatewayV311Abi = [
|
|
|
3
3
|
type: "function",
|
|
4
4
|
name: "claim",
|
|
5
5
|
inputs: [
|
|
6
|
-
{
|
|
6
|
+
{
|
|
7
|
+
name: "redeemers",
|
|
8
|
+
type: "address[]",
|
|
9
|
+
internalType: "address[]"
|
|
10
|
+
}
|
|
7
11
|
],
|
|
8
12
|
outputs: [],
|
|
9
13
|
stateMutability: "nonpayable"
|
|
@@ -12,57 +16,157 @@ const iSecuritizeRedemptionGatewayV311Abi = [
|
|
|
12
16
|
type: "function",
|
|
13
17
|
name: "contractType",
|
|
14
18
|
inputs: [],
|
|
15
|
-
outputs: [
|
|
19
|
+
outputs: [
|
|
20
|
+
{
|
|
21
|
+
name: "",
|
|
22
|
+
type: "bytes32",
|
|
23
|
+
internalType: "bytes32"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
16
26
|
stateMutability: "view"
|
|
17
27
|
},
|
|
18
28
|
{
|
|
19
29
|
type: "function",
|
|
20
30
|
name: "dsToken",
|
|
21
31
|
inputs: [],
|
|
22
|
-
outputs: [
|
|
32
|
+
outputs: [
|
|
33
|
+
{
|
|
34
|
+
name: "",
|
|
35
|
+
type: "address",
|
|
36
|
+
internalType: "address"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
23
39
|
stateMutability: "view"
|
|
24
40
|
},
|
|
25
41
|
{
|
|
26
42
|
type: "function",
|
|
27
43
|
name: "getRedeemers",
|
|
28
|
-
inputs: [
|
|
29
|
-
|
|
44
|
+
inputs: [
|
|
45
|
+
{
|
|
46
|
+
name: "account",
|
|
47
|
+
type: "address",
|
|
48
|
+
internalType: "address"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
outputs: [
|
|
52
|
+
{
|
|
53
|
+
name: "",
|
|
54
|
+
type: "address[]",
|
|
55
|
+
internalType: "address[]"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
30
58
|
stateMutability: "view"
|
|
31
59
|
},
|
|
32
60
|
{
|
|
33
61
|
type: "function",
|
|
34
62
|
name: "getRedemptionAmount",
|
|
35
|
-
inputs: [
|
|
36
|
-
|
|
63
|
+
inputs: [
|
|
64
|
+
{
|
|
65
|
+
name: "account",
|
|
66
|
+
type: "address",
|
|
67
|
+
internalType: "address"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
outputs: [
|
|
71
|
+
{
|
|
72
|
+
name: "",
|
|
73
|
+
type: "uint256",
|
|
74
|
+
internalType: "uint256"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
37
77
|
stateMutability: "view"
|
|
38
78
|
},
|
|
39
79
|
{
|
|
40
80
|
type: "function",
|
|
41
81
|
name: "getUnclaimedRedeemers",
|
|
42
|
-
inputs: [
|
|
43
|
-
|
|
82
|
+
inputs: [
|
|
83
|
+
{
|
|
84
|
+
name: "account",
|
|
85
|
+
type: "address",
|
|
86
|
+
internalType: "address"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
outputs: [
|
|
90
|
+
{
|
|
91
|
+
name: "",
|
|
92
|
+
type: "address[]",
|
|
93
|
+
internalType: "address[]"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
stateMutability: "view"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "function",
|
|
100
|
+
name: "isEligibleAccountOwner",
|
|
101
|
+
inputs: [
|
|
102
|
+
{
|
|
103
|
+
name: "account",
|
|
104
|
+
type: "address",
|
|
105
|
+
internalType: "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
outputs: [
|
|
109
|
+
{
|
|
110
|
+
name: "",
|
|
111
|
+
type: "bool",
|
|
112
|
+
internalType: "bool"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
44
115
|
stateMutability: "view"
|
|
45
116
|
},
|
|
46
117
|
{
|
|
47
118
|
type: "function",
|
|
48
119
|
name: "masterRedeemer",
|
|
49
120
|
inputs: [],
|
|
50
|
-
outputs: [
|
|
121
|
+
outputs: [
|
|
122
|
+
{
|
|
123
|
+
name: "",
|
|
124
|
+
type: "address",
|
|
125
|
+
internalType: "address"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
51
128
|
stateMutability: "view"
|
|
52
129
|
},
|
|
53
130
|
{
|
|
54
131
|
type: "function",
|
|
55
132
|
name: "navProvider",
|
|
56
133
|
inputs: [],
|
|
57
|
-
outputs: [
|
|
134
|
+
outputs: [
|
|
135
|
+
{
|
|
136
|
+
name: "",
|
|
137
|
+
type: "address",
|
|
138
|
+
internalType: "address"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
stateMutability: "view"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "function",
|
|
145
|
+
name: "phantomToken",
|
|
146
|
+
inputs: [],
|
|
147
|
+
outputs: [
|
|
148
|
+
{
|
|
149
|
+
name: "",
|
|
150
|
+
type: "address",
|
|
151
|
+
internalType: "address"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
58
154
|
stateMutability: "view"
|
|
59
155
|
},
|
|
60
156
|
{
|
|
61
157
|
type: "function",
|
|
62
158
|
name: "redeem",
|
|
63
159
|
inputs: [
|
|
64
|
-
{
|
|
65
|
-
|
|
160
|
+
{
|
|
161
|
+
name: "dsTokenAmount",
|
|
162
|
+
type: "uint256",
|
|
163
|
+
internalType: "uint256"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "extraData",
|
|
167
|
+
type: "bytes",
|
|
168
|
+
internalType: "bytes"
|
|
169
|
+
}
|
|
66
170
|
],
|
|
67
171
|
outputs: [],
|
|
68
172
|
stateMutability: "nonpayable"
|
|
@@ -71,43 +175,81 @@ const iSecuritizeRedemptionGatewayV311Abi = [
|
|
|
71
175
|
type: "function",
|
|
72
176
|
name: "redemptionAccount",
|
|
73
177
|
inputs: [],
|
|
74
|
-
outputs: [
|
|
178
|
+
outputs: [
|
|
179
|
+
{
|
|
180
|
+
name: "",
|
|
181
|
+
type: "address",
|
|
182
|
+
internalType: "address"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
75
185
|
stateMutability: "view"
|
|
76
186
|
},
|
|
77
187
|
{
|
|
78
188
|
type: "function",
|
|
79
189
|
name: "redemptionLogger",
|
|
80
190
|
inputs: [],
|
|
81
|
-
outputs: [
|
|
191
|
+
outputs: [
|
|
192
|
+
{
|
|
193
|
+
name: "",
|
|
194
|
+
type: "address",
|
|
195
|
+
internalType: "address"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
82
198
|
stateMutability: "view"
|
|
83
199
|
},
|
|
84
200
|
{
|
|
85
201
|
type: "function",
|
|
86
202
|
name: "securitizeWhitelister",
|
|
87
203
|
inputs: [],
|
|
88
|
-
outputs: [
|
|
204
|
+
outputs: [
|
|
205
|
+
{
|
|
206
|
+
name: "",
|
|
207
|
+
type: "address",
|
|
208
|
+
internalType: "address"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
89
211
|
stateMutability: "view"
|
|
90
212
|
},
|
|
91
213
|
{
|
|
92
214
|
type: "function",
|
|
93
215
|
name: "stableCoinToken",
|
|
94
216
|
inputs: [],
|
|
95
|
-
outputs: [
|
|
217
|
+
outputs: [
|
|
218
|
+
{
|
|
219
|
+
name: "",
|
|
220
|
+
type: "address",
|
|
221
|
+
internalType: "address"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
96
224
|
stateMutability: "view"
|
|
97
225
|
},
|
|
98
226
|
{
|
|
99
227
|
type: "function",
|
|
100
228
|
name: "transferMaster",
|
|
101
229
|
inputs: [],
|
|
102
|
-
outputs: [
|
|
230
|
+
outputs: [
|
|
231
|
+
{
|
|
232
|
+
name: "",
|
|
233
|
+
type: "address",
|
|
234
|
+
internalType: "address"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
103
237
|
stateMutability: "view"
|
|
104
238
|
},
|
|
105
239
|
{
|
|
106
240
|
type: "function",
|
|
107
241
|
name: "transferRedeemer",
|
|
108
242
|
inputs: [
|
|
109
|
-
{
|
|
110
|
-
|
|
243
|
+
{
|
|
244
|
+
name: "redeemer",
|
|
245
|
+
type: "address",
|
|
246
|
+
internalType: "address"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "newAccount",
|
|
250
|
+
type: "address",
|
|
251
|
+
internalType: "address"
|
|
252
|
+
}
|
|
111
253
|
],
|
|
112
254
|
outputs: [],
|
|
113
255
|
stateMutability: "nonpayable"
|
|
@@ -116,7 +258,13 @@ const iSecuritizeRedemptionGatewayV311Abi = [
|
|
|
116
258
|
type: "function",
|
|
117
259
|
name: "version",
|
|
118
260
|
inputs: [],
|
|
119
|
-
outputs: [
|
|
261
|
+
outputs: [
|
|
262
|
+
{
|
|
263
|
+
name: "",
|
|
264
|
+
type: "uint256",
|
|
265
|
+
internalType: "uint256"
|
|
266
|
+
}
|
|
267
|
+
],
|
|
120
268
|
stateMutability: "view"
|
|
121
269
|
},
|
|
122
270
|
{
|
|
@@ -124,9 +272,21 @@ const iSecuritizeRedemptionGatewayV311Abi = [
|
|
|
124
272
|
name: "MaxUnclaimedRedeemersPerAccountException",
|
|
125
273
|
inputs: []
|
|
126
274
|
},
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
275
|
+
{
|
|
276
|
+
type: "error",
|
|
277
|
+
name: "NewAccountNotRegisteredException",
|
|
278
|
+
inputs: []
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: "error",
|
|
282
|
+
name: "RedeemerNotOwnedByAccountException",
|
|
283
|
+
inputs: []
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: "error",
|
|
287
|
+
name: "RedeemerTransferNotAllowedException",
|
|
288
|
+
inputs: []
|
|
289
|
+
}
|
|
130
290
|
];
|
|
131
291
|
export {
|
|
132
292
|
iSecuritizeRedemptionGatewayV311Abi
|
|
@@ -7,10 +7,8 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
MissingSerializedParamsError
|
|
9
9
|
} from "../../../sdk/index.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
iMidasGatewayV311Abi
|
|
13
|
-
} from "../abi/adapters/index.js";
|
|
10
|
+
import { iMidasGatewayAdapterV311Abi } from "../abi/adapters/index.js";
|
|
11
|
+
import { iMidasGatewayV311Abi } from "../abi/index.js";
|
|
14
12
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
15
13
|
const abi = iMidasGatewayAdapterV311Abi;
|
|
16
14
|
const protocolAbi = iMidasGatewayV311Abi;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
1
2
|
import { SDKConstruct } from "../../base/index.js";
|
|
2
|
-
import { WAD } from "../../constants/index.js";
|
|
3
|
-
import { AddressSet } from "../../utils/index.js";
|
|
3
|
+
import { ADDRESS_0X0, WAD } from "../../constants/index.js";
|
|
4
|
+
import { AddressSet, hexEq } from "../../utils/index.js";
|
|
5
|
+
import { LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
4
6
|
import {
|
|
5
7
|
calcEstimatedProfit,
|
|
6
8
|
calcRepaymentAmount,
|
|
7
9
|
DUST_THRESHOLD,
|
|
10
|
+
liquidationCallToRawTx,
|
|
8
11
|
pickMainAsset,
|
|
9
|
-
|
|
12
|
+
toLiquidationApproval,
|
|
13
|
+
toLiquidatorWithdrawals,
|
|
14
|
+
toReceivedAssets
|
|
10
15
|
} from "./helpers.js";
|
|
11
16
|
class LiquidationsService extends SDKConstruct {
|
|
12
17
|
/**
|
|
13
18
|
* {@inheritDoc ILiquidationsService.getLiquidatableAccounts}
|
|
14
19
|
**/
|
|
15
20
|
async getLiquidatableAccounts(props) {
|
|
16
|
-
if (props?.networks && !props.networks.includes(this.sdk.networkType)) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
21
|
await this.sdk.withdrawalCompressor?.loadWithdrawableAssets();
|
|
20
22
|
const accounts = await this.sdk.accounts.getCreditAccounts({
|
|
21
23
|
maxHealthFactor: WAD - 1n,
|
|
@@ -50,67 +52,58 @@ class LiquidationsService extends SDKConstruct {
|
|
|
50
52
|
* {@inheritDoc ILiquidationsService.getLiquidationDetails}
|
|
51
53
|
**/
|
|
52
54
|
async getLiquidationDetails(props) {
|
|
53
|
-
const {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`network mismatch: this SDK is attached to ${this.sdk.networkType}, requested ${network}`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
|
|
60
|
-
if (!ca) {
|
|
61
|
-
throw new Error(`credit account ${creditAccount} not found`);
|
|
62
|
-
}
|
|
63
|
-
if (!ca.success) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
`cannot compute liquidation details for ${creditAccount}: collateral computation failed`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
const compressor = this.sdk.withdrawalCompressor;
|
|
69
|
-
await compressor?.loadWithdrawableAssets();
|
|
55
|
+
const { creditAccount, liquidator, ignoreReservePrices } = props;
|
|
56
|
+
const ca = await this.#getCreditAccountData(creditAccount);
|
|
57
|
+
await this.sdk.withdrawalCompressor?.loadWithdrawableAssets();
|
|
70
58
|
const account = this.#buildAccount(ca);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
59
|
+
const data = await this.#getLiquidationData(
|
|
60
|
+
ca,
|
|
61
|
+
liquidator,
|
|
62
|
+
ignoreReservePrices
|
|
63
|
+
);
|
|
64
|
+
const suite = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
65
|
+
return {
|
|
66
|
+
...account,
|
|
67
|
+
// the compressor reports the exact amounts of the liquidation path it
|
|
68
|
+
// selected, which supersede the estimates of the list row
|
|
69
|
+
repaymentAmount: {
|
|
70
|
+
token: account.totalValue.token,
|
|
71
|
+
balance: data.requiredUnderlyingAmount
|
|
72
|
+
},
|
|
73
|
+
isDelayed: data.expectedOutputs.some((o) => o.delayed),
|
|
74
|
+
receivedAssets: toReceivedAssets(data.expectedOutputs),
|
|
75
|
+
isLiquidatorEligible: data.isLiquidatorEligible,
|
|
76
|
+
kycProtocol: data.kycProtocol || void 0,
|
|
77
|
+
kycToken: hexEq(data.kycToken, ADDRESS_0X0) ? void 0 : data.kycToken,
|
|
78
|
+
approve: toLiquidationApproval({
|
|
79
|
+
target: data.liquidationCall.target,
|
|
80
|
+
creditFacade: suite.creditFacade.address,
|
|
81
|
+
creditManager: ca.creditManager,
|
|
82
|
+
token: suite.underlying,
|
|
83
|
+
amount: data.requiredUnderlyingAmount
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* {@inheritDoc ILiquidationsService.buildLiquidationTx}
|
|
89
|
+
**/
|
|
90
|
+
async buildLiquidationTx(props) {
|
|
91
|
+
const { creditAccount, liquidator, ignoreReservePrices } = props;
|
|
92
|
+
const ca = await this.#getCreditAccountData(creditAccount);
|
|
93
|
+
const data = await this.#getLiquidationData(
|
|
94
|
+
ca,
|
|
95
|
+
liquidator,
|
|
96
|
+
ignoreReservePrices
|
|
97
|
+
);
|
|
98
|
+
return liquidationCallToRawTx(
|
|
99
|
+
data.liquidationCall,
|
|
100
|
+
`liquidate credit account ${this.labelAddress(creditAccount)} to ${this.labelAddress(liquidator)}`
|
|
101
|
+
);
|
|
106
102
|
}
|
|
107
103
|
/**
|
|
108
104
|
* {@inheritDoc ILiquidationsService.getLiquidatorWithdrawals}
|
|
109
105
|
**/
|
|
110
106
|
async getLiquidatorWithdrawals(props) {
|
|
111
|
-
if (props.networks && !props.networks.includes(this.sdk.networkType)) {
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
107
|
const compressor = this.sdk.withdrawalCompressor;
|
|
115
108
|
if (!compressor) {
|
|
116
109
|
return [];
|
|
@@ -125,6 +118,39 @@ class LiquidationsService extends SDKConstruct {
|
|
|
125
118
|
);
|
|
126
119
|
return toLiquidatorWithdrawals(current, this.sdk.networkType);
|
|
127
120
|
}
|
|
121
|
+
async #getCreditAccountData(creditAccount) {
|
|
122
|
+
const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
|
|
123
|
+
if (!ca) {
|
|
124
|
+
throw new Error(`credit account ${creditAccount} not found`);
|
|
125
|
+
}
|
|
126
|
+
if (!ca.success) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
`cannot compute liquidation details for ${creditAccount}: collateral computation failed`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return ca;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Previews the liquidation via the liquidation compressor.
|
|
135
|
+
*
|
|
136
|
+
* @param ca - Credit account to liquidate
|
|
137
|
+
* @param liquidator - Liquidator wallet, zero address when not known: it only
|
|
138
|
+
* affects the KYC eligibility fields and the receiver encoded into the calls
|
|
139
|
+
* @param ignoreReservePrices - Exclude reserve price feeds from the updates
|
|
140
|
+
**/
|
|
141
|
+
async #getLiquidationData(ca, liquidator = ADDRESS_0X0, ignoreReservePrices) {
|
|
142
|
+
const priceUpdates = await this.sdk.accounts.getOnDemandPriceUpdates(
|
|
143
|
+
ca,
|
|
144
|
+
ignoreReservePrices
|
|
145
|
+
);
|
|
146
|
+
const { result } = await this.client.simulateContract({
|
|
147
|
+
address: LIQUIDATION_COMPRESSOR_V313_ADDRESS,
|
|
148
|
+
abi: iLiquidationCompressorV313Abi,
|
|
149
|
+
functionName: "getLiquidationData",
|
|
150
|
+
args: [liquidator, ca.creditAccount, priceUpdates]
|
|
151
|
+
});
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
128
154
|
/**
|
|
129
155
|
* Accounts of expired credit managers with outstanding debt are liquidatable
|
|
130
156
|
* regardless of their health factor.
|
|
@@ -35,6 +35,12 @@ class MultichainLiquidationsService {
|
|
|
35
35
|
async getLiquidationDetails(props) {
|
|
36
36
|
return this.#sdk.chain(props.network).liquidations.getLiquidationDetails(props);
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* {@inheritDoc ILiquidationsService.buildLiquidationTx}
|
|
40
|
+
**/
|
|
41
|
+
async buildLiquidationTx(props) {
|
|
42
|
+
return this.#sdk.chain(props.network).liquidations.buildLiquidationTx(props);
|
|
43
|
+
}
|
|
38
44
|
/**
|
|
39
45
|
* {@inheritDoc ILiquidationsService.getLiquidatorWithdrawals}
|
|
40
46
|
**/
|