@gearbox-protocol/sdk 14.11.8 → 14.11.9
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/plugins/adapters/abi/actionAbi.js +19 -5
- package/dist/cjs/plugins/adapters/abi/conctructorAbi.js +5 -1
- package/dist/cjs/plugins/adapters/abi/securitize/iMidasGatewayAdapter.js +354 -0
- package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +43 -8
- package/dist/cjs/plugins/adapters/abi/securitize/index.js +2 -0
- package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +103 -0
- package/dist/cjs/plugins/adapters/createAdapter.js +3 -0
- package/dist/cjs/plugins/adapters/types.js +1 -0
- package/dist/esm/plugins/adapters/abi/actionAbi.js +19 -5
- package/dist/esm/plugins/adapters/abi/conctructorAbi.js +5 -1
- package/dist/esm/plugins/adapters/abi/securitize/iMidasGatewayAdapter.js +330 -0
- package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.js +43 -8
- package/dist/esm/plugins/adapters/abi/securitize/index.js +1 -0
- package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +81 -0
- package/dist/esm/plugins/adapters/createAdapter.js +3 -0
- package/dist/esm/plugins/adapters/types.js +1 -0
- package/dist/types/plugins/adapters/abi/actionAbi.d.ts +1 -1
- package/dist/types/plugins/adapters/abi/securitize/iMidasGatewayAdapter.d.ts +555 -0
- package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayAdapter.d.ts +73 -7
- package/dist/types/plugins/adapters/abi/securitize/index.d.ts +1 -0
- package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +1144 -0
- package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +73 -7
- package/dist/types/plugins/adapters/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -44,6 +44,12 @@ const adapterActionSignatures = {
|
|
|
44
44
|
[AdapterType.MIDAS_REDEMPTION_VAULT]: {
|
|
45
45
|
310: "function setTokenAllowedStatusBatch((address,address,bool)[])"
|
|
46
46
|
},
|
|
47
|
+
[AdapterType.MIDAS_GATEWAY]: {
|
|
48
|
+
311: [
|
|
49
|
+
"function setInputTokenAllowedStatusBatch(address[],bool[])",
|
|
50
|
+
"function setOutputTokenAllowedStatusBatch((address,address,bool)[])"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
47
53
|
[AdapterType.PENDLE_ROUTER]: {
|
|
48
54
|
310: "function setPairStatusBatch((address,address,address,uint8)[])",
|
|
49
55
|
311: "function setPairStatusBatch((address,address,address,uint8,uint8)[])"
|
|
@@ -71,7 +77,7 @@ const adapterActionAbi = Object.fromEntries(
|
|
|
71
77
|
Object.fromEntries(
|
|
72
78
|
Object.entries(versionedSignature).map(([version, signature]) => [
|
|
73
79
|
version,
|
|
74
|
-
parseAbi([signature])
|
|
80
|
+
parseAbi(Array.isArray(signature) ? signature : [signature])
|
|
75
81
|
])
|
|
76
82
|
)
|
|
77
83
|
]
|
|
@@ -79,10 +85,18 @@ const adapterActionAbi = Object.fromEntries(
|
|
|
79
85
|
);
|
|
80
86
|
const adapterActionSelectors = Object.fromEntries(
|
|
81
87
|
Object.entries(adapterActionSignatures).flatMap(
|
|
82
|
-
([adapterType, versionedSignature]) => Object.entries(versionedSignature).map(([version, signature]) =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
([adapterType, versionedSignature]) => Object.entries(versionedSignature).map(([version, signature]) => {
|
|
89
|
+
if (Array.isArray(signature)) {
|
|
90
|
+
return signature.map((s) => [
|
|
91
|
+
toFunctionSelector(s),
|
|
92
|
+
{ version: +version, signature: s, adapterType }
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
toFunctionSelector(signature),
|
|
97
|
+
{ version: +version, signature, adapterType }
|
|
98
|
+
];
|
|
99
|
+
})
|
|
86
100
|
)
|
|
87
101
|
);
|
|
88
102
|
export {
|
|
@@ -174,7 +174,8 @@ const adapterConstructorAbi = {
|
|
|
174
174
|
310: PHANTOM_TOKEN_ADAPTER_ABI
|
|
175
175
|
},
|
|
176
176
|
[AdapterType.SECURITIZE_REDEMPTION]: {
|
|
177
|
-
310: PHANTOM_TOKEN_ADAPTER_ABI
|
|
177
|
+
310: PHANTOM_TOKEN_ADAPTER_ABI,
|
|
178
|
+
311: PHANTOM_TOKEN_ADAPTER_ABI
|
|
178
179
|
},
|
|
179
180
|
// other patterns
|
|
180
181
|
[AdapterType.STAKING_REWARDS]: {
|
|
@@ -184,6 +185,9 @@ const adapterConstructorAbi = {
|
|
|
184
185
|
},
|
|
185
186
|
[AdapterType.MIDAS_ISSUANCE_VAULT]: {
|
|
186
187
|
310: REFERER_ID_ADAPTER_ABI
|
|
188
|
+
},
|
|
189
|
+
[AdapterType.MIDAS_GATEWAY]: {
|
|
190
|
+
311: REFERER_ID_ADAPTER_ABI
|
|
187
191
|
}
|
|
188
192
|
};
|
|
189
193
|
export {
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
const iMidasGatewayAdapterAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "acl",
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
7
|
+
stateMutability: "view"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: "function",
|
|
11
|
+
name: "allowedInputTokens",
|
|
12
|
+
inputs: [],
|
|
13
|
+
outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
|
|
14
|
+
stateMutability: "view"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "function",
|
|
18
|
+
name: "allowedOutputTokens",
|
|
19
|
+
inputs: [],
|
|
20
|
+
outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
|
|
21
|
+
stateMutability: "view"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "function",
|
|
25
|
+
name: "allowedPhantomTokens",
|
|
26
|
+
inputs: [],
|
|
27
|
+
outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
|
|
28
|
+
stateMutability: "view"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "function",
|
|
32
|
+
name: "contractType",
|
|
33
|
+
inputs: [],
|
|
34
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
35
|
+
stateMutability: "view"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "function",
|
|
39
|
+
name: "creditManager",
|
|
40
|
+
inputs: [],
|
|
41
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
42
|
+
stateMutability: "view"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: "function",
|
|
46
|
+
name: "depositInstant",
|
|
47
|
+
inputs: [
|
|
48
|
+
{ name: "tokenIn", type: "address", internalType: "address" },
|
|
49
|
+
{ name: "amountToken", type: "uint256", internalType: "uint256" },
|
|
50
|
+
{ name: "minReceiveAmount", type: "uint256", internalType: "uint256" },
|
|
51
|
+
{ name: "", type: "bytes32", internalType: "bytes32" }
|
|
52
|
+
],
|
|
53
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
54
|
+
stateMutability: "nonpayable"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "function",
|
|
58
|
+
name: "depositInstantDiff",
|
|
59
|
+
inputs: [
|
|
60
|
+
{ name: "tokenIn", type: "address", internalType: "address" },
|
|
61
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" },
|
|
62
|
+
{ name: "rateMinRAY", type: "uint256", internalType: "uint256" }
|
|
63
|
+
],
|
|
64
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
65
|
+
stateMutability: "nonpayable"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "depositPhantomToken",
|
|
70
|
+
inputs: [
|
|
71
|
+
{ name: "", type: "address", internalType: "address" },
|
|
72
|
+
{ name: "", type: "uint256", internalType: "uint256" }
|
|
73
|
+
],
|
|
74
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
75
|
+
stateMutability: "view"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "function",
|
|
79
|
+
name: "gateway",
|
|
80
|
+
inputs: [],
|
|
81
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
82
|
+
stateMutability: "view"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "function",
|
|
86
|
+
name: "isInputTokenAllowed",
|
|
87
|
+
inputs: [{ name: "token", type: "address", internalType: "address" }],
|
|
88
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
89
|
+
stateMutability: "view"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "function",
|
|
93
|
+
name: "isOutputTokenAllowed",
|
|
94
|
+
inputs: [{ name: "token", type: "address", internalType: "address" }],
|
|
95
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
96
|
+
stateMutability: "view"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "function",
|
|
100
|
+
name: "mToken",
|
|
101
|
+
inputs: [],
|
|
102
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
103
|
+
stateMutability: "view"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "function",
|
|
107
|
+
name: "outputTokenToPhantomToken",
|
|
108
|
+
inputs: [{ name: "", type: "address", internalType: "address" }],
|
|
109
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
110
|
+
stateMutability: "view"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "function",
|
|
114
|
+
name: "phantomTokenToOutputToken",
|
|
115
|
+
inputs: [{ name: "", type: "address", internalType: "address" }],
|
|
116
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
117
|
+
stateMutability: "view"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
type: "function",
|
|
121
|
+
name: "redeemInstant",
|
|
122
|
+
inputs: [
|
|
123
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
124
|
+
{ name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
|
|
125
|
+
{ name: "minReceiveAmount", type: "uint256", internalType: "uint256" }
|
|
126
|
+
],
|
|
127
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
128
|
+
stateMutability: "nonpayable"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "function",
|
|
132
|
+
name: "redeemInstantDiff",
|
|
133
|
+
inputs: [
|
|
134
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
135
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" },
|
|
136
|
+
{ name: "rateMinRAY", type: "uint256", internalType: "uint256" }
|
|
137
|
+
],
|
|
138
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
139
|
+
stateMutability: "nonpayable"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: "function",
|
|
143
|
+
name: "redeemRequest",
|
|
144
|
+
inputs: [
|
|
145
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
146
|
+
{ name: "amountMTokenIn", type: "uint256", internalType: "uint256" },
|
|
147
|
+
{ name: "extraData", type: "bytes", internalType: "bytes" }
|
|
148
|
+
],
|
|
149
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
150
|
+
stateMutability: "nonpayable"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "function",
|
|
154
|
+
name: "redeemRequest",
|
|
155
|
+
inputs: [
|
|
156
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
157
|
+
{ name: "amountMTokenIn", type: "uint256", internalType: "uint256" }
|
|
158
|
+
],
|
|
159
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
160
|
+
stateMutability: "nonpayable"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: "function",
|
|
164
|
+
name: "redeemRequestDiff",
|
|
165
|
+
inputs: [
|
|
166
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
167
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" }
|
|
168
|
+
],
|
|
169
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
170
|
+
stateMutability: "nonpayable"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
type: "function",
|
|
174
|
+
name: "redeemRequestDiff",
|
|
175
|
+
inputs: [
|
|
176
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
177
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" },
|
|
178
|
+
{ name: "extraData", type: "bytes", internalType: "bytes" }
|
|
179
|
+
],
|
|
180
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
181
|
+
stateMutability: "nonpayable"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
type: "function",
|
|
185
|
+
name: "referrerId",
|
|
186
|
+
inputs: [],
|
|
187
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
188
|
+
stateMutability: "view"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: "function",
|
|
192
|
+
name: "serialize",
|
|
193
|
+
inputs: [],
|
|
194
|
+
outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
|
|
195
|
+
stateMutability: "view"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
type: "function",
|
|
199
|
+
name: "setInputTokenAllowedStatusBatch",
|
|
200
|
+
inputs: [
|
|
201
|
+
{ name: "tokens", type: "address[]", internalType: "address[]" },
|
|
202
|
+
{ name: "allowed", type: "bool[]", internalType: "bool[]" }
|
|
203
|
+
],
|
|
204
|
+
outputs: [],
|
|
205
|
+
stateMutability: "nonpayable"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: "function",
|
|
209
|
+
name: "setOutputTokenAllowedStatusBatch",
|
|
210
|
+
inputs: [
|
|
211
|
+
{
|
|
212
|
+
name: "configs",
|
|
213
|
+
type: "tuple[]",
|
|
214
|
+
internalType: "struct IMidasGatewayAdapter.MidasAllowedTokenStatus[]",
|
|
215
|
+
components: [
|
|
216
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
217
|
+
{ name: "phantomToken", type: "address", internalType: "address" },
|
|
218
|
+
{ name: "allowed", type: "bool", internalType: "bool" }
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
outputs: [],
|
|
223
|
+
stateMutability: "nonpayable"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: "function",
|
|
227
|
+
name: "targetContract",
|
|
228
|
+
inputs: [],
|
|
229
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
230
|
+
stateMutability: "view"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
type: "function",
|
|
234
|
+
name: "transferRedeemer",
|
|
235
|
+
inputs: [
|
|
236
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
237
|
+
{ name: "newAccount", type: "address", internalType: "address" }
|
|
238
|
+
],
|
|
239
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
240
|
+
stateMutability: "nonpayable"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: "function",
|
|
244
|
+
name: "version",
|
|
245
|
+
inputs: [],
|
|
246
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
247
|
+
stateMutability: "view"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
type: "function",
|
|
251
|
+
name: "withdraw",
|
|
252
|
+
inputs: [
|
|
253
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
254
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
255
|
+
],
|
|
256
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
257
|
+
stateMutability: "nonpayable"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: "function",
|
|
261
|
+
name: "withdrawFromRedeemer",
|
|
262
|
+
inputs: [
|
|
263
|
+
{ name: "redeemer", type: "address", internalType: "address" },
|
|
264
|
+
{ name: "tokenOut", type: "address", internalType: "address" },
|
|
265
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
266
|
+
],
|
|
267
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
268
|
+
stateMutability: "nonpayable"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
type: "function",
|
|
272
|
+
name: "withdrawPhantomToken",
|
|
273
|
+
inputs: [
|
|
274
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
275
|
+
{ name: "amount", type: "uint256", internalType: "uint256" }
|
|
276
|
+
],
|
|
277
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
278
|
+
stateMutability: "nonpayable"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: "event",
|
|
282
|
+
name: "SetInputTokenAllowedStatus",
|
|
283
|
+
inputs: [
|
|
284
|
+
{
|
|
285
|
+
name: "token",
|
|
286
|
+
type: "address",
|
|
287
|
+
indexed: true,
|
|
288
|
+
internalType: "address"
|
|
289
|
+
},
|
|
290
|
+
{ name: "allowed", type: "bool", indexed: false, internalType: "bool" }
|
|
291
|
+
],
|
|
292
|
+
anonymous: false
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
type: "event",
|
|
296
|
+
name: "SetOutputTokenAllowedStatus",
|
|
297
|
+
inputs: [
|
|
298
|
+
{
|
|
299
|
+
name: "token",
|
|
300
|
+
type: "address",
|
|
301
|
+
indexed: true,
|
|
302
|
+
internalType: "address"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "phantomToken",
|
|
306
|
+
type: "address",
|
|
307
|
+
indexed: true,
|
|
308
|
+
internalType: "address"
|
|
309
|
+
},
|
|
310
|
+
{ name: "allowed", type: "bool", indexed: false, internalType: "bool" }
|
|
311
|
+
],
|
|
312
|
+
anonymous: false
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
type: "error",
|
|
316
|
+
name: "AddressIsNotContractException",
|
|
317
|
+
inputs: [{ name: "", type: "address", internalType: "address" }]
|
|
318
|
+
},
|
|
319
|
+
{ type: "error", name: "CallerNotConfiguratorException", inputs: [] },
|
|
320
|
+
{ type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
|
|
321
|
+
{ type: "error", name: "IncorrectArrayLengthException", inputs: [] },
|
|
322
|
+
{ type: "error", name: "IncorrectStakedPhantomTokenException", inputs: [] },
|
|
323
|
+
{ type: "error", name: "NotImplementedException", inputs: [] },
|
|
324
|
+
{ type: "error", name: "PhantomTokenTokenOutMismatchException", inputs: [] },
|
|
325
|
+
{ type: "error", name: "TokenNotAllowedException", inputs: [] },
|
|
326
|
+
{ type: "error", name: "ZeroAddressException", inputs: [] }
|
|
327
|
+
];
|
|
328
|
+
export {
|
|
329
|
+
iMidasGatewayAdapterAbi
|
|
330
|
+
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const iSecuritizeRedemptionGatewayAdapterAbi = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "acl",
|
|
5
|
+
inputs: [],
|
|
6
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
7
|
+
stateMutability: "view"
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
type: "function",
|
|
4
11
|
name: "claim",
|
|
@@ -26,11 +33,11 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
|
|
|
26
33
|
type: "function",
|
|
27
34
|
name: "depositPhantomToken",
|
|
28
35
|
inputs: [
|
|
29
|
-
{ name: "
|
|
30
|
-
{ name: "
|
|
36
|
+
{ name: "", type: "address", internalType: "address" },
|
|
37
|
+
{ name: "", type: "uint256", internalType: "uint256" }
|
|
31
38
|
],
|
|
32
39
|
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
33
|
-
stateMutability: "
|
|
40
|
+
stateMutability: "view"
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
43
|
type: "function",
|
|
@@ -48,6 +55,26 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
|
|
|
48
55
|
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
49
56
|
stateMutability: "nonpayable"
|
|
50
57
|
},
|
|
58
|
+
{
|
|
59
|
+
type: "function",
|
|
60
|
+
name: "redeem",
|
|
61
|
+
inputs: [
|
|
62
|
+
{ name: "dsTokenAmount", type: "uint256", internalType: "uint256" },
|
|
63
|
+
{ name: "extraData", type: "bytes", internalType: "bytes" }
|
|
64
|
+
],
|
|
65
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
66
|
+
stateMutability: "nonpayable"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "function",
|
|
70
|
+
name: "redeemDiff",
|
|
71
|
+
inputs: [
|
|
72
|
+
{ name: "leftoverAmount", type: "uint256", internalType: "uint256" },
|
|
73
|
+
{ name: "extraData", type: "bytes", internalType: "bytes" }
|
|
74
|
+
],
|
|
75
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
76
|
+
stateMutability: "nonpayable"
|
|
77
|
+
},
|
|
51
78
|
{
|
|
52
79
|
type: "function",
|
|
53
80
|
name: "redeemDiff",
|
|
@@ -106,14 +133,22 @@ const iSecuritizeRedemptionGatewayAdapterAbi = [
|
|
|
106
133
|
type: "function",
|
|
107
134
|
name: "withdrawPhantomToken",
|
|
108
135
|
inputs: [
|
|
109
|
-
{ name: "
|
|
110
|
-
{ name: "
|
|
136
|
+
{ name: "", type: "address", internalType: "address" },
|
|
137
|
+
{ name: "", type: "uint256", internalType: "uint256" }
|
|
111
138
|
],
|
|
112
|
-
outputs: [{ name: "
|
|
113
|
-
stateMutability: "
|
|
139
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
140
|
+
stateMutability: "view"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "error",
|
|
144
|
+
name: "AddressIsNotContractException",
|
|
145
|
+
inputs: [{ name: "", type: "address", internalType: "address" }]
|
|
114
146
|
},
|
|
147
|
+
{ type: "error", name: "CallerNotCreditFacadeException", inputs: [] },
|
|
115
148
|
{ type: "error", name: "IncorrectStakedPhantomTokenException", inputs: [] },
|
|
116
|
-
{ type: "error", name: "InvalidRedemptionGatewayException", inputs: [] }
|
|
149
|
+
{ type: "error", name: "InvalidRedemptionGatewayException", inputs: [] },
|
|
150
|
+
{ type: "error", name: "NotImplementedException", inputs: [] },
|
|
151
|
+
{ type: "error", name: "ZeroAddressException", inputs: [] }
|
|
117
152
|
];
|
|
118
153
|
export {
|
|
119
154
|
iSecuritizeRedemptionGatewayAdapterAbi
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { decodeAbiParameters } from "viem";
|
|
2
|
+
import {
|
|
3
|
+
MissingSerializedParamsError
|
|
4
|
+
} from "../../../sdk/index.js";
|
|
5
|
+
import { iMidasGatewayAdapterAbi } from "../abi/index.js";
|
|
6
|
+
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
7
|
+
const abi = iMidasGatewayAdapterAbi;
|
|
8
|
+
const protocolAbi = iMidasGatewayAdapterAbi;
|
|
9
|
+
class MidasGatewayAdapterContract extends AbstractAdapterContract {
|
|
10
|
+
#gateway;
|
|
11
|
+
#mToken;
|
|
12
|
+
#referralId;
|
|
13
|
+
#allowedInputTokens;
|
|
14
|
+
#allowedTokens;
|
|
15
|
+
constructor(options, args) {
|
|
16
|
+
super(options, { ...args, abi, protocolAbi });
|
|
17
|
+
if (args.baseParams.serializedParams) {
|
|
18
|
+
const decoded = decodeAbiParameters(
|
|
19
|
+
[
|
|
20
|
+
{ type: "address", name: "creditManager" },
|
|
21
|
+
{ type: "address", name: "targetContract" },
|
|
22
|
+
{ type: "address", name: "gateway" },
|
|
23
|
+
{ type: "address", name: "mToken" },
|
|
24
|
+
{ type: "bytes32", name: "referralId" },
|
|
25
|
+
{ type: "address[]", name: "allowedInputTokens" },
|
|
26
|
+
{ type: "address[]", name: "allowedOutputTokens" },
|
|
27
|
+
{ type: "address[]", name: "allowedPhantomTokens" }
|
|
28
|
+
],
|
|
29
|
+
args.baseParams.serializedParams
|
|
30
|
+
);
|
|
31
|
+
this.#gateway = decoded[2];
|
|
32
|
+
this.#mToken = decoded[3];
|
|
33
|
+
this.#referralId = decoded[4];
|
|
34
|
+
this.#allowedInputTokens = decoded[5].map((token) => token);
|
|
35
|
+
this.#allowedTokens = decoded[6].map((token, index) => ({
|
|
36
|
+
token,
|
|
37
|
+
phantomToken: decoded[7][index]
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get gateway() {
|
|
42
|
+
if (!this.#gateway) throw new MissingSerializedParamsError("gateway");
|
|
43
|
+
return this.#gateway;
|
|
44
|
+
}
|
|
45
|
+
get mToken() {
|
|
46
|
+
if (!this.#mToken) throw new MissingSerializedParamsError("mToken");
|
|
47
|
+
return this.#mToken;
|
|
48
|
+
}
|
|
49
|
+
get allowedTokens() {
|
|
50
|
+
if (!this.#allowedTokens)
|
|
51
|
+
throw new MissingSerializedParamsError("allowedTokens");
|
|
52
|
+
return this.#allowedTokens;
|
|
53
|
+
}
|
|
54
|
+
get referralId() {
|
|
55
|
+
if (!this.#referralId) throw new MissingSerializedParamsError("referralId");
|
|
56
|
+
return this.#referralId;
|
|
57
|
+
}
|
|
58
|
+
get allowedInputTokens() {
|
|
59
|
+
if (!this.#allowedInputTokens)
|
|
60
|
+
throw new MissingSerializedParamsError("allowedInputTokens");
|
|
61
|
+
return this.#allowedInputTokens;
|
|
62
|
+
}
|
|
63
|
+
stateHuman(raw) {
|
|
64
|
+
return {
|
|
65
|
+
...super.stateHuman(raw),
|
|
66
|
+
gateway: this.#gateway ? this.labelAddress(this.#gateway) : void 0,
|
|
67
|
+
mToken: this.#mToken ? this.labelAddress(this.#mToken) : void 0,
|
|
68
|
+
referralId: this.#referralId,
|
|
69
|
+
allowedInputTokens: this.#allowedInputTokens?.map(
|
|
70
|
+
(token) => this.labelAddress(token)
|
|
71
|
+
),
|
|
72
|
+
allowedTokens: this.#allowedTokens?.map((t) => ({
|
|
73
|
+
token: this.labelAddress(t.token),
|
|
74
|
+
phantomToken: this.labelAddress(t.phantomToken)
|
|
75
|
+
}))
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
MidasGatewayAdapterContract
|
|
81
|
+
};
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
VelodromeV2RouterAdapterContract,
|
|
41
41
|
WstETHV1AdapterContract
|
|
42
42
|
} from "./contracts/index.js";
|
|
43
|
+
import { MidasGatewayAdapterContract } from "./contracts/MidasGatewayAdapterContract.js";
|
|
43
44
|
import { SecuritizeOnRampAdapterContract } from "./contracts/SecuritizeOnRampAdapterContract.js";
|
|
44
45
|
import { SecuritizeRedemptionGatewayAdapterContract } from "./contracts/SecuritizeRedemptionGatewayAdapterContract.js";
|
|
45
46
|
import { SecuritizeSwapAdapterContract } from "./contracts/SecuritizeSwapAdapterContract.js";
|
|
@@ -108,6 +109,8 @@ function createAdapter(options, data, strict) {
|
|
|
108
109
|
return new MidasIssuanceVaultAdapterContract(options, data);
|
|
109
110
|
case "ADAPTER::MIDAS_REDEMPTION_VAULT":
|
|
110
111
|
return new MidasRedemptionVaultAdapterContract(options, data);
|
|
112
|
+
case "ADAPTER::MIDAS_GATEWAY":
|
|
113
|
+
return new MidasGatewayAdapterContract(options, data);
|
|
111
114
|
case "ADAPTER::PENDLE_ROUTER":
|
|
112
115
|
return new PendleRouterAdapterContract(options, data);
|
|
113
116
|
case "ADAPTER::SECURITIZE_ONRAMP":
|
|
@@ -34,6 +34,7 @@ var AdapterType = /* @__PURE__ */ ((AdapterType2) => {
|
|
|
34
34
|
AdapterType2["MELLOW_REDEEM_QUEUE"] = "MELLOW_REDEEM_QUEUE";
|
|
35
35
|
AdapterType2["MIDAS_ISSUANCE_VAULT"] = "MIDAS_ISSUANCE_VAULT";
|
|
36
36
|
AdapterType2["MIDAS_REDEMPTION_VAULT"] = "MIDAS_REDEMPTION_VAULT";
|
|
37
|
+
AdapterType2["MIDAS_GATEWAY"] = "MIDAS_GATEWAY";
|
|
37
38
|
AdapterType2["PENDLE_ROUTER"] = "PENDLE_ROUTER";
|
|
38
39
|
AdapterType2["SECURITIZE_ONRAMP"] = "SECURITIZE_ONRAMP";
|
|
39
40
|
AdapterType2["SECURITIZE_REDEMPTION"] = "SECURITIZE_REDEMPTION";
|
|
@@ -6,7 +6,7 @@ import { AdapterType, type VersionedAbi } from "../types.js";
|
|
|
6
6
|
* These ABIs correspond to the constructor parameters used in each adapter's getDeployParams method
|
|
7
7
|
* Based on the actual encodeAbiParameters calls in the adapter implementations
|
|
8
8
|
*/
|
|
9
|
-
export declare const adapterActionSignatures: PartialRecord<AdapterType, Record<number, string>>;
|
|
9
|
+
export declare const adapterActionSignatures: PartialRecord<AdapterType, Record<number, string | string[]>>;
|
|
10
10
|
/**
|
|
11
11
|
* Mapping of adapter types to their parsed ABIs
|
|
12
12
|
*/
|