@gearbox-protocol/sdk 14.8.6 → 14.9.0
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/IWithdrawalCompressorV311.js +315 -0
- package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +3 -4
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +3 -2
- package/dist/cjs/sdk/OnchainSDK.js +2 -2
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +13 -6
- package/dist/cjs/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/abi/IWithdrawalCompressorV311.js +291 -0
- package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +3 -4
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +3 -2
- package/dist/esm/sdk/OnchainSDK.js +2 -2
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +13 -6
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/abi/IWithdrawalCompressorV311.d.ts +327 -0
- package/dist/types/common-utils/utils/strategies/types/strategy.d.ts +1 -1
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +10 -2
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var IWithdrawalCompressorV311_exports = {};
|
|
20
|
+
__export(IWithdrawalCompressorV311_exports, {
|
|
21
|
+
iWithdrawalCompressorV311Abi: () => iWithdrawalCompressorV311Abi
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(IWithdrawalCompressorV311_exports);
|
|
24
|
+
const iWithdrawalCompressorV311Abi = [
|
|
25
|
+
{
|
|
26
|
+
inputs: [
|
|
27
|
+
{ internalType: "address", name: "_owner", type: "address" },
|
|
28
|
+
{ internalType: "address", name: "addressProvider_", type: "address" }
|
|
29
|
+
],
|
|
30
|
+
stateMutability: "nonpayable",
|
|
31
|
+
type: "constructor"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
anonymous: false,
|
|
35
|
+
inputs: [
|
|
36
|
+
{
|
|
37
|
+
indexed: true,
|
|
38
|
+
internalType: "address",
|
|
39
|
+
name: "previousOwner",
|
|
40
|
+
type: "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
indexed: true,
|
|
44
|
+
internalType: "address",
|
|
45
|
+
name: "newOwner",
|
|
46
|
+
type: "address"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
name: "OwnershipTransferred",
|
|
50
|
+
type: "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
inputs: [],
|
|
54
|
+
name: "addressProvider",
|
|
55
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
56
|
+
stateMutability: "view",
|
|
57
|
+
type: "function"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
61
|
+
name: "compressorTypeToCompressor",
|
|
62
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
63
|
+
stateMutability: "view",
|
|
64
|
+
type: "function"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
inputs: [],
|
|
68
|
+
name: "contractType",
|
|
69
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
70
|
+
stateMutability: "view",
|
|
71
|
+
type: "function"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
inputs: [
|
|
75
|
+
{ internalType: "address", name: "creditAccount", type: "address" }
|
|
76
|
+
],
|
|
77
|
+
name: "getCurrentWithdrawals",
|
|
78
|
+
outputs: [
|
|
79
|
+
{
|
|
80
|
+
components: [
|
|
81
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
82
|
+
{
|
|
83
|
+
internalType: "address",
|
|
84
|
+
name: "withdrawalPhantomToken",
|
|
85
|
+
type: "address"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
internalType: "uint256",
|
|
89
|
+
name: "withdrawalTokenSpent",
|
|
90
|
+
type: "uint256"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
components: [
|
|
94
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
95
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
96
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
97
|
+
],
|
|
98
|
+
internalType: "struct WithdrawalOutput[]",
|
|
99
|
+
name: "outputs",
|
|
100
|
+
type: "tuple[]"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
components: [
|
|
104
|
+
{ internalType: "address", name: "target", type: "address" },
|
|
105
|
+
{ internalType: "bytes", name: "callData", type: "bytes" }
|
|
106
|
+
],
|
|
107
|
+
internalType: "struct MultiCall[]",
|
|
108
|
+
name: "claimCalls",
|
|
109
|
+
type: "tuple[]"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
internalType: "struct ClaimableWithdrawal[]",
|
|
113
|
+
name: "",
|
|
114
|
+
type: "tuple[]"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
components: [
|
|
118
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
119
|
+
{
|
|
120
|
+
internalType: "address",
|
|
121
|
+
name: "withdrawalPhantomToken",
|
|
122
|
+
type: "address"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
components: [
|
|
126
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
127
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
128
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
129
|
+
],
|
|
130
|
+
internalType: "struct WithdrawalOutput[]",
|
|
131
|
+
name: "expectedOutputs",
|
|
132
|
+
type: "tuple[]"
|
|
133
|
+
},
|
|
134
|
+
{ internalType: "uint256", name: "claimableAt", type: "uint256" }
|
|
135
|
+
],
|
|
136
|
+
internalType: "struct PendingWithdrawal[]",
|
|
137
|
+
name: "",
|
|
138
|
+
type: "tuple[]"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
stateMutability: "view",
|
|
142
|
+
type: "function"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
inputs: [
|
|
146
|
+
{ internalType: "address", name: "creditManager", type: "address" }
|
|
147
|
+
],
|
|
148
|
+
name: "getWithdrawableAssets",
|
|
149
|
+
outputs: [
|
|
150
|
+
{
|
|
151
|
+
components: [
|
|
152
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
153
|
+
{
|
|
154
|
+
internalType: "address",
|
|
155
|
+
name: "withdrawalPhantomToken",
|
|
156
|
+
type: "address"
|
|
157
|
+
},
|
|
158
|
+
{ internalType: "address", name: "underlying", type: "address" },
|
|
159
|
+
{
|
|
160
|
+
internalType: "uint256",
|
|
161
|
+
name: "withdrawalLength",
|
|
162
|
+
type: "uint256"
|
|
163
|
+
},
|
|
164
|
+
{ internalType: "uint256", name: "maxWithdrawals", type: "uint256" }
|
|
165
|
+
],
|
|
166
|
+
internalType: "struct WithdrawableAsset[]",
|
|
167
|
+
name: "",
|
|
168
|
+
type: "tuple[]"
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
stateMutability: "view",
|
|
172
|
+
type: "function"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
inputs: [
|
|
176
|
+
{ internalType: "address", name: "creditAccount", type: "address" },
|
|
177
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
178
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
179
|
+
],
|
|
180
|
+
name: "getWithdrawalRequestResult",
|
|
181
|
+
outputs: [
|
|
182
|
+
{
|
|
183
|
+
components: [
|
|
184
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
185
|
+
{ internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
186
|
+
{
|
|
187
|
+
components: [
|
|
188
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
189
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
190
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
191
|
+
],
|
|
192
|
+
internalType: "struct WithdrawalOutput[]",
|
|
193
|
+
name: "outputs",
|
|
194
|
+
type: "tuple[]"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
components: [
|
|
198
|
+
{ internalType: "address", name: "target", type: "address" },
|
|
199
|
+
{ internalType: "bytes", name: "callData", type: "bytes" }
|
|
200
|
+
],
|
|
201
|
+
internalType: "struct MultiCall[]",
|
|
202
|
+
name: "requestCalls",
|
|
203
|
+
type: "tuple[]"
|
|
204
|
+
},
|
|
205
|
+
{ internalType: "uint256", name: "claimableAt", type: "uint256" }
|
|
206
|
+
],
|
|
207
|
+
internalType: "struct RequestableWithdrawal",
|
|
208
|
+
name: "withdrawal",
|
|
209
|
+
type: "tuple"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
stateMutability: "view",
|
|
213
|
+
type: "function"
|
|
214
|
+
},
|
|
215
|
+
// {
|
|
216
|
+
// inputs: [
|
|
217
|
+
// { internalType: "address", name: "creditAccount", type: "address" },
|
|
218
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
219
|
+
// { internalType: "address", name: "withdrawalToken", type: "address" },
|
|
220
|
+
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
221
|
+
// ],
|
|
222
|
+
// name: "getWithdrawalRequestResult",
|
|
223
|
+
// outputs: [
|
|
224
|
+
// {
|
|
225
|
+
// components: [
|
|
226
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
227
|
+
// { internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
228
|
+
// {
|
|
229
|
+
// components: [
|
|
230
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
231
|
+
// { internalType: "bool", name: "isDelayed", type: "bool" },
|
|
232
|
+
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
233
|
+
// ],
|
|
234
|
+
// internalType: "struct WithdrawalOutput[]",
|
|
235
|
+
// name: "outputs",
|
|
236
|
+
// type: "tuple[]",
|
|
237
|
+
// },
|
|
238
|
+
// {
|
|
239
|
+
// components: [
|
|
240
|
+
// { internalType: "address", name: "target", type: "address" },
|
|
241
|
+
// { internalType: "bytes", name: "callData", type: "bytes" },
|
|
242
|
+
// ],
|
|
243
|
+
// internalType: "struct MultiCall[]",
|
|
244
|
+
// name: "requestCalls",
|
|
245
|
+
// type: "tuple[]",
|
|
246
|
+
// },
|
|
247
|
+
// { internalType: "uint256", name: "claimableAt", type: "uint256" },
|
|
248
|
+
// ],
|
|
249
|
+
// internalType: "struct RequestableWithdrawal",
|
|
250
|
+
// name: "withdrawal",
|
|
251
|
+
// type: "tuple",
|
|
252
|
+
// },
|
|
253
|
+
// ],
|
|
254
|
+
// stateMutability: "view",
|
|
255
|
+
// type: "function",
|
|
256
|
+
// },
|
|
257
|
+
{
|
|
258
|
+
inputs: [],
|
|
259
|
+
name: "owner",
|
|
260
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
261
|
+
stateMutability: "view",
|
|
262
|
+
type: "function"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
inputs: [],
|
|
266
|
+
name: "renounceOwnership",
|
|
267
|
+
outputs: [],
|
|
268
|
+
stateMutability: "nonpayable",
|
|
269
|
+
type: "function"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
inputs: [
|
|
273
|
+
{ internalType: "address", name: "subcompressor", type: "address" }
|
|
274
|
+
],
|
|
275
|
+
name: "setSubcompressor",
|
|
276
|
+
outputs: [],
|
|
277
|
+
stateMutability: "nonpayable",
|
|
278
|
+
type: "function"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
inputs: [
|
|
282
|
+
{ internalType: "bytes32", name: "withdrawableType", type: "bytes32" },
|
|
283
|
+
{ internalType: "bytes32", name: "compressorType", type: "bytes32" }
|
|
284
|
+
],
|
|
285
|
+
name: "setWithdrawableTypeToCompressorType",
|
|
286
|
+
outputs: [],
|
|
287
|
+
stateMutability: "nonpayable",
|
|
288
|
+
type: "function"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
292
|
+
name: "transferOwnership",
|
|
293
|
+
outputs: [],
|
|
294
|
+
stateMutability: "nonpayable",
|
|
295
|
+
type: "function"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
inputs: [],
|
|
299
|
+
name: "version",
|
|
300
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
301
|
+
stateMutability: "view",
|
|
302
|
+
type: "function"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
306
|
+
name: "withdrawableTypeToCompressorType",
|
|
307
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
308
|
+
stateMutability: "view",
|
|
309
|
+
type: "function"
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
313
|
+
0 && (module.exports = {
|
|
314
|
+
iWithdrawalCompressorV311Abi
|
|
315
|
+
});
|
|
@@ -35,13 +35,12 @@ function getReleasedStrategiesListCore({
|
|
|
35
35
|
(acc, s) => {
|
|
36
36
|
const network = s.chainId !== void 0 ? allowedChains[s.chainId] : void 0;
|
|
37
37
|
const isNetworkCorrect = !!network && network === s.network;
|
|
38
|
-
const isHidden = !showHiddenStrategies && s.hideInProd;
|
|
38
|
+
const isHidden = !showHiddenStrategies && !!s.hideInProd;
|
|
39
39
|
const showInMainApp = s.showInMainApp ?? true;
|
|
40
|
-
const showCondition = curatorFilter || showInMainApp;
|
|
41
|
-
if (isNetworkCorrect && !isHidden &&
|
|
40
|
+
const showCondition = !!curatorFilter || showInMainApp;
|
|
41
|
+
if (isNetworkCorrect && !isHidden && showCondition) {
|
|
42
42
|
acc.push({
|
|
43
43
|
...s,
|
|
44
|
-
id: s.tokenOutAddress,
|
|
45
44
|
network
|
|
46
45
|
});
|
|
47
46
|
}
|
|
@@ -22,6 +22,7 @@ __export(DelayedWithdrawalPlugin_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DelayedWithdrawalPlugin_exports);
|
|
24
24
|
var import_IWithdrawalCompressorV310 = require("../../abi/IWithdrawalCompressorV310.js");
|
|
25
|
+
var import_IWithdrawalCompressorV311 = require("../../abi/IWithdrawalCompressorV311.js");
|
|
25
26
|
var import_sdk = require("../../sdk/index.js");
|
|
26
27
|
const MAP_LABEL = "delayedWithdrawal";
|
|
27
28
|
class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
@@ -38,8 +39,8 @@ class DelayedWithdrawalPlugin extends import_sdk.BasePlugin {
|
|
|
38
39
|
const resp = await this.client.multicall({
|
|
39
40
|
contracts: compressor ? creditManagers.map(
|
|
40
41
|
(cm) => ({
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
address: compressor.address,
|
|
43
|
+
abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
|
|
43
44
|
functionName: "getWithdrawableAssets",
|
|
44
45
|
args: [cm.creditManager.address]
|
|
45
46
|
})
|
|
@@ -150,12 +150,12 @@ class OnchainSDK extends import_base.ChainContractsRegister {
|
|
|
150
150
|
);
|
|
151
151
|
this.#currentBlock = block.number;
|
|
152
152
|
this.#timestamp = block.timestamp;
|
|
153
|
-
if (
|
|
153
|
+
if (blockNumber && !redstone?.historicTimestamp && time - Number(block.timestamp) * 1e3 > 60 * 1e3) {
|
|
154
154
|
this.logger?.warn(
|
|
155
155
|
"attaching to fixed block number, but redstone historicTimestamp is not set. price updates might fail"
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
|
-
if (
|
|
158
|
+
if (blockNumber && !pyth?.historicTimestamp && time - Number(block.timestamp) * 1e3 > 60 * 1e3) {
|
|
159
159
|
this.logger?.warn(
|
|
160
160
|
"attaching to fixed block number, but pyth historicTimestamp is not set. price updates might fail"
|
|
161
161
|
);
|
|
@@ -29,6 +29,7 @@ var import_creditAccountCompressor = require("../../abi/compressors/creditAccoun
|
|
|
29
29
|
var import_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
30
30
|
var import_rewardsCompressor = require("../../abi/compressors/rewardsCompressor.js");
|
|
31
31
|
var import_IWithdrawalCompressorV310 = require("../../abi/IWithdrawalCompressorV310.js");
|
|
32
|
+
var import_IWithdrawalCompressorV311 = require("../../abi/IWithdrawalCompressorV311.js");
|
|
32
33
|
var import_iBaseRewardPool = require("../../abi/iBaseRewardPool.js");
|
|
33
34
|
var import_iRWAFactory = require("../../abi/rwa/iRWAFactory.js");
|
|
34
35
|
var import_base = require("../base/index.js");
|
|
@@ -40,8 +41,14 @@ var import_utils = require("../utils/index.js");
|
|
|
40
41
|
var import_viem2 = require("../utils/viem/index.js");
|
|
41
42
|
var import_multicall_utils = require("./multicall-utils.js");
|
|
42
43
|
const COMPRESSORS = {
|
|
43
|
-
[import_chains.chains.Mainnet.id]:
|
|
44
|
-
|
|
44
|
+
[import_chains.chains.Mainnet.id]: {
|
|
45
|
+
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
46
|
+
version: 310
|
|
47
|
+
},
|
|
48
|
+
[import_chains.chains.Monad.id]: {
|
|
49
|
+
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
50
|
+
version: 310
|
|
51
|
+
}
|
|
45
52
|
};
|
|
46
53
|
function getWithdrawalCompressorAddress(chainId) {
|
|
47
54
|
return COMPRESSORS[chainId];
|
|
@@ -778,8 +785,8 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
778
785
|
`No compressor for current chain ${this.sdk.networkType}`
|
|
779
786
|
);
|
|
780
787
|
const contract = (0, import_viem.getContract)({
|
|
781
|
-
address: compressor,
|
|
782
|
-
abi: import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi,
|
|
788
|
+
address: compressor.address,
|
|
789
|
+
abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
|
|
783
790
|
client: this.client
|
|
784
791
|
});
|
|
785
792
|
const resp = await contract.read.getWithdrawalRequestResult([
|
|
@@ -801,8 +808,8 @@ class CreditAccountsServiceV310 extends import_base.SDKConstruct {
|
|
|
801
808
|
`No compressor for current chain ${this.sdk.networkType}`
|
|
802
809
|
);
|
|
803
810
|
const contract = (0, import_viem.getContract)({
|
|
804
|
-
address: compressor,
|
|
805
|
-
abi: import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi,
|
|
811
|
+
address: compressor.address,
|
|
812
|
+
abi: compressor.version === 310 ? import_IWithdrawalCompressorV310.iWithdrawalCompressorV310Abi : import_IWithdrawalCompressorV311.iWithdrawalCompressorV311Abi,
|
|
806
813
|
client: this.client
|
|
807
814
|
});
|
|
808
815
|
const resp = await contract.read.getCurrentWithdrawals([creditAccount]);
|
|
@@ -131,7 +131,7 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
131
131
|
const r = multicallResults[1];
|
|
132
132
|
if (r.status === "success") {
|
|
133
133
|
const fromMc = BigInt(r.result);
|
|
134
|
-
if (
|
|
134
|
+
if (r.result && fromMc !== parameters.blockNumber) {
|
|
135
135
|
throw getSimulateWithPriceUpdatesError(
|
|
136
136
|
new import_viem.BaseError(
|
|
137
137
|
`block number returned from multicall (${fromMc}) is different from the one provided (${parameters.blockNumber})`
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
const iWithdrawalCompressorV311Abi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{ internalType: "address", name: "_owner", type: "address" },
|
|
5
|
+
{ internalType: "address", name: "addressProvider_", type: "address" }
|
|
6
|
+
],
|
|
7
|
+
stateMutability: "nonpayable",
|
|
8
|
+
type: "constructor"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
anonymous: false,
|
|
12
|
+
inputs: [
|
|
13
|
+
{
|
|
14
|
+
indexed: true,
|
|
15
|
+
internalType: "address",
|
|
16
|
+
name: "previousOwner",
|
|
17
|
+
type: "address"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
indexed: true,
|
|
21
|
+
internalType: "address",
|
|
22
|
+
name: "newOwner",
|
|
23
|
+
type: "address"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
name: "OwnershipTransferred",
|
|
27
|
+
type: "event"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
inputs: [],
|
|
31
|
+
name: "addressProvider",
|
|
32
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
33
|
+
stateMutability: "view",
|
|
34
|
+
type: "function"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
38
|
+
name: "compressorTypeToCompressor",
|
|
39
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
40
|
+
stateMutability: "view",
|
|
41
|
+
type: "function"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
inputs: [],
|
|
45
|
+
name: "contractType",
|
|
46
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
47
|
+
stateMutability: "view",
|
|
48
|
+
type: "function"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
inputs: [
|
|
52
|
+
{ internalType: "address", name: "creditAccount", type: "address" }
|
|
53
|
+
],
|
|
54
|
+
name: "getCurrentWithdrawals",
|
|
55
|
+
outputs: [
|
|
56
|
+
{
|
|
57
|
+
components: [
|
|
58
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
59
|
+
{
|
|
60
|
+
internalType: "address",
|
|
61
|
+
name: "withdrawalPhantomToken",
|
|
62
|
+
type: "address"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
internalType: "uint256",
|
|
66
|
+
name: "withdrawalTokenSpent",
|
|
67
|
+
type: "uint256"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
components: [
|
|
71
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
72
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
73
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
74
|
+
],
|
|
75
|
+
internalType: "struct WithdrawalOutput[]",
|
|
76
|
+
name: "outputs",
|
|
77
|
+
type: "tuple[]"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
components: [
|
|
81
|
+
{ internalType: "address", name: "target", type: "address" },
|
|
82
|
+
{ internalType: "bytes", name: "callData", type: "bytes" }
|
|
83
|
+
],
|
|
84
|
+
internalType: "struct MultiCall[]",
|
|
85
|
+
name: "claimCalls",
|
|
86
|
+
type: "tuple[]"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
internalType: "struct ClaimableWithdrawal[]",
|
|
90
|
+
name: "",
|
|
91
|
+
type: "tuple[]"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
components: [
|
|
95
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
96
|
+
{
|
|
97
|
+
internalType: "address",
|
|
98
|
+
name: "withdrawalPhantomToken",
|
|
99
|
+
type: "address"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
components: [
|
|
103
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
104
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
105
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
106
|
+
],
|
|
107
|
+
internalType: "struct WithdrawalOutput[]",
|
|
108
|
+
name: "expectedOutputs",
|
|
109
|
+
type: "tuple[]"
|
|
110
|
+
},
|
|
111
|
+
{ internalType: "uint256", name: "claimableAt", type: "uint256" }
|
|
112
|
+
],
|
|
113
|
+
internalType: "struct PendingWithdrawal[]",
|
|
114
|
+
name: "",
|
|
115
|
+
type: "tuple[]"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
stateMutability: "view",
|
|
119
|
+
type: "function"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
inputs: [
|
|
123
|
+
{ internalType: "address", name: "creditManager", type: "address" }
|
|
124
|
+
],
|
|
125
|
+
name: "getWithdrawableAssets",
|
|
126
|
+
outputs: [
|
|
127
|
+
{
|
|
128
|
+
components: [
|
|
129
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
130
|
+
{
|
|
131
|
+
internalType: "address",
|
|
132
|
+
name: "withdrawalPhantomToken",
|
|
133
|
+
type: "address"
|
|
134
|
+
},
|
|
135
|
+
{ internalType: "address", name: "underlying", type: "address" },
|
|
136
|
+
{
|
|
137
|
+
internalType: "uint256",
|
|
138
|
+
name: "withdrawalLength",
|
|
139
|
+
type: "uint256"
|
|
140
|
+
},
|
|
141
|
+
{ internalType: "uint256", name: "maxWithdrawals", type: "uint256" }
|
|
142
|
+
],
|
|
143
|
+
internalType: "struct WithdrawableAsset[]",
|
|
144
|
+
name: "",
|
|
145
|
+
type: "tuple[]"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
stateMutability: "view",
|
|
149
|
+
type: "function"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
inputs: [
|
|
153
|
+
{ internalType: "address", name: "creditAccount", type: "address" },
|
|
154
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
155
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
156
|
+
],
|
|
157
|
+
name: "getWithdrawalRequestResult",
|
|
158
|
+
outputs: [
|
|
159
|
+
{
|
|
160
|
+
components: [
|
|
161
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
162
|
+
{ internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
163
|
+
{
|
|
164
|
+
components: [
|
|
165
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
166
|
+
{ internalType: "bool", name: "isDelayed", type: "bool" },
|
|
167
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
168
|
+
],
|
|
169
|
+
internalType: "struct WithdrawalOutput[]",
|
|
170
|
+
name: "outputs",
|
|
171
|
+
type: "tuple[]"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
components: [
|
|
175
|
+
{ internalType: "address", name: "target", type: "address" },
|
|
176
|
+
{ internalType: "bytes", name: "callData", type: "bytes" }
|
|
177
|
+
],
|
|
178
|
+
internalType: "struct MultiCall[]",
|
|
179
|
+
name: "requestCalls",
|
|
180
|
+
type: "tuple[]"
|
|
181
|
+
},
|
|
182
|
+
{ internalType: "uint256", name: "claimableAt", type: "uint256" }
|
|
183
|
+
],
|
|
184
|
+
internalType: "struct RequestableWithdrawal",
|
|
185
|
+
name: "withdrawal",
|
|
186
|
+
type: "tuple"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
stateMutability: "view",
|
|
190
|
+
type: "function"
|
|
191
|
+
},
|
|
192
|
+
// {
|
|
193
|
+
// inputs: [
|
|
194
|
+
// { internalType: "address", name: "creditAccount", type: "address" },
|
|
195
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
196
|
+
// { internalType: "address", name: "withdrawalToken", type: "address" },
|
|
197
|
+
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
198
|
+
// ],
|
|
199
|
+
// name: "getWithdrawalRequestResult",
|
|
200
|
+
// outputs: [
|
|
201
|
+
// {
|
|
202
|
+
// components: [
|
|
203
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
204
|
+
// { internalType: "uint256", name: "amountIn", type: "uint256" },
|
|
205
|
+
// {
|
|
206
|
+
// components: [
|
|
207
|
+
// { internalType: "address", name: "token", type: "address" },
|
|
208
|
+
// { internalType: "bool", name: "isDelayed", type: "bool" },
|
|
209
|
+
// { internalType: "uint256", name: "amount", type: "uint256" },
|
|
210
|
+
// ],
|
|
211
|
+
// internalType: "struct WithdrawalOutput[]",
|
|
212
|
+
// name: "outputs",
|
|
213
|
+
// type: "tuple[]",
|
|
214
|
+
// },
|
|
215
|
+
// {
|
|
216
|
+
// components: [
|
|
217
|
+
// { internalType: "address", name: "target", type: "address" },
|
|
218
|
+
// { internalType: "bytes", name: "callData", type: "bytes" },
|
|
219
|
+
// ],
|
|
220
|
+
// internalType: "struct MultiCall[]",
|
|
221
|
+
// name: "requestCalls",
|
|
222
|
+
// type: "tuple[]",
|
|
223
|
+
// },
|
|
224
|
+
// { internalType: "uint256", name: "claimableAt", type: "uint256" },
|
|
225
|
+
// ],
|
|
226
|
+
// internalType: "struct RequestableWithdrawal",
|
|
227
|
+
// name: "withdrawal",
|
|
228
|
+
// type: "tuple",
|
|
229
|
+
// },
|
|
230
|
+
// ],
|
|
231
|
+
// stateMutability: "view",
|
|
232
|
+
// type: "function",
|
|
233
|
+
// },
|
|
234
|
+
{
|
|
235
|
+
inputs: [],
|
|
236
|
+
name: "owner",
|
|
237
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
238
|
+
stateMutability: "view",
|
|
239
|
+
type: "function"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
inputs: [],
|
|
243
|
+
name: "renounceOwnership",
|
|
244
|
+
outputs: [],
|
|
245
|
+
stateMutability: "nonpayable",
|
|
246
|
+
type: "function"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
inputs: [
|
|
250
|
+
{ internalType: "address", name: "subcompressor", type: "address" }
|
|
251
|
+
],
|
|
252
|
+
name: "setSubcompressor",
|
|
253
|
+
outputs: [],
|
|
254
|
+
stateMutability: "nonpayable",
|
|
255
|
+
type: "function"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
inputs: [
|
|
259
|
+
{ internalType: "bytes32", name: "withdrawableType", type: "bytes32" },
|
|
260
|
+
{ internalType: "bytes32", name: "compressorType", type: "bytes32" }
|
|
261
|
+
],
|
|
262
|
+
name: "setWithdrawableTypeToCompressorType",
|
|
263
|
+
outputs: [],
|
|
264
|
+
stateMutability: "nonpayable",
|
|
265
|
+
type: "function"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
269
|
+
name: "transferOwnership",
|
|
270
|
+
outputs: [],
|
|
271
|
+
stateMutability: "nonpayable",
|
|
272
|
+
type: "function"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
inputs: [],
|
|
276
|
+
name: "version",
|
|
277
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
278
|
+
stateMutability: "view",
|
|
279
|
+
type: "function"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
283
|
+
name: "withdrawableTypeToCompressorType",
|
|
284
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
285
|
+
stateMutability: "view",
|
|
286
|
+
type: "function"
|
|
287
|
+
}
|
|
288
|
+
];
|
|
289
|
+
export {
|
|
290
|
+
iWithdrawalCompressorV311Abi
|
|
291
|
+
};
|
|
@@ -12,13 +12,12 @@ function getReleasedStrategiesListCore({
|
|
|
12
12
|
(acc, s) => {
|
|
13
13
|
const network = s.chainId !== void 0 ? allowedChains[s.chainId] : void 0;
|
|
14
14
|
const isNetworkCorrect = !!network && network === s.network;
|
|
15
|
-
const isHidden = !showHiddenStrategies && s.hideInProd;
|
|
15
|
+
const isHidden = !showHiddenStrategies && !!s.hideInProd;
|
|
16
16
|
const showInMainApp = s.showInMainApp ?? true;
|
|
17
|
-
const showCondition = curatorFilter || showInMainApp;
|
|
18
|
-
if (isNetworkCorrect && !isHidden &&
|
|
17
|
+
const showCondition = !!curatorFilter || showInMainApp;
|
|
18
|
+
if (isNetworkCorrect && !isHidden && showCondition) {
|
|
19
19
|
acc.push({
|
|
20
20
|
...s,
|
|
21
|
-
id: s.tokenOutAddress,
|
|
22
21
|
network
|
|
23
22
|
});
|
|
24
23
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
2
|
+
import { iWithdrawalCompressorV311Abi } from "../../abi/IWithdrawalCompressorV311.js";
|
|
2
3
|
import {
|
|
3
4
|
AddressMap,
|
|
4
5
|
BasePlugin,
|
|
@@ -19,8 +20,8 @@ class DelayedWithdrawalPlugin extends BasePlugin {
|
|
|
19
20
|
const resp = await this.client.multicall({
|
|
20
21
|
contracts: compressor ? creditManagers.map(
|
|
21
22
|
(cm) => ({
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
address: compressor.address,
|
|
24
|
+
abi: compressor.version === 310 ? iWithdrawalCompressorV310Abi : iWithdrawalCompressorV311Abi,
|
|
24
25
|
functionName: "getWithdrawableAssets",
|
|
25
26
|
args: [cm.creditManager.address]
|
|
26
27
|
})
|
|
@@ -149,12 +149,12 @@ class OnchainSDK extends ChainContractsRegister {
|
|
|
149
149
|
);
|
|
150
150
|
this.#currentBlock = block.number;
|
|
151
151
|
this.#timestamp = block.timestamp;
|
|
152
|
-
if (
|
|
152
|
+
if (blockNumber && !redstone?.historicTimestamp && time - Number(block.timestamp) * 1e3 > 60 * 1e3) {
|
|
153
153
|
this.logger?.warn(
|
|
154
154
|
"attaching to fixed block number, but redstone historicTimestamp is not set. price updates might fail"
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
|
-
if (
|
|
157
|
+
if (blockNumber && !pyth?.historicTimestamp && time - Number(block.timestamp) * 1e3 > 60 * 1e3) {
|
|
158
158
|
this.logger?.warn(
|
|
159
159
|
"attaching to fixed block number, but pyth historicTimestamp is not set. price updates might fail"
|
|
160
160
|
);
|
|
@@ -8,6 +8,7 @@ import { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountC
|
|
|
8
8
|
import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
9
9
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
10
10
|
import { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
11
|
+
import { iWithdrawalCompressorV311Abi } from "../../abi/IWithdrawalCompressorV311.js";
|
|
11
12
|
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
13
|
import { iRWAFactoryAbi } from "../../abi/rwa/iRWAFactory.js";
|
|
13
14
|
import { SDKConstruct } from "../base/index.js";
|
|
@@ -35,8 +36,14 @@ import {
|
|
|
35
36
|
mergePriceUpdates
|
|
36
37
|
} from "./multicall-utils.js";
|
|
37
38
|
const COMPRESSORS = {
|
|
38
|
-
[chains.Mainnet.id]:
|
|
39
|
-
|
|
39
|
+
[chains.Mainnet.id]: {
|
|
40
|
+
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
41
|
+
version: 310
|
|
42
|
+
},
|
|
43
|
+
[chains.Monad.id]: {
|
|
44
|
+
address: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
|
|
45
|
+
version: 310
|
|
46
|
+
}
|
|
40
47
|
};
|
|
41
48
|
function getWithdrawalCompressorAddress(chainId) {
|
|
42
49
|
return COMPRESSORS[chainId];
|
|
@@ -773,8 +780,8 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
773
780
|
`No compressor for current chain ${this.sdk.networkType}`
|
|
774
781
|
);
|
|
775
782
|
const contract = getContract({
|
|
776
|
-
address: compressor,
|
|
777
|
-
abi: iWithdrawalCompressorV310Abi,
|
|
783
|
+
address: compressor.address,
|
|
784
|
+
abi: compressor.version === 310 ? iWithdrawalCompressorV310Abi : iWithdrawalCompressorV311Abi,
|
|
778
785
|
client: this.client
|
|
779
786
|
});
|
|
780
787
|
const resp = await contract.read.getWithdrawalRequestResult([
|
|
@@ -796,8 +803,8 @@ class CreditAccountsServiceV310 extends SDKConstruct {
|
|
|
796
803
|
`No compressor for current chain ${this.sdk.networkType}`
|
|
797
804
|
);
|
|
798
805
|
const contract = getContract({
|
|
799
|
-
address: compressor,
|
|
800
|
-
abi: iWithdrawalCompressorV310Abi,
|
|
806
|
+
address: compressor.address,
|
|
807
|
+
abi: compressor.version === 310 ? iWithdrawalCompressorV310Abi : iWithdrawalCompressorV311Abi,
|
|
801
808
|
client: this.client
|
|
802
809
|
});
|
|
803
810
|
const resp = await contract.read.getCurrentWithdrawals([creditAccount]);
|
|
@@ -114,7 +114,7 @@ async function simulateWithPriceUpdates(client, parameters) {
|
|
|
114
114
|
const r = multicallResults[1];
|
|
115
115
|
if (r.status === "success") {
|
|
116
116
|
const fromMc = BigInt(r.result);
|
|
117
|
-
if (
|
|
117
|
+
if (r.result && fromMc !== parameters.blockNumber) {
|
|
118
118
|
throw getSimulateWithPriceUpdatesError(
|
|
119
119
|
new BaseError(
|
|
120
120
|
`block number returned from multicall (${fromMc}) is different from the one provided (${parameters.blockNumber})`
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
export declare const iWithdrawalCompressorV311Abi: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "_owner";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "address";
|
|
8
|
+
readonly name: "addressProvider_";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}];
|
|
11
|
+
readonly stateMutability: "nonpayable";
|
|
12
|
+
readonly type: "constructor";
|
|
13
|
+
}, {
|
|
14
|
+
readonly anonymous: false;
|
|
15
|
+
readonly inputs: readonly [{
|
|
16
|
+
readonly indexed: true;
|
|
17
|
+
readonly internalType: "address";
|
|
18
|
+
readonly name: "previousOwner";
|
|
19
|
+
readonly type: "address";
|
|
20
|
+
}, {
|
|
21
|
+
readonly indexed: true;
|
|
22
|
+
readonly internalType: "address";
|
|
23
|
+
readonly name: "newOwner";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}];
|
|
26
|
+
readonly name: "OwnershipTransferred";
|
|
27
|
+
readonly type: "event";
|
|
28
|
+
}, {
|
|
29
|
+
readonly inputs: readonly [];
|
|
30
|
+
readonly name: "addressProvider";
|
|
31
|
+
readonly outputs: readonly [{
|
|
32
|
+
readonly internalType: "address";
|
|
33
|
+
readonly name: "";
|
|
34
|
+
readonly type: "address";
|
|
35
|
+
}];
|
|
36
|
+
readonly stateMutability: "view";
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
}, {
|
|
39
|
+
readonly inputs: readonly [{
|
|
40
|
+
readonly internalType: "bytes32";
|
|
41
|
+
readonly name: "";
|
|
42
|
+
readonly type: "bytes32";
|
|
43
|
+
}];
|
|
44
|
+
readonly name: "compressorTypeToCompressor";
|
|
45
|
+
readonly outputs: readonly [{
|
|
46
|
+
readonly internalType: "address";
|
|
47
|
+
readonly name: "";
|
|
48
|
+
readonly type: "address";
|
|
49
|
+
}];
|
|
50
|
+
readonly stateMutability: "view";
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
}, {
|
|
53
|
+
readonly inputs: readonly [];
|
|
54
|
+
readonly name: "contractType";
|
|
55
|
+
readonly outputs: readonly [{
|
|
56
|
+
readonly internalType: "bytes32";
|
|
57
|
+
readonly name: "";
|
|
58
|
+
readonly type: "bytes32";
|
|
59
|
+
}];
|
|
60
|
+
readonly stateMutability: "view";
|
|
61
|
+
readonly type: "function";
|
|
62
|
+
}, {
|
|
63
|
+
readonly inputs: readonly [{
|
|
64
|
+
readonly internalType: "address";
|
|
65
|
+
readonly name: "creditAccount";
|
|
66
|
+
readonly type: "address";
|
|
67
|
+
}];
|
|
68
|
+
readonly name: "getCurrentWithdrawals";
|
|
69
|
+
readonly outputs: readonly [{
|
|
70
|
+
readonly components: readonly [{
|
|
71
|
+
readonly internalType: "address";
|
|
72
|
+
readonly name: "token";
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
}, {
|
|
75
|
+
readonly internalType: "address";
|
|
76
|
+
readonly name: "withdrawalPhantomToken";
|
|
77
|
+
readonly type: "address";
|
|
78
|
+
}, {
|
|
79
|
+
readonly internalType: "uint256";
|
|
80
|
+
readonly name: "withdrawalTokenSpent";
|
|
81
|
+
readonly type: "uint256";
|
|
82
|
+
}, {
|
|
83
|
+
readonly components: readonly [{
|
|
84
|
+
readonly internalType: "address";
|
|
85
|
+
readonly name: "token";
|
|
86
|
+
readonly type: "address";
|
|
87
|
+
}, {
|
|
88
|
+
readonly internalType: "bool";
|
|
89
|
+
readonly name: "isDelayed";
|
|
90
|
+
readonly type: "bool";
|
|
91
|
+
}, {
|
|
92
|
+
readonly internalType: "uint256";
|
|
93
|
+
readonly name: "amount";
|
|
94
|
+
readonly type: "uint256";
|
|
95
|
+
}];
|
|
96
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
97
|
+
readonly name: "outputs";
|
|
98
|
+
readonly type: "tuple[]";
|
|
99
|
+
}, {
|
|
100
|
+
readonly components: readonly [{
|
|
101
|
+
readonly internalType: "address";
|
|
102
|
+
readonly name: "target";
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
}, {
|
|
105
|
+
readonly internalType: "bytes";
|
|
106
|
+
readonly name: "callData";
|
|
107
|
+
readonly type: "bytes";
|
|
108
|
+
}];
|
|
109
|
+
readonly internalType: "struct MultiCall[]";
|
|
110
|
+
readonly name: "claimCalls";
|
|
111
|
+
readonly type: "tuple[]";
|
|
112
|
+
}];
|
|
113
|
+
readonly internalType: "struct ClaimableWithdrawal[]";
|
|
114
|
+
readonly name: "";
|
|
115
|
+
readonly type: "tuple[]";
|
|
116
|
+
}, {
|
|
117
|
+
readonly components: readonly [{
|
|
118
|
+
readonly internalType: "address";
|
|
119
|
+
readonly name: "token";
|
|
120
|
+
readonly type: "address";
|
|
121
|
+
}, {
|
|
122
|
+
readonly internalType: "address";
|
|
123
|
+
readonly name: "withdrawalPhantomToken";
|
|
124
|
+
readonly type: "address";
|
|
125
|
+
}, {
|
|
126
|
+
readonly components: readonly [{
|
|
127
|
+
readonly internalType: "address";
|
|
128
|
+
readonly name: "token";
|
|
129
|
+
readonly type: "address";
|
|
130
|
+
}, {
|
|
131
|
+
readonly internalType: "bool";
|
|
132
|
+
readonly name: "isDelayed";
|
|
133
|
+
readonly type: "bool";
|
|
134
|
+
}, {
|
|
135
|
+
readonly internalType: "uint256";
|
|
136
|
+
readonly name: "amount";
|
|
137
|
+
readonly type: "uint256";
|
|
138
|
+
}];
|
|
139
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
140
|
+
readonly name: "expectedOutputs";
|
|
141
|
+
readonly type: "tuple[]";
|
|
142
|
+
}, {
|
|
143
|
+
readonly internalType: "uint256";
|
|
144
|
+
readonly name: "claimableAt";
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
}];
|
|
147
|
+
readonly internalType: "struct PendingWithdrawal[]";
|
|
148
|
+
readonly name: "";
|
|
149
|
+
readonly type: "tuple[]";
|
|
150
|
+
}];
|
|
151
|
+
readonly stateMutability: "view";
|
|
152
|
+
readonly type: "function";
|
|
153
|
+
}, {
|
|
154
|
+
readonly inputs: readonly [{
|
|
155
|
+
readonly internalType: "address";
|
|
156
|
+
readonly name: "creditManager";
|
|
157
|
+
readonly type: "address";
|
|
158
|
+
}];
|
|
159
|
+
readonly name: "getWithdrawableAssets";
|
|
160
|
+
readonly outputs: readonly [{
|
|
161
|
+
readonly components: readonly [{
|
|
162
|
+
readonly internalType: "address";
|
|
163
|
+
readonly name: "token";
|
|
164
|
+
readonly type: "address";
|
|
165
|
+
}, {
|
|
166
|
+
readonly internalType: "address";
|
|
167
|
+
readonly name: "withdrawalPhantomToken";
|
|
168
|
+
readonly type: "address";
|
|
169
|
+
}, {
|
|
170
|
+
readonly internalType: "address";
|
|
171
|
+
readonly name: "underlying";
|
|
172
|
+
readonly type: "address";
|
|
173
|
+
}, {
|
|
174
|
+
readonly internalType: "uint256";
|
|
175
|
+
readonly name: "withdrawalLength";
|
|
176
|
+
readonly type: "uint256";
|
|
177
|
+
}, {
|
|
178
|
+
readonly internalType: "uint256";
|
|
179
|
+
readonly name: "maxWithdrawals";
|
|
180
|
+
readonly type: "uint256";
|
|
181
|
+
}];
|
|
182
|
+
readonly internalType: "struct WithdrawableAsset[]";
|
|
183
|
+
readonly name: "";
|
|
184
|
+
readonly type: "tuple[]";
|
|
185
|
+
}];
|
|
186
|
+
readonly stateMutability: "view";
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
}, {
|
|
189
|
+
readonly inputs: readonly [{
|
|
190
|
+
readonly internalType: "address";
|
|
191
|
+
readonly name: "creditAccount";
|
|
192
|
+
readonly type: "address";
|
|
193
|
+
}, {
|
|
194
|
+
readonly internalType: "address";
|
|
195
|
+
readonly name: "token";
|
|
196
|
+
readonly type: "address";
|
|
197
|
+
}, {
|
|
198
|
+
readonly internalType: "uint256";
|
|
199
|
+
readonly name: "amount";
|
|
200
|
+
readonly type: "uint256";
|
|
201
|
+
}];
|
|
202
|
+
readonly name: "getWithdrawalRequestResult";
|
|
203
|
+
readonly outputs: readonly [{
|
|
204
|
+
readonly components: readonly [{
|
|
205
|
+
readonly internalType: "address";
|
|
206
|
+
readonly name: "token";
|
|
207
|
+
readonly type: "address";
|
|
208
|
+
}, {
|
|
209
|
+
readonly internalType: "uint256";
|
|
210
|
+
readonly name: "amountIn";
|
|
211
|
+
readonly type: "uint256";
|
|
212
|
+
}, {
|
|
213
|
+
readonly components: readonly [{
|
|
214
|
+
readonly internalType: "address";
|
|
215
|
+
readonly name: "token";
|
|
216
|
+
readonly type: "address";
|
|
217
|
+
}, {
|
|
218
|
+
readonly internalType: "bool";
|
|
219
|
+
readonly name: "isDelayed";
|
|
220
|
+
readonly type: "bool";
|
|
221
|
+
}, {
|
|
222
|
+
readonly internalType: "uint256";
|
|
223
|
+
readonly name: "amount";
|
|
224
|
+
readonly type: "uint256";
|
|
225
|
+
}];
|
|
226
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
227
|
+
readonly name: "outputs";
|
|
228
|
+
readonly type: "tuple[]";
|
|
229
|
+
}, {
|
|
230
|
+
readonly components: readonly [{
|
|
231
|
+
readonly internalType: "address";
|
|
232
|
+
readonly name: "target";
|
|
233
|
+
readonly type: "address";
|
|
234
|
+
}, {
|
|
235
|
+
readonly internalType: "bytes";
|
|
236
|
+
readonly name: "callData";
|
|
237
|
+
readonly type: "bytes";
|
|
238
|
+
}];
|
|
239
|
+
readonly internalType: "struct MultiCall[]";
|
|
240
|
+
readonly name: "requestCalls";
|
|
241
|
+
readonly type: "tuple[]";
|
|
242
|
+
}, {
|
|
243
|
+
readonly internalType: "uint256";
|
|
244
|
+
readonly name: "claimableAt";
|
|
245
|
+
readonly type: "uint256";
|
|
246
|
+
}];
|
|
247
|
+
readonly internalType: "struct RequestableWithdrawal";
|
|
248
|
+
readonly name: "withdrawal";
|
|
249
|
+
readonly type: "tuple";
|
|
250
|
+
}];
|
|
251
|
+
readonly stateMutability: "view";
|
|
252
|
+
readonly type: "function";
|
|
253
|
+
}, {
|
|
254
|
+
readonly inputs: readonly [];
|
|
255
|
+
readonly name: "owner";
|
|
256
|
+
readonly outputs: readonly [{
|
|
257
|
+
readonly internalType: "address";
|
|
258
|
+
readonly name: "";
|
|
259
|
+
readonly type: "address";
|
|
260
|
+
}];
|
|
261
|
+
readonly stateMutability: "view";
|
|
262
|
+
readonly type: "function";
|
|
263
|
+
}, {
|
|
264
|
+
readonly inputs: readonly [];
|
|
265
|
+
readonly name: "renounceOwnership";
|
|
266
|
+
readonly outputs: readonly [];
|
|
267
|
+
readonly stateMutability: "nonpayable";
|
|
268
|
+
readonly type: "function";
|
|
269
|
+
}, {
|
|
270
|
+
readonly inputs: readonly [{
|
|
271
|
+
readonly internalType: "address";
|
|
272
|
+
readonly name: "subcompressor";
|
|
273
|
+
readonly type: "address";
|
|
274
|
+
}];
|
|
275
|
+
readonly name: "setSubcompressor";
|
|
276
|
+
readonly outputs: readonly [];
|
|
277
|
+
readonly stateMutability: "nonpayable";
|
|
278
|
+
readonly type: "function";
|
|
279
|
+
}, {
|
|
280
|
+
readonly inputs: readonly [{
|
|
281
|
+
readonly internalType: "bytes32";
|
|
282
|
+
readonly name: "withdrawableType";
|
|
283
|
+
readonly type: "bytes32";
|
|
284
|
+
}, {
|
|
285
|
+
readonly internalType: "bytes32";
|
|
286
|
+
readonly name: "compressorType";
|
|
287
|
+
readonly type: "bytes32";
|
|
288
|
+
}];
|
|
289
|
+
readonly name: "setWithdrawableTypeToCompressorType";
|
|
290
|
+
readonly outputs: readonly [];
|
|
291
|
+
readonly stateMutability: "nonpayable";
|
|
292
|
+
readonly type: "function";
|
|
293
|
+
}, {
|
|
294
|
+
readonly inputs: readonly [{
|
|
295
|
+
readonly internalType: "address";
|
|
296
|
+
readonly name: "newOwner";
|
|
297
|
+
readonly type: "address";
|
|
298
|
+
}];
|
|
299
|
+
readonly name: "transferOwnership";
|
|
300
|
+
readonly outputs: readonly [];
|
|
301
|
+
readonly stateMutability: "nonpayable";
|
|
302
|
+
readonly type: "function";
|
|
303
|
+
}, {
|
|
304
|
+
readonly inputs: readonly [];
|
|
305
|
+
readonly name: "version";
|
|
306
|
+
readonly outputs: readonly [{
|
|
307
|
+
readonly internalType: "uint256";
|
|
308
|
+
readonly name: "";
|
|
309
|
+
readonly type: "uint256";
|
|
310
|
+
}];
|
|
311
|
+
readonly stateMutability: "view";
|
|
312
|
+
readonly type: "function";
|
|
313
|
+
}, {
|
|
314
|
+
readonly inputs: readonly [{
|
|
315
|
+
readonly internalType: "bytes32";
|
|
316
|
+
readonly name: "";
|
|
317
|
+
readonly type: "bytes32";
|
|
318
|
+
}];
|
|
319
|
+
readonly name: "withdrawableTypeToCompressorType";
|
|
320
|
+
readonly outputs: readonly [{
|
|
321
|
+
readonly internalType: "bytes32";
|
|
322
|
+
readonly name: "";
|
|
323
|
+
readonly type: "bytes32";
|
|
324
|
+
}];
|
|
325
|
+
readonly stateMutability: "view";
|
|
326
|
+
readonly type: "function";
|
|
327
|
+
}];
|
|
@@ -10,7 +10,7 @@ export interface NotValidatedStrategy extends Omit<StrategyConfigPayload, "addit
|
|
|
10
10
|
additionalCollaterals?: ExtraCollaterals;
|
|
11
11
|
}
|
|
12
12
|
export interface Strategy extends Omit<NotValidatedStrategy, "network" | "id"> {
|
|
13
|
-
id:
|
|
13
|
+
id: string;
|
|
14
14
|
network: NetworkType;
|
|
15
15
|
}
|
|
16
16
|
export type StrategyRecord = Record<number, Record<Strategy["id"], Strategy>>;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { Address, GetContractReturnType, PublicClient } from "viem";
|
|
2
2
|
import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
3
|
+
import type { iWithdrawalCompressorV311Abi } from "../../abi/IWithdrawalCompressorV311.js";
|
|
3
4
|
import type { BaseContractStateHuman } from "../../sdk/index.js";
|
|
4
5
|
type WithdrawalCompressorV310InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV310Abi, PublicClient>;
|
|
5
|
-
|
|
6
|
+
type WithdrawalCompressorV311InstanceType = GetContractReturnType<typeof iWithdrawalCompressorV311Abi, PublicClient>;
|
|
7
|
+
type WithdrawableAssetV310 = Awaited<ReturnType<WithdrawalCompressorV310InstanceType["read"]["getWithdrawableAssets"]>>[number] & {
|
|
6
8
|
creditManager: Address;
|
|
7
9
|
disabled: boolean;
|
|
8
10
|
};
|
|
9
|
-
|
|
11
|
+
type WithdrawableAssetV311 = Awaited<ReturnType<WithdrawalCompressorV311InstanceType["read"]["getWithdrawableAssets"]>>[number] & {
|
|
12
|
+
creditManager: Address;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
};
|
|
15
|
+
type CommonType = WithdrawableAssetV310 & Partial<Omit<WithdrawableAssetV311, keyof WithdrawableAssetV310>>;
|
|
16
|
+
export type WithdrawableAsset = CommonType;
|
|
17
|
+
export interface WithdrawableAssetStateHuman extends CommonType, BaseContractStateHuman {
|
|
10
18
|
}
|
|
11
19
|
export {};
|
|
@@ -22,7 +22,10 @@ export interface CreditAccountServiceOptions {
|
|
|
22
22
|
* @param chainId - Numeric chain ID.
|
|
23
23
|
* @returns Withdrawal compressor address, or `undefined`.
|
|
24
24
|
**/
|
|
25
|
-
export declare function getWithdrawalCompressorAddress(chainId: number):
|
|
25
|
+
export declare function getWithdrawalCompressorAddress(chainId: number): {
|
|
26
|
+
address: Address;
|
|
27
|
+
version: 311 | 310;
|
|
28
|
+
};
|
|
26
29
|
/**
|
|
27
30
|
* Service for querying and operating on Gearbox credit accounts.
|
|
28
31
|
*
|