@across-protocol/sdk 4.0.0-beta.34 → 4.0.0-beta.4
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/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +175 -355
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.d.ts +2 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +2 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -5
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +1 -47
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +4 -4
- package/dist/cjs/clients/SpokePoolClient.d.ts +0 -1
- package/dist/cjs/clients/SpokePoolClient.js +1 -10
- package/dist/cjs/clients/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +1 -2
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +1 -11
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/constants.js +2 -2
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/providers/index.d.ts +0 -1
- package/dist/cjs/providers/index.js +0 -2
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +0 -2
- package/dist/cjs/utils/AddressUtils.js +1 -19
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/DepositUtils.d.ts +1 -2
- package/dist/cjs/utils/DepositUtils.js +1 -10
- package/dist/cjs/utils/DepositUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.js +0 -21
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.d.ts +0 -1
- package/dist/cjs/utils/NetworkUtils.js +1 -6
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +0 -1
- package/dist/cjs/utils/SpokeUtils.js +8 -15
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/common.d.ts +0 -1
- package/dist/cjs/utils/common.js +1 -2
- package/dist/cjs/utils/common.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +257 -459
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.d.ts +2 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +3 -2
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -5
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -54
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +4 -4
- package/dist/esm/clients/SpokePoolClient.d.ts +0 -8
- package/dist/esm/clients/SpokePoolClient.js +1 -17
- package/dist/esm/clients/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +1 -2
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +1 -11
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +2 -2
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/providers/index.d.ts +0 -1
- package/dist/esm/providers/index.js +0 -2
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +0 -2
- package/dist/esm/utils/AddressUtils.js +0 -25
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/DepositUtils.d.ts +1 -2
- package/dist/esm/utils/DepositUtils.js +2 -11
- package/dist/esm/utils/DepositUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.js +1 -29
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.d.ts +0 -6
- package/dist/esm/utils/NetworkUtils.js +0 -10
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +0 -1
- package/dist/esm/utils/SpokeUtils.js +8 -14
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/common.d.ts +0 -1
- package/dist/esm/utils/common.js +0 -1
- package/dist/esm/utils/common.js.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -5
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts +2 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -5
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +4 -4
- package/dist/types/clients/SpokePoolClient.d.ts +0 -8
- package/dist/types/clients/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +1 -2
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +0 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +0 -2
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/DepositUtils.d.ts +1 -2
- package/dist/types/utils/DepositUtils.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/dist/types/utils/NetworkUtils.d.ts +0 -6
- package/dist/types/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +0 -1
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/common.d.ts +0 -1
- package/dist/types/utils/common.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/BundleDataClient/BundleDataClient.ts +227 -433
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +8 -0
- package/src/clients/BundleDataClient/utils/FillUtils.ts +2 -66
- package/src/clients/SpokePoolClient.ts +3 -16
- package/src/clients/mocks/MockSpokePoolClient.ts +1 -14
- package/src/constants.ts +3 -3
- package/src/providers/index.ts +0 -1
- package/src/utils/AddressUtils.ts +0 -26
- package/src/utils/DepositUtils.ts +2 -11
- package/src/utils/EventUtils.ts +1 -29
- package/src/utils/NetworkUtils.ts +0 -11
- package/src/utils/SpokeUtils.ts +9 -22
- package/src/utils/common.ts +0 -2
- package/dist/cjs/providers/mockProvider.d.ts +0 -19
- package/dist/cjs/providers/mockProvider.js +0 -70
- package/dist/cjs/providers/mockProvider.js.map +0 -1
- package/dist/esm/providers/mockProvider.d.ts +0 -23
- package/dist/esm/providers/mockProvider.js +0 -73
- package/dist/esm/providers/mockProvider.js.map +0 -1
- package/dist/types/providers/mockProvider.d.ts +0 -24
- package/dist/types/providers/mockProvider.d.ts.map +0 -1
- package/src/providers/mockProvider.ts +0 -77
|
@@ -6,13 +6,9 @@ var lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
|
6
6
|
var interfaces_1 = require("../../interfaces");
|
|
7
7
|
var utils_1 = require("../../utils");
|
|
8
8
|
var utils_2 = require("./utils");
|
|
9
|
-
var constants_1 = require("../../constants");
|
|
10
9
|
exports.INFINITE_FILL_DEADLINE = utils_1.bnUint32Max;
|
|
11
10
|
function updateExpiredDepositsV3(dict, deposit) {
|
|
12
11
|
var _a;
|
|
13
|
-
if ((0, utils_1.chainIsEvm)(deposit.originChainId) && !(0, utils_1.isValidEvmAddress)(deposit.depositor)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
12
|
var originChainId = deposit.originChainId, inputToken = deposit.inputToken;
|
|
17
13
|
if (!((_a = dict === null || dict === void 0 ? void 0 : dict[originChainId]) === null || _a === void 0 ? void 0 : _a[inputToken])) {
|
|
18
14
|
(0, utils_1.assign)(dict, [originChainId, inputToken], []);
|
|
@@ -27,9 +23,8 @@ function updateBundleDepositsV3(dict, deposit) {
|
|
|
27
23
|
}
|
|
28
24
|
dict[originChainId][inputToken].push(deposit);
|
|
29
25
|
}
|
|
30
|
-
function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentToken
|
|
26
|
+
function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentToken) {
|
|
31
27
|
var _a, _b;
|
|
32
|
-
(0, utils_1.assert)((0, utils_1.chainIsEvm)(repaymentChainId) && (0, utils_2.isEvmRepaymentValid)(fill, repaymentChainId), "validatedBundleV3Fills dictionary should only contain fills with valid repayment information");
|
|
33
28
|
if (!((_a = dict === null || dict === void 0 ? void 0 : dict[repaymentChainId]) === null || _a === void 0 ? void 0 : _a[repaymentToken])) {
|
|
34
29
|
(0, utils_1.assign)(dict, [repaymentChainId, repaymentToken], {
|
|
35
30
|
fills: [],
|
|
@@ -38,22 +33,22 @@ function updateBundleFillsV3(dict, fill, lpFeePct, repaymentChainId, repaymentTo
|
|
|
38
33
|
refunds: {},
|
|
39
34
|
});
|
|
40
35
|
}
|
|
41
|
-
var bundleFill = tslib_1.__assign(tslib_1.__assign({}, fill), { lpFeePct: lpFeePct
|
|
36
|
+
var bundleFill = tslib_1.__assign(tslib_1.__assign({}, fill), { lpFeePct: lpFeePct });
|
|
42
37
|
(0, utils_1.assign)(dict, [repaymentChainId, repaymentToken, "fills"], [bundleFill]);
|
|
43
38
|
var refundObj = dict[repaymentChainId][repaymentToken];
|
|
44
|
-
var realizedLpFee =
|
|
39
|
+
var realizedLpFee = fill.inputAmount.mul(bundleFill.lpFeePct).div(utils_1.fixedPointAdjustment);
|
|
45
40
|
refundObj.realizedLpFees = refundObj.realizedLpFees ? refundObj.realizedLpFees.add(realizedLpFee) : realizedLpFee;
|
|
46
|
-
if (!(0, utils_1.isSlowFill)(
|
|
47
|
-
var refundAmount =
|
|
41
|
+
if (!(0, utils_1.isSlowFill)(fill)) {
|
|
42
|
+
var refundAmount = fill.inputAmount.mul(utils_1.fixedPointAdjustment.sub(lpFeePct)).div(utils_1.fixedPointAdjustment);
|
|
48
43
|
refundObj.totalRefundAmount = refundObj.totalRefundAmount
|
|
49
44
|
? refundObj.totalRefundAmount.add(refundAmount)
|
|
50
45
|
: refundAmount;
|
|
51
46
|
(_b = refundObj.refunds) !== null && _b !== void 0 ? _b : (refundObj.refunds = {});
|
|
52
|
-
if (refundObj.refunds[
|
|
53
|
-
refundObj.refunds[
|
|
47
|
+
if (refundObj.refunds[fill.relayer]) {
|
|
48
|
+
refundObj.refunds[fill.relayer] = refundObj.refunds[fill.relayer].add(refundAmount);
|
|
54
49
|
}
|
|
55
50
|
else {
|
|
56
|
-
refundObj.refunds[
|
|
51
|
+
refundObj.refunds[fill.relayer] = refundAmount;
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
}
|
|
@@ -67,9 +62,6 @@ function updateBundleExcessSlowFills(dict, deposit) {
|
|
|
67
62
|
}
|
|
68
63
|
function updateBundleSlowFills(dict, deposit) {
|
|
69
64
|
var _a;
|
|
70
|
-
if ((0, utils_1.chainIsEvm)(deposit.destinationChainId) && !(0, utils_1.isValidEvmAddress)(deposit.recipient)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
65
|
var destinationChainId = deposit.destinationChainId, outputToken = deposit.outputToken;
|
|
74
66
|
if (!((_a = dict === null || dict === void 0 ? void 0 : dict[destinationChainId]) === null || _a === void 0 ? void 0 : _a[outputToken])) {
|
|
75
67
|
(0, utils_1.assign)(dict, [destinationChainId, outputToken], []);
|
|
@@ -154,7 +146,7 @@ var BundleDataClient = (function () {
|
|
|
154
146
|
at: "BundleDataClient#loadPersistedDataFromArweave",
|
|
155
147
|
message: "Loaded persisted data from Arweave in ".concat(Math.round(performance.now() - start) / 1000, "s."),
|
|
156
148
|
blockRanges: JSON.stringify(blockRangesForChains),
|
|
157
|
-
bundleData: (0, utils_2.prettyPrintV3SpokePoolEvents)(bundleData.bundleDepositsV3, bundleData.bundleFillsV3, bundleData.bundleSlowFillsV3, bundleData.expiredDepositsToRefundV3, bundleData.unexecutableSlowFills),
|
|
149
|
+
bundleData: (0, utils_2.prettyPrintV3SpokePoolEvents)(bundleData.bundleDepositsV3, bundleData.bundleFillsV3, [], bundleData.bundleSlowFillsV3, bundleData.expiredDepositsToRefundV3, bundleData.unexecutableSlowFills),
|
|
158
150
|
});
|
|
159
151
|
return [2, bundleData];
|
|
160
152
|
}
|
|
@@ -196,107 +188,64 @@ var BundleDataClient = (function () {
|
|
|
196
188
|
return [4, this.loadArweaveData(bundleEvaluationBlockRanges)];
|
|
197
189
|
case 1:
|
|
198
190
|
arweaveData = _a.sent();
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
_a.label = 4;
|
|
213
|
-
case 4: return [2, this.deductExecutedRefunds(combinedRefunds, bundle)];
|
|
191
|
+
if (arweaveData === undefined) {
|
|
192
|
+
combinedRefunds = this.getApproximateRefundsForBlockRange(chainIds, bundleEvaluationBlockRanges);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
|
|
196
|
+
combinedRefunds = (0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3);
|
|
197
|
+
Object.keys(combinedRefunds).forEach(function (chainId) {
|
|
198
|
+
if (_this.spokePoolClients[Number(chainId)] === undefined) {
|
|
199
|
+
delete combinedRefunds[Number(chainId)];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return [2, this.deductExecutedRefunds(combinedRefunds, bundle)];
|
|
214
204
|
}
|
|
215
205
|
});
|
|
216
206
|
});
|
|
217
207
|
};
|
|
218
208
|
BundleDataClient.prototype.getApproximateRefundsForBlockRange = function (chainIds, blockRanges) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (this_1.spokePoolClients[chainId] === undefined) {
|
|
232
|
-
return [2, "continue"];
|
|
233
|
-
}
|
|
234
|
-
chainIndex = chainIds.indexOf(chainId);
|
|
235
|
-
return [4, (0, utils_1.filterAsync)(this_1.spokePoolClients[chainId].getFills(), function (fill) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
236
|
-
var matchingDeposit, hasMatchingDeposit, validRepayment;
|
|
237
|
-
return tslib_1.__generator(this, function (_a) {
|
|
238
|
-
switch (_a.label) {
|
|
239
|
-
case 0:
|
|
240
|
-
if (fill.blockNumber < blockRanges[chainIndex][0] ||
|
|
241
|
-
fill.blockNumber > blockRanges[chainIndex][1] ||
|
|
242
|
-
(0, utils_1.isZeroValueFillOrSlowFillRequest)(fill)) {
|
|
243
|
-
return [2, false];
|
|
244
|
-
}
|
|
245
|
-
if (this.spokePoolClients[fill.originChainId] === undefined) {
|
|
246
|
-
return [2, false];
|
|
247
|
-
}
|
|
248
|
-
matchingDeposit = this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
|
|
249
|
-
hasMatchingDeposit = matchingDeposit !== undefined &&
|
|
250
|
-
this.getRelayHashFromEvent(fill) === this.getRelayHashFromEvent(matchingDeposit);
|
|
251
|
-
if (!hasMatchingDeposit) return [3, 2];
|
|
252
|
-
return [4, (0, utils_2.verifyFillRepayment)(fill, this.spokePoolClients[fill.destinationChainId].spokePool.provider, matchingDeposit, this.clients.configStoreClient
|
|
253
|
-
.getChainIdIndicesForBlock(blockRanges[0][1])
|
|
254
|
-
.filter(function (_chainId, i) { return !(0, utils_2.isChainDisabled)(blockRanges[i]); }))];
|
|
255
|
-
case 1:
|
|
256
|
-
validRepayment = _a.sent();
|
|
257
|
-
if (!(0, utils_1.isDefined)(validRepayment)) {
|
|
258
|
-
return [2, false];
|
|
259
|
-
}
|
|
260
|
-
_a.label = 2;
|
|
261
|
-
case 2: return [2, hasMatchingDeposit];
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}); })];
|
|
265
|
-
case 1:
|
|
266
|
-
fillsToCount = _b.sent();
|
|
267
|
-
fillsToCount.forEach(function (fill) {
|
|
268
|
-
var _a, _b, _c;
|
|
269
|
-
var _d;
|
|
270
|
-
var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
|
|
271
|
-
(0, utils_1.assert)((0, utils_1.isDefined)(matchingDeposit), "Deposit not found for fill.");
|
|
272
|
-
var _e = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRanges, _this.chainIdListForBundleEvaluationBlockNumbers, matchingDeposit.fromLiteChain), chainToSendRefundTo = _e.chainToSendRefundTo, repaymentToken = _e.repaymentToken;
|
|
273
|
-
var relayer = fill.relayer, refundAmount = fill.inputAmount;
|
|
274
|
-
(_a = refundsForChain[chainToSendRefundTo]) !== null && _a !== void 0 ? _a : (refundsForChain[chainToSendRefundTo] = {});
|
|
275
|
-
(_b = (_d = refundsForChain[chainToSendRefundTo])[repaymentToken]) !== null && _b !== void 0 ? _b : (_d[repaymentToken] = {});
|
|
276
|
-
var existingRefundAmount = (_c = refundsForChain[chainToSendRefundTo][repaymentToken][relayer]) !== null && _c !== void 0 ? _c : utils_1.bnZero;
|
|
277
|
-
refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
|
|
278
|
-
});
|
|
279
|
-
return [2];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
this_1 = this;
|
|
284
|
-
_i = 0, chainIds_1 = chainIds;
|
|
285
|
-
_a.label = 1;
|
|
286
|
-
case 1:
|
|
287
|
-
if (!(_i < chainIds_1.length)) return [3, 4];
|
|
288
|
-
chainId = chainIds_1[_i];
|
|
289
|
-
return [5, _loop_1(chainId)];
|
|
290
|
-
case 2:
|
|
291
|
-
_a.sent();
|
|
292
|
-
_a.label = 3;
|
|
293
|
-
case 3:
|
|
294
|
-
_i++;
|
|
295
|
-
return [3, 1];
|
|
296
|
-
case 4: return [2, refundsForChain];
|
|
209
|
+
var _this = this;
|
|
210
|
+
var refundsForChain = {};
|
|
211
|
+
var _loop_1 = function (chainId) {
|
|
212
|
+
if (this_1.spokePoolClients[chainId] === undefined) {
|
|
213
|
+
return "continue";
|
|
214
|
+
}
|
|
215
|
+
var chainIndex = chainIds.indexOf(chainId);
|
|
216
|
+
this_1.spokePoolClients[chainId]
|
|
217
|
+
.getFills()
|
|
218
|
+
.filter(function (fill) {
|
|
219
|
+
if (fill.blockNumber < blockRanges[chainIndex][0] || fill.blockNumber > blockRanges[chainIndex][1]) {
|
|
220
|
+
return false;
|
|
297
221
|
}
|
|
222
|
+
if (_this.spokePoolClients[fill.originChainId] === undefined) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
|
|
226
|
+
var hasMatchingDeposit = matchingDeposit !== undefined &&
|
|
227
|
+
_this.getRelayHashFromEvent(fill) === _this.getRelayHashFromEvent(matchingDeposit);
|
|
228
|
+
return hasMatchingDeposit;
|
|
229
|
+
})
|
|
230
|
+
.forEach(function (fill) {
|
|
231
|
+
var _a, _b, _c;
|
|
232
|
+
var _d;
|
|
233
|
+
var matchingDeposit = _this.spokePoolClients[fill.originChainId].getDeposit(fill.depositId);
|
|
234
|
+
(0, utils_1.assert)((0, utils_1.isDefined)(matchingDeposit), "Deposit not found for fill.");
|
|
235
|
+
var _e = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRanges, _this.chainIdListForBundleEvaluationBlockNumbers, matchingDeposit.fromLiteChain), chainToSendRefundTo = _e.chainToSendRefundTo, repaymentToken = _e.repaymentToken;
|
|
236
|
+
var relayer = fill.relayer, refundAmount = fill.inputAmount;
|
|
237
|
+
(_a = refundsForChain[chainToSendRefundTo]) !== null && _a !== void 0 ? _a : (refundsForChain[chainToSendRefundTo] = {});
|
|
238
|
+
(_b = (_d = refundsForChain[chainToSendRefundTo])[repaymentToken]) !== null && _b !== void 0 ? _b : (_d[repaymentToken] = {});
|
|
239
|
+
var existingRefundAmount = (_c = refundsForChain[chainToSendRefundTo][repaymentToken][relayer]) !== null && _c !== void 0 ? _c : utils_1.bnZero;
|
|
240
|
+
refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
|
|
298
241
|
});
|
|
299
|
-
}
|
|
242
|
+
};
|
|
243
|
+
var this_1 = this;
|
|
244
|
+
for (var _i = 0, chainIds_1 = chainIds; _i < chainIds_1.length; _i++) {
|
|
245
|
+
var chainId = chainIds_1[_i];
|
|
246
|
+
_loop_1(chainId);
|
|
247
|
+
}
|
|
248
|
+
return refundsForChain;
|
|
300
249
|
};
|
|
301
250
|
BundleDataClient.prototype.getUpcomingDepositAmount = function (chainId, l2Token, latestBlockToSearch) {
|
|
302
251
|
if (this.spokePoolClients[chainId] === undefined) {
|
|
@@ -339,10 +288,12 @@ var BundleDataClient = (function () {
|
|
|
339
288
|
case 1:
|
|
340
289
|
_a = _b.sent(), bundleData = _a.bundleData, blockRanges = _a.blockRanges;
|
|
341
290
|
hubPoolClient = this.clients.hubPoolClient;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
291
|
+
return [4, (0, utils_2._buildPoolRebalanceRoot)(hubPoolClient.latestBlockSearched, blockRanges[0][1], bundleData.bundleDepositsV3, bundleData.bundleFillsV3, bundleData.bundleSlowFillsV3, bundleData.unexecutableSlowFills, bundleData.expiredDepositsToRefundV3, {
|
|
292
|
+
hubPoolClient: hubPoolClient,
|
|
293
|
+
configStoreClient: hubPoolClient.configStoreClient,
|
|
294
|
+
})];
|
|
295
|
+
case 2:
|
|
296
|
+
root = _b.sent();
|
|
346
297
|
return [2, {
|
|
347
298
|
root: root,
|
|
348
299
|
blockRanges: blockRanges,
|
|
@@ -366,39 +317,32 @@ var BundleDataClient = (function () {
|
|
|
366
317
|
return [initialBlockRange[1] + 1, blockRange[1]];
|
|
367
318
|
});
|
|
368
319
|
}
|
|
369
|
-
var hubPoolClient, nextBundleMainnetStartBlock, chainIds, combinedRefunds, widestBundleBlockRanges, pendingBundleBlockRanges, arweaveData,
|
|
370
|
-
return tslib_1.__generator(this, function (
|
|
371
|
-
switch (
|
|
320
|
+
var hubPoolClient, nextBundleMainnetStartBlock, chainIds, combinedRefunds, widestBundleBlockRanges, pendingBundleBlockRanges, arweaveData, bundleFillsV3, expiredDepositsToRefundV3, start;
|
|
321
|
+
return tslib_1.__generator(this, function (_a) {
|
|
322
|
+
switch (_a.label) {
|
|
372
323
|
case 0:
|
|
373
324
|
hubPoolClient = this.clients.hubPoolClient;
|
|
374
325
|
nextBundleMainnetStartBlock = hubPoolClient.getNextBundleStartBlockNumber(this.chainIdListForBundleEvaluationBlockNumbers, hubPoolClient.latestBlockSearched, hubPoolClient.chainId);
|
|
375
326
|
chainIds = this.clients.configStoreClient.getChainIdIndicesForBlock(nextBundleMainnetStartBlock);
|
|
376
327
|
combinedRefunds = [];
|
|
377
328
|
widestBundleBlockRanges = (0, utils_2.getWidestPossibleExpectedBlockRange)(chainIds, this.spokePoolClients, (0, utils_2.getEndBlockBuffers)(chainIds, this.blockRangeEndBlockBuffer), this.clients, this.clients.hubPoolClient.latestBlockSearched, this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestBlockSearched));
|
|
378
|
-
if (!hubPoolClient.hasPendingProposal()) return [3,
|
|
329
|
+
if (!hubPoolClient.hasPendingProposal()) return [3, 2];
|
|
379
330
|
pendingBundleBlockRanges = (0, utils_1.getImpliedBundleBlockRanges)(hubPoolClient, this.clients.configStoreClient, hubPoolClient.getLatestProposedRootBundle());
|
|
380
331
|
return [4, this.loadArweaveData(pendingBundleBlockRanges)];
|
|
381
332
|
case 1:
|
|
382
|
-
arweaveData =
|
|
383
|
-
if (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
|
|
391
|
-
combinedRefunds.push((0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3));
|
|
392
|
-
_e.label = 4;
|
|
393
|
-
case 4:
|
|
333
|
+
arweaveData = _a.sent();
|
|
334
|
+
if (arweaveData === undefined) {
|
|
335
|
+
combinedRefunds.push(this.getApproximateRefundsForBlockRange(chainIds, pendingBundleBlockRanges));
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
bundleFillsV3 = arweaveData.bundleFillsV3, expiredDepositsToRefundV3 = arweaveData.expiredDepositsToRefundV3;
|
|
339
|
+
combinedRefunds.push((0, utils_2.getRefundsFromBundle)(bundleFillsV3, expiredDepositsToRefundV3));
|
|
340
|
+
}
|
|
394
341
|
widestBundleBlockRanges = getBlockRangeDelta(pendingBundleBlockRanges);
|
|
395
|
-
|
|
396
|
-
case
|
|
342
|
+
_a.label = 2;
|
|
343
|
+
case 2:
|
|
397
344
|
start = performance.now();
|
|
398
|
-
|
|
399
|
-
return [4, this.getApproximateRefundsForBlockRange(chainIds, widestBundleBlockRanges)];
|
|
400
|
-
case 6:
|
|
401
|
-
_d.apply(_c, [_e.sent()]);
|
|
345
|
+
combinedRefunds.push(this.getApproximateRefundsForBlockRange(chainIds, widestBundleBlockRanges));
|
|
402
346
|
this.logger.debug({
|
|
403
347
|
at: "BundleDataClient#getNextBundleRefunds",
|
|
404
348
|
message: "Loading approximate refunds for next bundle in ".concat(Math.round(performance.now() - start) / 1000, "s."),
|
|
@@ -529,7 +473,7 @@ var BundleDataClient = (function () {
|
|
|
529
473
|
};
|
|
530
474
|
BundleDataClient.prototype.loadDataFromScratch = function (blockRangesForChains, spokePoolClients) {
|
|
531
475
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
532
|
-
var start, key, chainIds, bundleDepositsV3, bundleFillsV3, bundleInvalidFillsV3,
|
|
476
|
+
var start, key, chainIds, bundleDepositsV3, bundleFillsV3, bundleInvalidFillsV3, bundleSlowFillsV3, expiredDepositsToRefundV3, unexecutableSlowFills, _isChainDisabled, _canCreateSlowFillLeaf, _depositIsExpired, _getFillStatusForDeposit, allChainIds, _cachedBundleTimestamps, bundleBlockTimestamps, v3RelayHashes, bundleDepositHashes, olderDepositHashes, depositCounter, _loop_2, _i, allChainIds_1, originChainId, validatedBundleV3Fills, validatedBundleSlowFills, validatedBundleUnexecutableSlowFills, fillCounter, _loop_3, _a, allChainIds_2, originChainId, promises, _b, v3FillLpFees, v3SlowFillLpFees, v3UnexecutableSlowFillLpFees, v3SpokeEventsReadable;
|
|
533
477
|
var _this = this;
|
|
534
478
|
return tslib_1.__generator(this, function (_c) {
|
|
535
479
|
switch (_c.label) {
|
|
@@ -549,8 +493,6 @@ var BundleDataClient = (function () {
|
|
|
549
493
|
bundleDepositsV3 = {};
|
|
550
494
|
bundleFillsV3 = {};
|
|
551
495
|
bundleInvalidFillsV3 = [];
|
|
552
|
-
bundleUnrepayableFillsV3 = [];
|
|
553
|
-
bundleInvalidSlowFillRequests = [];
|
|
554
496
|
bundleSlowFillsV3 = {};
|
|
555
497
|
expiredDepositsToRefundV3 = {};
|
|
556
498
|
unexecutableSlowFills = {};
|
|
@@ -599,13 +541,7 @@ var BundleDataClient = (function () {
|
|
|
599
541
|
v3RelayHashes = {};
|
|
600
542
|
bundleDepositHashes = [];
|
|
601
543
|
olderDepositHashes = [];
|
|
602
|
-
|
|
603
|
-
var _a = depositHash.split("@"), relayDataHash = _a[0], i = _a[1];
|
|
604
|
-
return { relayDataHash: relayDataHash, index: Number(i) };
|
|
605
|
-
};
|
|
606
|
-
startBlockForMainnet = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, this.clients.hubPoolClient.chainId, this.chainIdListForBundleEvaluationBlockNumbers)[0];
|
|
607
|
-
versionAtProposalBlock = this.clients.configStoreClient.getConfigStoreVersionForBlock(startBlockForMainnet);
|
|
608
|
-
canRefundPrefills = versionAtProposalBlock >= constants_1.PRE_FILL_MIN_CONFIG_STORE_VERSION || process.env.FORCE_REFUND_PREFILLS === "true";
|
|
544
|
+
depositCounter = 0;
|
|
609
545
|
_loop_2 = function (originChainId) {
|
|
610
546
|
var originClient = spokePoolClients[originChainId];
|
|
611
547
|
var originChainBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, originChainId, chainIds);
|
|
@@ -618,27 +554,24 @@ var BundleDataClient = (function () {
|
|
|
618
554
|
if (deposit.blockNumber > originChainBlockRange[1] || (0, utils_1.isZeroValueDeposit)(deposit)) {
|
|
619
555
|
return;
|
|
620
556
|
}
|
|
557
|
+
depositCounter++;
|
|
621
558
|
var relayDataHash = _this.getRelayHashFromEvent(deposit);
|
|
622
559
|
if (!v3RelayHashes[relayDataHash]) {
|
|
623
560
|
v3RelayHashes[relayDataHash] = {
|
|
624
|
-
|
|
561
|
+
deposit: deposit,
|
|
625
562
|
fill: undefined,
|
|
626
563
|
slowFillRequest: undefined,
|
|
627
564
|
};
|
|
628
565
|
}
|
|
629
|
-
|
|
630
|
-
|
|
566
|
+
if (deposit.inputAmount.eq(0)) {
|
|
567
|
+
return;
|
|
631
568
|
}
|
|
632
|
-
var newBundleDepositHash = "".concat(relayDataHash, "@").concat(v3RelayHashes[relayDataHash].deposits.length - 1);
|
|
633
|
-
var decodedBundleDepositHash = decodeBundleDepositHash(newBundleDepositHash);
|
|
634
|
-
(0, utils_1.assert)(decodedBundleDepositHash.relayDataHash === relayDataHash &&
|
|
635
|
-
decodedBundleDepositHash.index === v3RelayHashes[relayDataHash].deposits.length - 1, "Not using correct bundle deposit hash key");
|
|
636
569
|
if (deposit.blockNumber >= originChainBlockRange[0]) {
|
|
637
|
-
bundleDepositHashes.push(
|
|
570
|
+
bundleDepositHashes.push(relayDataHash);
|
|
638
571
|
updateBundleDepositsV3(bundleDepositsV3, deposit);
|
|
639
572
|
}
|
|
640
573
|
else if (deposit.blockNumber < originChainBlockRange[0]) {
|
|
641
|
-
olderDepositHashes.push(
|
|
574
|
+
olderDepositHashes.push(relayDataHash);
|
|
642
575
|
}
|
|
643
576
|
});
|
|
644
577
|
}
|
|
@@ -649,7 +582,7 @@ var BundleDataClient = (function () {
|
|
|
649
582
|
}
|
|
650
583
|
this.logger.debug({
|
|
651
584
|
at: "BundleDataClient#loadData",
|
|
652
|
-
message: "Processed ".concat(
|
|
585
|
+
message: "Processed ".concat(depositCounter, " deposits in ").concat(performance.now() - start, "ms."),
|
|
653
586
|
});
|
|
654
587
|
start = performance.now();
|
|
655
588
|
validatedBundleV3Fills = [];
|
|
@@ -663,7 +596,7 @@ var BundleDataClient = (function () {
|
|
|
663
596
|
case 0:
|
|
664
597
|
originClient = spokePoolClients[originChainId];
|
|
665
598
|
_loop_4 = function (destinationChainId) {
|
|
666
|
-
var destinationClient, destinationChainBlockRange,
|
|
599
|
+
var destinationClient, destinationChainBlockRange, fastFillsReplacingSlowFills;
|
|
667
600
|
return tslib_1.__generator(this, function (_g) {
|
|
668
601
|
switch (_g.label) {
|
|
669
602
|
case 0:
|
|
@@ -672,90 +605,58 @@ var BundleDataClient = (function () {
|
|
|
672
605
|
}
|
|
673
606
|
destinationClient = spokePoolClients[destinationChainId];
|
|
674
607
|
destinationChainBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, destinationChainId, chainIds);
|
|
675
|
-
originChainBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, originChainId, chainIds);
|
|
676
608
|
fastFillsReplacingSlowFills = [];
|
|
677
609
|
return [4, (0, utils_1.forEachAsync)(destinationClient
|
|
678
610
|
.getFillsForOriginChain(originChainId)
|
|
679
611
|
.filter(function (fill) { return fill.blockNumber <= destinationChainBlockRange[1] && !(0, utils_1.isZeroValueFillOrSlowFillRequest)(fill); }), function (fill) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
680
|
-
var relayDataHash,
|
|
612
|
+
var relayDataHash, historicalDeposit, matchedDeposit;
|
|
681
613
|
return tslib_1.__generator(this, function (_a) {
|
|
682
614
|
switch (_a.label) {
|
|
683
615
|
case 0:
|
|
684
|
-
fillCounter++;
|
|
685
616
|
relayDataHash = this.getRelayHashFromEvent(fill);
|
|
686
|
-
|
|
687
|
-
if (
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
else {
|
|
698
|
-
v3RelayHashes[relayDataHash].fill = fillToRefund_1;
|
|
699
|
-
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fillToRefund_1), { quoteTimestamp: v3RelayHashes[relayDataHash].deposits[0].quoteTimestamp }));
|
|
700
|
-
duplicateDeposits = v3RelayHashes[relayDataHash].deposits.slice(1);
|
|
701
|
-
duplicateDeposits.forEach(function (duplicateDeposit) {
|
|
702
|
-
if ((0, utils_1.isSlowFill)(fill)) {
|
|
703
|
-
updateExpiredDepositsV3(expiredDepositsToRefundV3, duplicateDeposit);
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fillToRefund_1), { quoteTimestamp: duplicateDeposit.quoteTimestamp }));
|
|
617
|
+
fillCounter++;
|
|
618
|
+
if (v3RelayHashes[relayDataHash]) {
|
|
619
|
+
if (!v3RelayHashes[relayDataHash].fill) {
|
|
620
|
+
(0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].deposit), "Deposit should exist in relay hash dictionary.");
|
|
621
|
+
v3RelayHashes[relayDataHash].fill = fill;
|
|
622
|
+
if (fill.blockNumber >= destinationChainBlockRange[0]) {
|
|
623
|
+
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: v3RelayHashes[relayDataHash].deposit.quoteTimestamp }));
|
|
624
|
+
if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
|
|
625
|
+
_canCreateSlowFillLeaf(v3RelayHashes[relayDataHash].deposit)) {
|
|
626
|
+
fastFillsReplacingSlowFills.push(relayDataHash);
|
|
627
|
+
}
|
|
707
628
|
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
|
|
711
|
-
_canCreateSlowFillLeaf(v3RelayHashes[relayDataHash].deposits[0])) {
|
|
712
|
-
fastFillsReplacingSlowFills.push(relayDataHash);
|
|
629
|
+
}
|
|
630
|
+
return [2];
|
|
713
631
|
}
|
|
714
|
-
_a.label = 2;
|
|
715
|
-
case 2: return [3, 4];
|
|
716
|
-
case 3: throw new Error("Duplicate fill detected");
|
|
717
|
-
case 4: return [2];
|
|
718
|
-
case 5:
|
|
719
632
|
v3RelayHashes[relayDataHash] = {
|
|
720
|
-
|
|
633
|
+
deposit: undefined,
|
|
721
634
|
fill: fill,
|
|
722
635
|
slowFillRequest: undefined,
|
|
723
636
|
};
|
|
724
|
-
if (!(fill.blockNumber >= destinationChainBlockRange[0])) return [3,
|
|
637
|
+
if (!(fill.blockNumber >= destinationChainBlockRange[0])) return [3, 2];
|
|
725
638
|
if (!exports.INFINITE_FILL_DEADLINE.eq(fill.fillDeadline)) {
|
|
726
639
|
bundleInvalidFillsV3.push(fill);
|
|
727
640
|
return [2];
|
|
728
641
|
}
|
|
729
642
|
return [4, (0, utils_1.queryHistoricalDepositForFill)(originClient, fill)];
|
|
730
|
-
case
|
|
643
|
+
case 1:
|
|
731
644
|
historicalDeposit = _a.sent();
|
|
732
|
-
if (
|
|
733
|
-
bundleInvalidFillsV3.push(fill);
|
|
734
|
-
return [3, 9];
|
|
735
|
-
case 7:
|
|
736
|
-
matchedDeposit = historicalDeposit.deposit;
|
|
737
|
-
if (matchedDeposit.blockNumber > originChainBlockRange[1]) {
|
|
645
|
+
if (!historicalDeposit.found) {
|
|
738
646
|
bundleInvalidFillsV3.push(fill);
|
|
739
|
-
return [2];
|
|
740
|
-
}
|
|
741
|
-
v3RelayHashes[relayDataHash].deposits = [matchedDeposit];
|
|
742
|
-
return [4, (0, utils_2.verifyFillRepayment)(fill, destinationClient.spokePool.provider, matchedDeposit, allChainIds)];
|
|
743
|
-
case 8:
|
|
744
|
-
fillToRefund = _a.sent();
|
|
745
|
-
if (!(0, utils_1.isDefined)(fillToRefund)) {
|
|
746
|
-
bundleUnrepayableFillsV3.push(fill);
|
|
747
647
|
}
|
|
748
648
|
else {
|
|
649
|
+
matchedDeposit = historicalDeposit.deposit;
|
|
749
650
|
(0, utils_1.assert)(this.getRelayHashFromEvent(matchedDeposit) === relayDataHash, "Relay hashes should match.");
|
|
750
|
-
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({},
|
|
751
|
-
v3RelayHashes[relayDataHash].
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
651
|
+
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: matchedDeposit.quoteTimestamp }));
|
|
652
|
+
v3RelayHashes[relayDataHash].deposit = matchedDeposit;
|
|
653
|
+
if (fill.relayExecutionInfo.fillType === interfaces_1.FillType.ReplacedSlowFill &&
|
|
654
|
+
_canCreateSlowFillLeaf(matchedDeposit)) {
|
|
655
|
+
fastFillsReplacingSlowFills.push(relayDataHash);
|
|
656
|
+
}
|
|
756
657
|
}
|
|
757
|
-
_a.label =
|
|
758
|
-
case
|
|
658
|
+
_a.label = 2;
|
|
659
|
+
case 2: return [2];
|
|
759
660
|
}
|
|
760
661
|
});
|
|
761
662
|
}); })];
|
|
@@ -777,44 +678,34 @@ var BundleDataClient = (function () {
|
|
|
777
678
|
if (v3RelayHashes[relayDataHash].fill) {
|
|
778
679
|
return [2];
|
|
779
680
|
}
|
|
780
|
-
(0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].
|
|
781
|
-
matchedDeposit = v3RelayHashes[relayDataHash].
|
|
681
|
+
(0, utils_1.assert)((0, utils_1.isDefined)(v3RelayHashes[relayDataHash].deposit), "Deposit should exist in relay hash dictionary.");
|
|
682
|
+
matchedDeposit = v3RelayHashes[relayDataHash].deposit;
|
|
782
683
|
if (slowFillRequest.blockNumber >= destinationChainBlockRange[0] &&
|
|
783
684
|
_canCreateSlowFillLeaf(matchedDeposit) &&
|
|
784
685
|
!_depositIsExpired(matchedDeposit)) {
|
|
785
686
|
validatedBundleSlowFills.push(matchedDeposit);
|
|
786
687
|
}
|
|
787
688
|
}
|
|
788
|
-
else {
|
|
789
|
-
throw new Error("Duplicate slow fill request detected.");
|
|
790
|
-
}
|
|
791
689
|
return [2];
|
|
792
690
|
}
|
|
793
691
|
v3RelayHashes[relayDataHash] = {
|
|
794
|
-
|
|
692
|
+
deposit: undefined,
|
|
795
693
|
fill: undefined,
|
|
796
694
|
slowFillRequest: slowFillRequest,
|
|
797
695
|
};
|
|
798
|
-
if (!(slowFillRequest.blockNumber >= destinationChainBlockRange[0]
|
|
799
|
-
|
|
800
|
-
bundleInvalidSlowFillRequests.push(slowFillRequest);
|
|
801
|
-
return [2];
|
|
802
|
-
}
|
|
696
|
+
if (!(slowFillRequest.blockNumber >= destinationChainBlockRange[0] &&
|
|
697
|
+
exports.INFINITE_FILL_DEADLINE.eq(slowFillRequest.fillDeadline))) return [3, 2];
|
|
803
698
|
return [4, (0, utils_1.queryHistoricalDepositForFill)(originClient, slowFillRequest)];
|
|
804
699
|
case 1:
|
|
805
700
|
historicalDeposit = _a.sent();
|
|
806
701
|
if (!historicalDeposit.found) {
|
|
807
|
-
bundleInvalidSlowFillRequests.push(slowFillRequest);
|
|
808
702
|
return [2];
|
|
809
703
|
}
|
|
810
704
|
matchedDeposit = historicalDeposit.deposit;
|
|
811
|
-
if (matchedDeposit.blockNumber > originChainBlockRange[1]) {
|
|
812
|
-
bundleInvalidSlowFillRequests.push(slowFillRequest);
|
|
813
|
-
return [2];
|
|
814
|
-
}
|
|
815
705
|
(0, utils_1.assert)(this.getRelayHashFromEvent(matchedDeposit) === relayDataHash, "Deposit relay hashes should match.");
|
|
816
|
-
v3RelayHashes[relayDataHash].
|
|
817
|
-
if (!_canCreateSlowFillLeaf(matchedDeposit) ||
|
|
706
|
+
v3RelayHashes[relayDataHash].deposit = matchedDeposit;
|
|
707
|
+
if (!_canCreateSlowFillLeaf(matchedDeposit) ||
|
|
708
|
+
_depositIsExpired(matchedDeposit)) {
|
|
818
709
|
return [2];
|
|
819
710
|
}
|
|
820
711
|
validatedBundleSlowFills.push(matchedDeposit);
|
|
@@ -825,105 +716,71 @@ var BundleDataClient = (function () {
|
|
|
825
716
|
}); })];
|
|
826
717
|
case 2:
|
|
827
718
|
_g.sent();
|
|
828
|
-
return [4, (0, utils_1.mapAsync)(bundleDepositHashes
|
|
829
|
-
var
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
719
|
+
return [4, (0, utils_1.mapAsync)(bundleDepositHashes.filter(function (depositHash) {
|
|
720
|
+
var deposit = v3RelayHashes[depositHash].deposit;
|
|
721
|
+
return (deposit && deposit.originChainId === originChainId && deposit.destinationChainId === destinationChainId);
|
|
722
|
+
}), function (depositHash) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
723
|
+
var _a, deposit, fill, slowFillRequest, fillStatus, prefill;
|
|
724
|
+
return tslib_1.__generator(this, function (_b) {
|
|
725
|
+
switch (_b.label) {
|
|
833
726
|
case 0:
|
|
834
|
-
_a =
|
|
835
|
-
_b = v3RelayHashes[relayDataHash], deposits = _b.deposits, fill = _b.fill, slowFillRequest = _b.slowFillRequest;
|
|
836
|
-
if (!deposits || deposits.length === 0) {
|
|
837
|
-
throw new Error("Deposits should exist in relay hash dictionary.");
|
|
838
|
-
}
|
|
839
|
-
deposit = deposits[index];
|
|
727
|
+
_a = v3RelayHashes[depositHash], deposit = _a.deposit, fill = _a.fill, slowFillRequest = _a.slowFillRequest;
|
|
840
728
|
if (!deposit)
|
|
841
729
|
throw new Error("Deposit should exist in relay hash dictionary.");
|
|
842
|
-
if (
|
|
730
|
+
if (fill) {
|
|
731
|
+
if (fill.blockNumber < destinationChainBlockRange[0] && !(0, utils_1.isSlowFill)(fill)) {
|
|
732
|
+
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fill), { quoteTimestamp: deposit.quoteTimestamp }));
|
|
733
|
+
}
|
|
843
734
|
return [2];
|
|
844
735
|
}
|
|
845
|
-
if (!fill) return [3, 3];
|
|
846
|
-
if (!(canRefundPrefills && fill.blockNumber < destinationChainBlockRange[0])) return [3, 2];
|
|
847
|
-
return [4, (0, utils_2.verifyFillRepayment)(fill, destinationClient.spokePool.provider, v3RelayHashes[relayDataHash].deposits[0], allChainIds)];
|
|
848
|
-
case 1:
|
|
849
|
-
fillToRefund = _c.sent();
|
|
850
|
-
if (!(0, utils_1.isDefined)(fillToRefund)) {
|
|
851
|
-
bundleUnrepayableFillsV3.push(fill);
|
|
852
|
-
}
|
|
853
|
-
else if (!(0, utils_1.isSlowFill)(fill)) {
|
|
854
|
-
v3RelayHashes[relayDataHash].fill = fillToRefund;
|
|
855
|
-
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, fillToRefund), { quoteTimestamp: deposit.quoteTimestamp }));
|
|
856
|
-
}
|
|
857
|
-
else {
|
|
858
|
-
updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
|
|
859
|
-
}
|
|
860
|
-
_c.label = 2;
|
|
861
|
-
case 2: return [2];
|
|
862
|
-
case 3:
|
|
863
736
|
if (slowFillRequest) {
|
|
864
737
|
if (_depositIsExpired(deposit)) {
|
|
865
738
|
updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
|
|
866
739
|
}
|
|
867
|
-
else if (
|
|
868
|
-
|
|
869
|
-
_canCreateSlowFillLeaf(deposit) &&
|
|
870
|
-
validatedBundleSlowFills.every(function (d) { return _this.getRelayHashFromEvent(d) !== relayDataHash; })) {
|
|
740
|
+
else if (slowFillRequest.blockNumber < destinationChainBlockRange[0] &&
|
|
741
|
+
_canCreateSlowFillLeaf(deposit)) {
|
|
871
742
|
validatedBundleSlowFills.push(deposit);
|
|
872
743
|
}
|
|
873
744
|
return [2];
|
|
874
745
|
}
|
|
875
746
|
return [4, _getFillStatusForDeposit(deposit, destinationChainBlockRange[1])];
|
|
876
|
-
case
|
|
877
|
-
fillStatus =
|
|
878
|
-
if (!(fillStatus === interfaces_1.FillStatus.Filled)) return [3,
|
|
879
|
-
return [4,
|
|
880
|
-
case
|
|
881
|
-
prefill =
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
if (!canRefundPrefills) return [3, 7];
|
|
885
|
-
return [4, (0, utils_2.verifyFillRepayment)(prefill, destinationClient.spokePool.provider, deposit, allChainIds)];
|
|
886
|
-
case 6:
|
|
887
|
-
verifiedFill = _c.sent();
|
|
888
|
-
if (!(0, utils_1.isDefined)(verifiedFill)) {
|
|
889
|
-
bundleUnrepayableFillsV3.push(prefill);
|
|
890
|
-
}
|
|
891
|
-
else if (!(0, utils_1.isSlowFill)(verifiedFill)) {
|
|
892
|
-
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, verifiedFill), { quoteTimestamp: deposit.quoteTimestamp }));
|
|
893
|
-
}
|
|
894
|
-
else {
|
|
895
|
-
updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
|
|
747
|
+
case 1:
|
|
748
|
+
fillStatus = _b.sent();
|
|
749
|
+
if (!(fillStatus === interfaces_1.FillStatus.Filled)) return [3, 3];
|
|
750
|
+
return [4, (0, utils_1.findFillEvent)(destinationClient.spokePool, deposit, destinationClient.deploymentBlock, destinationClient.latestBlockSearched)];
|
|
751
|
+
case 2:
|
|
752
|
+
prefill = (_b.sent());
|
|
753
|
+
if (!(0, utils_1.isSlowFill)(prefill)) {
|
|
754
|
+
validatedBundleV3Fills.push(tslib_1.__assign(tslib_1.__assign({}, prefill), { quoteTimestamp: deposit.quoteTimestamp }));
|
|
896
755
|
}
|
|
897
|
-
|
|
898
|
-
case
|
|
899
|
-
case 8:
|
|
756
|
+
return [3, 4];
|
|
757
|
+
case 3:
|
|
900
758
|
if (_depositIsExpired(deposit)) {
|
|
901
759
|
updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
|
|
902
760
|
}
|
|
903
|
-
else if (fillStatus === interfaces_1.FillStatus.RequestedSlowFill
|
|
904
|
-
|
|
905
|
-
if (canRefundPrefills && _canCreateSlowFillLeaf(deposit)) {
|
|
761
|
+
else if (fillStatus === interfaces_1.FillStatus.RequestedSlowFill) {
|
|
762
|
+
if (_canCreateSlowFillLeaf(deposit)) {
|
|
906
763
|
validatedBundleSlowFills.push(deposit);
|
|
907
764
|
}
|
|
908
765
|
}
|
|
909
|
-
|
|
910
|
-
case
|
|
766
|
+
_b.label = 4;
|
|
767
|
+
case 4: return [2];
|
|
911
768
|
}
|
|
912
769
|
});
|
|
913
770
|
}); })];
|
|
914
771
|
case 3:
|
|
915
772
|
_g.sent();
|
|
916
773
|
fastFillsReplacingSlowFills.forEach(function (relayDataHash) {
|
|
917
|
-
var _a = v3RelayHashes[relayDataHash],
|
|
774
|
+
var _a = v3RelayHashes[relayDataHash], deposit = _a.deposit, slowFillRequest = _a.slowFillRequest, fill = _a.fill;
|
|
918
775
|
(0, utils_1.assert)((fill === null || fill === void 0 ? void 0 : fill.relayExecutionInfo.fillType) === interfaces_1.FillType.ReplacedSlowFill, "Fill type should be ReplacedSlowFill.");
|
|
919
|
-
if (!
|
|
776
|
+
if (!deposit) {
|
|
920
777
|
throw new Error("Deposit should exist in relay hash dictionary.");
|
|
921
778
|
}
|
|
922
|
-
(0, utils_1.assert)(_canCreateSlowFillLeaf(
|
|
779
|
+
(0, utils_1.assert)(_canCreateSlowFillLeaf(deposit), "fastFillsReplacingSlowFills should contain only deposits that can be slow filled");
|
|
923
780
|
var destinationBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, destinationChainId, chainIds);
|
|
924
781
|
if (!slowFillRequest ||
|
|
925
782
|
slowFillRequest.blockNumber < destinationBlockRange[0]) {
|
|
926
|
-
validatedBundleUnexecutableSlowFills.push(
|
|
783
|
+
validatedBundleUnexecutableSlowFills.push(deposit);
|
|
927
784
|
}
|
|
928
785
|
});
|
|
929
786
|
return [2];
|
|
@@ -964,17 +821,13 @@ var BundleDataClient = (function () {
|
|
|
964
821
|
message: "Processed ".concat(fillCounter, " fills in ").concat(performance.now() - start, "ms."),
|
|
965
822
|
});
|
|
966
823
|
start = performance.now();
|
|
967
|
-
return [4, (0, utils_1.forEachAsync)(olderDepositHashes, function (
|
|
968
|
-
var _a,
|
|
969
|
-
return tslib_1.__generator(this, function (
|
|
970
|
-
switch (
|
|
824
|
+
return [4, (0, utils_1.forEachAsync)(olderDepositHashes, function (relayDataHash) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
825
|
+
var _a, deposit, slowFillRequest, fill, destinationChainId, destinationBlockRange, fillStatus;
|
|
826
|
+
return tslib_1.__generator(this, function (_b) {
|
|
827
|
+
switch (_b.label) {
|
|
971
828
|
case 0:
|
|
972
|
-
_a =
|
|
973
|
-
|
|
974
|
-
if (!deposits || deposits.length < 1) {
|
|
975
|
-
throw new Error("Deposit should exist in relay hash dictionary.");
|
|
976
|
-
}
|
|
977
|
-
deposit = deposits[index];
|
|
829
|
+
_a = v3RelayHashes[relayDataHash], deposit = _a.deposit, slowFillRequest = _a.slowFillRequest, fill = _a.fill;
|
|
830
|
+
(0, utils_1.assert)((0, utils_1.isDefined)(deposit), "Deposit should exist in relay hash dictionary.");
|
|
978
831
|
destinationChainId = deposit.destinationChainId;
|
|
979
832
|
destinationBlockRange = (0, utils_1.getBlockRangeForChain)(blockRangesForChains, destinationChainId, chainIds);
|
|
980
833
|
if (!(!fill &&
|
|
@@ -984,7 +837,7 @@ var BundleDataClient = (function () {
|
|
|
984
837
|
spokePoolClients[destinationChainId] !== undefined)) return [3, 2];
|
|
985
838
|
return [4, _getFillStatusForDeposit(deposit, destinationBlockRange[1])];
|
|
986
839
|
case 1:
|
|
987
|
-
fillStatus =
|
|
840
|
+
fillStatus = _b.sent();
|
|
988
841
|
if (fillStatus !== interfaces_1.FillStatus.Filled) {
|
|
989
842
|
updateExpiredDepositsV3(expiredDepositsToRefundV3, deposit);
|
|
990
843
|
}
|
|
@@ -994,7 +847,7 @@ var BundleDataClient = (function () {
|
|
|
994
847
|
if (!slowFillRequest || slowFillRequest.blockNumber < destinationBlockRange[0]) {
|
|
995
848
|
validatedBundleUnexecutableSlowFills.push(deposit);
|
|
996
849
|
}
|
|
997
|
-
|
|
850
|
+
_b.label = 2;
|
|
998
851
|
case 2: return [2];
|
|
999
852
|
}
|
|
1000
853
|
});
|
|
@@ -1005,7 +858,7 @@ var BundleDataClient = (function () {
|
|
|
1005
858
|
promises = [
|
|
1006
859
|
validatedBundleV3Fills.length > 0
|
|
1007
860
|
? this.clients.hubPoolClient.batchComputeRealizedLpFeePct(validatedBundleV3Fills.map(function (fill) {
|
|
1008
|
-
var matchedDeposit = v3RelayHashes[_this.getRelayHashFromEvent(fill)].
|
|
861
|
+
var matchedDeposit = v3RelayHashes[_this.getRelayHashFromEvent(fill)].deposit;
|
|
1009
862
|
(0, utils_1.assert)((0, utils_1.isDefined)(matchedDeposit), "Deposit should exist in relay hash dictionary.");
|
|
1010
863
|
var paymentChainId = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRangesForChains, chainIds, matchedDeposit.fromLiteChain).chainToSendRefundTo;
|
|
1011
864
|
return tslib_1.__assign(tslib_1.__assign({}, fill), { paymentChainId: paymentChainId });
|
|
@@ -1032,19 +885,14 @@ var BundleDataClient = (function () {
|
|
|
1032
885
|
v3FillLpFees.forEach(function (_a, idx) {
|
|
1033
886
|
var realizedLpFeePct = _a.realizedLpFeePct;
|
|
1034
887
|
var fill = validatedBundleV3Fills[idx];
|
|
1035
|
-
var associatedDeposit = v3RelayHashes[_this.getRelayHashFromEvent(fill)].
|
|
888
|
+
var associatedDeposit = v3RelayHashes[_this.getRelayHashFromEvent(fill)].deposit;
|
|
1036
889
|
(0, utils_1.assert)((0, utils_1.isDefined)(associatedDeposit), "Deposit should exist in relay hash dictionary.");
|
|
1037
890
|
var _b = (0, utils_2.getRefundInformationFromFill)(fill, _this.clients.hubPoolClient, blockRangesForChains, chainIds, associatedDeposit.fromLiteChain), chainToSendRefundTo = _b.chainToSendRefundTo, repaymentToken = _b.repaymentToken;
|
|
1038
|
-
updateBundleFillsV3(bundleFillsV3, fill, realizedLpFeePct, chainToSendRefundTo, repaymentToken
|
|
891
|
+
updateBundleFillsV3(bundleFillsV3, fill, realizedLpFeePct, chainToSendRefundTo, repaymentToken);
|
|
1039
892
|
});
|
|
1040
893
|
v3SlowFillLpFees.forEach(function (_a, idx) {
|
|
1041
894
|
var lpFeePct = _a.realizedLpFeePct;
|
|
1042
895
|
var deposit = validatedBundleSlowFills[idx];
|
|
1043
|
-
var relayDataHash = _this.getRelayHashFromEvent(deposit);
|
|
1044
|
-
if (validatedBundleSlowFills.slice(0, idx).some(function (d) { return _this.getRelayHashFromEvent(d) === relayDataHash; })) {
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
(0, utils_1.assert)(!_depositIsExpired(deposit), "Cannot create slow fill leaf for expired deposit.");
|
|
1048
896
|
updateBundleSlowFills(bundleSlowFillsV3, tslib_1.__assign(tslib_1.__assign({}, deposit), { lpFeePct: lpFeePct }));
|
|
1049
897
|
});
|
|
1050
898
|
v3UnexecutableSlowFillLpFees.forEach(function (_a, idx) {
|
|
@@ -1052,31 +900,15 @@ var BundleDataClient = (function () {
|
|
|
1052
900
|
var deposit = validatedBundleUnexecutableSlowFills[idx];
|
|
1053
901
|
updateBundleExcessSlowFills(unexecutableSlowFills, tslib_1.__assign(tslib_1.__assign({}, deposit), { lpFeePct: lpFeePct }));
|
|
1054
902
|
});
|
|
1055
|
-
v3SpokeEventsReadable = (0, utils_2.prettyPrintV3SpokePoolEvents)(bundleDepositsV3, bundleFillsV3, bundleSlowFillsV3, expiredDepositsToRefundV3, unexecutableSlowFills);
|
|
903
|
+
v3SpokeEventsReadable = (0, utils_2.prettyPrintV3SpokePoolEvents)(bundleDepositsV3, bundleFillsV3, bundleInvalidFillsV3, bundleSlowFillsV3, expiredDepositsToRefundV3, unexecutableSlowFills);
|
|
1056
904
|
if (bundleInvalidFillsV3.length > 0) {
|
|
1057
905
|
this.logger.debug({
|
|
1058
906
|
at: "BundleDataClient#loadData",
|
|
1059
|
-
message: "Finished loading V3 spoke pool data and found some invalid fills in range",
|
|
907
|
+
message: "Finished loading V3 spoke pool data and found some invalid V3 fills in range",
|
|
1060
908
|
blockRangesForChains: blockRangesForChains,
|
|
1061
909
|
bundleInvalidFillsV3: bundleInvalidFillsV3,
|
|
1062
910
|
});
|
|
1063
911
|
}
|
|
1064
|
-
if (bundleUnrepayableFillsV3.length > 0) {
|
|
1065
|
-
this.logger.debug({
|
|
1066
|
-
at: "BundleDataClient#loadData",
|
|
1067
|
-
message: "Finished loading V3 spoke pool data and found some unrepayable fills in range",
|
|
1068
|
-
blockRangesForChains: blockRangesForChains,
|
|
1069
|
-
bundleUnrepayableFillsV3: bundleUnrepayableFillsV3,
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
if (bundleInvalidSlowFillRequests.length > 0) {
|
|
1073
|
-
this.logger.debug({
|
|
1074
|
-
at: "BundleDataClient#loadData",
|
|
1075
|
-
message: "Finished loading V3 spoke pool data and found some invalid slow fill requests in range",
|
|
1076
|
-
blockRangesForChains: blockRangesForChains,
|
|
1077
|
-
bundleInvalidSlowFillRequests: bundleInvalidSlowFillRequests,
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
912
|
this.logger.debug({
|
|
1081
913
|
at: "BundleDataClient#loadDataFromScratch",
|
|
1082
914
|
message: "Computed bundle data in ".concat(Math.round(performance.now() - start) / 1000, "s."),
|
|
@@ -1097,16 +929,6 @@ var BundleDataClient = (function () {
|
|
|
1097
929
|
BundleDataClient.prototype.getRelayHashFromEvent = function (event) {
|
|
1098
930
|
return "".concat(event.depositor, "-").concat(event.recipient, "-").concat(event.exclusiveRelayer, "-").concat(event.inputToken, "-").concat(event.outputToken, "-").concat(event.inputAmount, "-").concat(event.outputAmount, "-").concat(event.originChainId, "-").concat(event.depositId.toString(), "-").concat(event.fillDeadline, "-").concat(event.exclusivityDeadline, "-").concat(event.message, "-").concat(event.destinationChainId);
|
|
1099
931
|
};
|
|
1100
|
-
BundleDataClient.prototype.findMatchingFillEvent = function (deposit, spokePoolClient) {
|
|
1101
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1102
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1103
|
-
switch (_a.label) {
|
|
1104
|
-
case 0: return [4, (0, utils_1.findFillEvent)(spokePoolClient.spokePool, deposit, spokePoolClient.deploymentBlock, spokePoolClient.latestBlockSearched)];
|
|
1105
|
-
case 1: return [2, _a.sent()];
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
};
|
|
1110
932
|
BundleDataClient.prototype.getBundleBlockTimestamps = function (chainIds, blockRangesForChains, spokePoolClients) {
|
|
1111
933
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1112
934
|
var _a, _b;
|
|
@@ -1116,7 +938,7 @@ var BundleDataClient = (function () {
|
|
|
1116
938
|
case 0:
|
|
1117
939
|
_b = (_a = Object).fromEntries;
|
|
1118
940
|
return [4, (0, utils_1.mapAsync)(chainIds, function (chainId, index) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
1119
|
-
var blockRangeForChain, _startBlockForChain, _endBlockForChain, spokePoolClient, startBlockForChain, endBlockForChain, _a, startTime,
|
|
941
|
+
var blockRangeForChain, _startBlockForChain, _endBlockForChain, spokePoolClient, startBlockForChain, endBlockForChain, _a, startTime, endTime, _b;
|
|
1120
942
|
return tslib_1.__generator(this, function (_c) {
|
|
1121
943
|
switch (_c.label) {
|
|
1122
944
|
case 0:
|
|
@@ -1130,7 +952,7 @@ var BundleDataClient = (function () {
|
|
|
1130
952
|
return [2];
|
|
1131
953
|
}
|
|
1132
954
|
startBlockForChain = Math.min(_startBlockForChain, spokePoolClient.latestBlockSearched);
|
|
1133
|
-
endBlockForChain = Math.min(_endBlockForChain
|
|
955
|
+
endBlockForChain = Math.min(_endBlockForChain, spokePoolClient.latestBlockSearched);
|
|
1134
956
|
return [4, spokePoolClient.getTimestampForBlock(startBlockForChain)];
|
|
1135
957
|
case 1:
|
|
1136
958
|
_b = [
|
|
@@ -1140,10 +962,8 @@ var BundleDataClient = (function () {
|
|
|
1140
962
|
case 2:
|
|
1141
963
|
_a = _b.concat([
|
|
1142
964
|
_c.sent()
|
|
1143
|
-
]), startTime = _a[0],
|
|
1144
|
-
|
|
1145
|
-
endTime = Math.max(0, _endTime - endBlockDelta);
|
|
1146
|
-
(0, utils_1.assert)(endTime >= startTime, "End time for block ".concat(endBlockForChain, " should be greater than start time for block ").concat(startBlockForChain, ": ").concat(endTime, " >= ").concat(startTime, "."));
|
|
965
|
+
]), startTime = _a[0], endTime = _a[1];
|
|
966
|
+
(0, utils_1.assert)(endTime >= startTime, "End time should be greater than start time.");
|
|
1147
967
|
(0, utils_1.assert)(startBlockForChain === 0 || startTime > 0, "Start timestamp must be greater than 0 if the start block is greater than 0.");
|
|
1148
968
|
return [2, [chainId, [startTime, endTime]]];
|
|
1149
969
|
}
|