@across-protocol/sdk 4.2.12 → 4.2.14-alpha.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/arch/evm/SpokeUtils.d.ts +5 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +22 -5
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +14 -11
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +1 -1
- package/dist/cjs/arch/svm/utils.js +19 -14
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +11 -8
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
- package/dist/cjs/clients/HubPoolClient.js +83 -59
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +53 -61
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +39 -36
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/HubPool.d.ts +19 -14
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +14 -15
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +6 -3
- package/dist/cjs/utils/AddressUtils.js +42 -14
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +4 -22
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +3 -3
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +5 -2
- package/dist/esm/arch/evm/SpokeUtils.js +23 -6
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.js +15 -12
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +1 -1
- package/dist/esm/arch/svm/utils.js +19 -14
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +4 -3
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +23 -22
- package/dist/esm/clients/HubPoolClient.js +96 -63
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +55 -65
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +41 -38
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/HubPool.d.ts +19 -14
- package/dist/esm/interfaces/SpokePool.d.ts +13 -13
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +15 -16
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +7 -3
- package/dist/esm/utils/AddressUtils.js +52 -19
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +3 -8
- package/dist/esm/utils/SpokeUtils.js +4 -26
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +18 -16
- package/dist/esm/utils/TokenUtils.js +3 -3
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +5 -2
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +1 -1
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +23 -22
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +19 -14
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +13 -13
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +7 -3
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +3 -8
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +18 -16
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/arch/evm/SpokeUtils.ts +53 -11
- package/src/arch/svm/SpokeUtils.ts +44 -11
- package/src/arch/svm/utils.ts +9 -4
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
- package/src/clients/BundleDataClient/BundleDataClient.ts +54 -52
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
- package/src/clients/BundleDataClient/utils/FillUtils.ts +6 -4
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
- package/src/clients/HubPoolClient.ts +122 -82
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +110 -56
- package/src/clients/mocks/MockHubPoolClient.ts +24 -19
- package/src/clients/mocks/MockSpokePoolClient.ts +37 -26
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
- package/src/interfaces/HubPool.ts +23 -14
- package/src/interfaces/SpokePool.ts +13 -13
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +10 -8
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +16 -21
- package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
- package/src/utils/AddressUtils.ts +56 -21
- package/src/utils/SpokeUtils.ts +11 -33
- package/src/utils/TokenUtils.ts +7 -7
|
@@ -13,13 +13,12 @@ import {
|
|
|
13
13
|
isDefined,
|
|
14
14
|
getMessageHash,
|
|
15
15
|
isSlowFill,
|
|
16
|
-
isValidEvmAddress,
|
|
17
16
|
isZeroAddress,
|
|
18
|
-
toAddress,
|
|
19
17
|
validateFillForDeposit,
|
|
20
18
|
chainIsEvm,
|
|
21
19
|
chainIsProd,
|
|
22
20
|
Address,
|
|
21
|
+
toAddressType,
|
|
23
22
|
} from "../../utils";
|
|
24
23
|
import { duplicateEvent, sortEventsAscendingInPlace } from "../../utils/EventUtils";
|
|
25
24
|
import { ZERO_ADDRESS } from "../../constants";
|
|
@@ -37,6 +36,7 @@ import {
|
|
|
37
36
|
SortableEvent,
|
|
38
37
|
SpeedUpWithBlock,
|
|
39
38
|
TokensBridged,
|
|
39
|
+
RelayExecutionEventInfo,
|
|
40
40
|
} from "../../interfaces";
|
|
41
41
|
import { BaseAbstractClient, UpdateFailureReason } from "../BaseAbstractClient";
|
|
42
42
|
import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
|
|
@@ -202,8 +202,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
202
202
|
* @param relayer The relayer address.
|
|
203
203
|
* @returns A list of fills.
|
|
204
204
|
*/
|
|
205
|
-
public getFillsForRelayer(relayer:
|
|
206
|
-
return this.getFills().filter((fill) => fill.relayer
|
|
205
|
+
public getFillsForRelayer(relayer: Address): FillWithBlock[] {
|
|
206
|
+
return this.getFills().filter((fill) => fill.relayer.eq(relayer));
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/**
|
|
@@ -251,7 +251,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
251
251
|
const { depositId, depositor } = deposit;
|
|
252
252
|
|
|
253
253
|
// Note: we know depositor cannot be more than 20 bytes since this is guaranteed by contracts.
|
|
254
|
-
|
|
254
|
+
// Additionally, speed ups can only be done on EVM networks.
|
|
255
|
+
const speedups = this.speedUps[depositor.toEvmAddress()]?.[depositId.toString()];
|
|
255
256
|
|
|
256
257
|
if (!isDefined(speedups) || speedups.length === 0) {
|
|
257
258
|
return deposit;
|
|
@@ -384,7 +385,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
384
385
|
if (
|
|
385
386
|
this.hubPoolClient &&
|
|
386
387
|
!isSlowFill(fill) &&
|
|
387
|
-
|
|
388
|
+
chainIsEvm(repaymentChainId) &&
|
|
389
|
+
!fill.relayer.isValidEvmAddress()
|
|
388
390
|
) {
|
|
389
391
|
groupedFills.unrepayableFills.push(fill);
|
|
390
392
|
}
|
|
@@ -399,34 +401,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
399
401
|
{ validFills: [], invalidFills: [], unrepayableFills: [] }
|
|
400
402
|
);
|
|
401
403
|
|
|
402
|
-
|
|
403
|
-
const invalidFillsForDeposit = invalidFills.filter((x) => {
|
|
404
|
-
const txnUid = `${x.txnRef}:${x.logIndex}`;
|
|
405
|
-
// if txnUid doesn't exist in the invalidFills set, add it now, but log the corresponding fill.
|
|
406
|
-
const newInvalidFill = x.depositId.eq(deposit.depositId) && !this.invalidFills.has(txnUid);
|
|
407
|
-
if (newInvalidFill) {
|
|
408
|
-
this.invalidFills.add(txnUid);
|
|
409
|
-
}
|
|
410
|
-
return newInvalidFill;
|
|
411
|
-
});
|
|
412
|
-
// Log invalid and unrepayable fills as warns if we are on a production network.
|
|
413
|
-
const suppressWarn = process.env.RELAYER_SUPPRESS_INVALID_FILLS === "true";
|
|
414
|
-
const logLevel = chainIsProd(originChainId) && !suppressWarn ? "warn" : "debug";
|
|
415
|
-
if (invalidFillsForDeposit.length > 0) {
|
|
416
|
-
const invalidFills = Object.fromEntries(
|
|
417
|
-
invalidFillsForDeposit.map(({ relayer, originChainId, destinationChainId, depositId, txnRef }) => {
|
|
418
|
-
return [relayer, { originChainId, destinationChainId, depositId, txnRef }];
|
|
419
|
-
})
|
|
420
|
-
);
|
|
421
|
-
this.logger[logLevel]({
|
|
422
|
-
at: "SpokePoolClient",
|
|
423
|
-
chainId: this.chainId,
|
|
424
|
-
message: "Invalid fills found matching deposit ID",
|
|
425
|
-
deposit,
|
|
426
|
-
invalidFills,
|
|
427
|
-
notificationPath: "across-invalid-fills",
|
|
428
|
-
});
|
|
429
|
-
}
|
|
404
|
+
const logLevel = chainIsProd(originChainId) ? "warn" : "debug";
|
|
430
405
|
const unrepayableFillsForDeposit = unrepayableFills.filter((x) => x.depositId.eq(deposit.depositId));
|
|
431
406
|
if (unrepayableFillsForDeposit.length > 0) {
|
|
432
407
|
this.logger[logLevel]({
|
|
@@ -434,7 +409,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
434
409
|
chainId: this.chainId,
|
|
435
410
|
message: "Unrepayable fills found where we need to switch repayment address and or chain",
|
|
436
411
|
deposit,
|
|
437
|
-
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer, x])),
|
|
412
|
+
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer.toAddress(), x])),
|
|
438
413
|
notificationPath: "across-unrepayable-fills",
|
|
439
414
|
});
|
|
440
415
|
}
|
|
@@ -506,14 +481,36 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
506
481
|
const { events: queryResults, currentTime, searchEndBlock } = update;
|
|
507
482
|
|
|
508
483
|
if (eventsToQuery.includes("TokensBridged")) {
|
|
509
|
-
for (const
|
|
510
|
-
|
|
484
|
+
for (const _event of queryResults[eventsToQuery.indexOf("TokensBridged")]) {
|
|
485
|
+
const event = _event as TokensBridged & {
|
|
486
|
+
l2TokenAddress: string;
|
|
487
|
+
};
|
|
488
|
+
this.tokensBridged.push({
|
|
489
|
+
...event,
|
|
490
|
+
l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
|
|
491
|
+
});
|
|
511
492
|
}
|
|
512
493
|
}
|
|
513
494
|
|
|
514
495
|
// Performs the indexing of a deposit-like spoke pool event.
|
|
515
496
|
const queryDepositEvents = async (eventName: string) => {
|
|
516
|
-
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
497
|
+
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
498
|
+
const event = _event as DepositWithBlock & {
|
|
499
|
+
depositor: string;
|
|
500
|
+
recipient: string;
|
|
501
|
+
inputToken: string;
|
|
502
|
+
outputToken: string;
|
|
503
|
+
exclusiveRelayer: string;
|
|
504
|
+
};
|
|
505
|
+
return {
|
|
506
|
+
...event,
|
|
507
|
+
depositor: toAddressType(event.depositor, this.chainId),
|
|
508
|
+
recipient: toAddressType(event.recipient, event.destinationChainId),
|
|
509
|
+
inputToken: toAddressType(event.inputToken, this.chainId),
|
|
510
|
+
outputToken: toAddressType(event.outputToken, event.destinationChainId),
|
|
511
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer, event.destinationChainId),
|
|
512
|
+
} as DepositWithBlock;
|
|
513
|
+
});
|
|
517
514
|
if (depositEvents.length > 0) {
|
|
518
515
|
this.log(
|
|
519
516
|
"debug",
|
|
@@ -570,11 +567,21 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
570
567
|
|
|
571
568
|
// Performs indexing of a "speed up deposit"-like event.
|
|
572
569
|
const querySpeedUpDepositEvents = (eventName: string) => {
|
|
573
|
-
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
570
|
+
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
571
|
+
const event = _event as SpeedUpWithBlock & { depositor: string; updatedRecipient: string };
|
|
572
|
+
return {
|
|
573
|
+
...event,
|
|
574
|
+
depositor: toAddressType(event.depositor, this.chainId),
|
|
575
|
+
updatedRecipient: toAddressType(event.updatedRecipient),
|
|
576
|
+
} as SpeedUpWithBlock;
|
|
577
|
+
});
|
|
574
578
|
|
|
575
579
|
for (const event of speedUpEvents) {
|
|
576
|
-
const speedUp = {
|
|
577
|
-
|
|
580
|
+
const speedUp = {
|
|
581
|
+
...event,
|
|
582
|
+
originChainId: this.chainId,
|
|
583
|
+
};
|
|
584
|
+
assign(this.speedUps, [speedUp.depositor.toAddress(), speedUp.depositId.toString()], [speedUp]);
|
|
578
585
|
|
|
579
586
|
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
580
587
|
// if the hash+data exists.
|
|
@@ -598,7 +605,23 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
598
605
|
|
|
599
606
|
// Performs indexing of "requested slow fill"-like events.
|
|
600
607
|
const queryRequestedSlowFillEvents = (eventName: string) => {
|
|
601
|
-
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
608
|
+
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
609
|
+
const event = _event as SlowFillRequestWithBlock & {
|
|
610
|
+
depositor: string;
|
|
611
|
+
recipient: string;
|
|
612
|
+
inputToken: string;
|
|
613
|
+
outputToken: string;
|
|
614
|
+
exclusiveRelayer: string;
|
|
615
|
+
};
|
|
616
|
+
return {
|
|
617
|
+
...event,
|
|
618
|
+
depositor: toAddressType(event.depositor, event.originChainId),
|
|
619
|
+
recipient: toAddressType(event.recipient, this.chainId),
|
|
620
|
+
inputToken: toAddressType(event.inputToken, event.originChainId),
|
|
621
|
+
outputToken: toAddressType(event.outputToken, this.chainId),
|
|
622
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
|
|
623
|
+
} as SlowFillRequestWithBlock;
|
|
624
|
+
});
|
|
602
625
|
for (const event of slowFillRequests) {
|
|
603
626
|
const slowFillRequest = {
|
|
604
627
|
...event,
|
|
@@ -625,7 +648,30 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
625
648
|
|
|
626
649
|
// Performs indexing of filled relay-like events.
|
|
627
650
|
const queryFilledRelayEvents = (eventName: string) => {
|
|
628
|
-
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
651
|
+
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
652
|
+
const event = _event as FillWithBlock & {
|
|
653
|
+
depositor: string;
|
|
654
|
+
recipient: string;
|
|
655
|
+
inputToken: string;
|
|
656
|
+
outputToken: string;
|
|
657
|
+
exclusiveRelayer: string;
|
|
658
|
+
relayer: string;
|
|
659
|
+
relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
|
|
660
|
+
};
|
|
661
|
+
return {
|
|
662
|
+
...event,
|
|
663
|
+
depositor: toAddressType(event.depositor, event.originChainId),
|
|
664
|
+
recipient: toAddressType(event.recipient, this.chainId),
|
|
665
|
+
inputToken: toAddressType(event.inputToken, event.originChainId),
|
|
666
|
+
outputToken: toAddressType(event.outputToken, this.chainId),
|
|
667
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
|
|
668
|
+
relayer: toAddressType(event.relayer, this.chainId),
|
|
669
|
+
relayExecutionInfo: {
|
|
670
|
+
...event.relayExecutionInfo,
|
|
671
|
+
updatedRecipient: toAddressType(event.relayExecutionInfo.updatedRecipient, this.chainId),
|
|
672
|
+
},
|
|
673
|
+
} as FillWithBlock;
|
|
674
|
+
});
|
|
629
675
|
|
|
630
676
|
if (fillEvents.length > 0) {
|
|
631
677
|
this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
|
|
@@ -661,8 +707,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
661
707
|
});
|
|
662
708
|
|
|
663
709
|
if (eventsToQuery.includes("EnabledDepositRoute")) {
|
|
664
|
-
const enableDepositsEvents =
|
|
665
|
-
|
|
710
|
+
const enableDepositsEvents = queryResults[
|
|
711
|
+
eventsToQuery.indexOf("EnabledDepositRoute")
|
|
712
|
+
] as EnabledDepositRouteWithBlock[];
|
|
666
713
|
|
|
667
714
|
for (const event of enableDepositsEvents) {
|
|
668
715
|
assign(this.depositRoutes, [event.originToken, event.destinationChainId], event.enabled);
|
|
@@ -670,18 +717,23 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
670
717
|
}
|
|
671
718
|
|
|
672
719
|
if (eventsToQuery.includes("RelayedRootBundle")) {
|
|
673
|
-
const relayedRootBundleEvents =
|
|
674
|
-
|
|
720
|
+
const relayedRootBundleEvents = queryResults[
|
|
721
|
+
eventsToQuery.indexOf("RelayedRootBundle")
|
|
722
|
+
] as RootBundleRelayWithBlock[];
|
|
675
723
|
for (const event of relayedRootBundleEvents) {
|
|
676
724
|
this.rootBundleRelays.push(event);
|
|
677
725
|
}
|
|
678
726
|
}
|
|
679
727
|
|
|
680
728
|
if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
|
|
681
|
-
const refundEvents =
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
this.relayerRefundExecutions.push(
|
|
729
|
+
const refundEvents = queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")];
|
|
730
|
+
for (const _event of refundEvents) {
|
|
731
|
+
const event = _event as { l2TokenAddress: string; refundAddresses: string[] } & RelayerRefundExecutionWithBlock;
|
|
732
|
+
this.relayerRefundExecutions.push({
|
|
733
|
+
...event,
|
|
734
|
+
l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
|
|
735
|
+
refundAddresses: event.refundAddresses.map((addr) => toAddressType(addr, this.chainId)),
|
|
736
|
+
});
|
|
685
737
|
}
|
|
686
738
|
}
|
|
687
739
|
|
|
@@ -729,9 +781,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
729
781
|
* @param deposit The deposit to retrieve the destination token for.
|
|
730
782
|
* @returns The destination token.
|
|
731
783
|
*/
|
|
732
|
-
protected getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
784
|
+
protected getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
|
|
733
785
|
if (!this.canResolveZeroAddressOutputToken(deposit)) {
|
|
734
|
-
return ZERO_ADDRESS;
|
|
786
|
+
return toAddressType(ZERO_ADDRESS);
|
|
735
787
|
}
|
|
736
788
|
// L1 token should be resolved if we get here:
|
|
737
789
|
const l1Token = this.hubPoolClient!.getL1TokenForL2TokenAtBlock(
|
|
@@ -739,10 +791,12 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
739
791
|
deposit.originChainId,
|
|
740
792
|
deposit.quoteBlockNumber
|
|
741
793
|
)!;
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
794
|
+
const counterpartToken = this.hubPoolClient!.getL2TokenForL1TokenAtBlock(
|
|
795
|
+
l1Token,
|
|
796
|
+
deposit.destinationChainId,
|
|
797
|
+
deposit.quoteBlockNumber
|
|
745
798
|
);
|
|
799
|
+
return counterpartToken ?? toAddressType(ZERO_ADDRESS);
|
|
746
800
|
}
|
|
747
801
|
|
|
748
802
|
/**
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import winston from "winston";
|
|
2
2
|
import { Contract } from "ethers";
|
|
3
|
-
import { BigNumber, randomAddress, assign, bnZero } from "../../utils";
|
|
4
|
-
import {
|
|
3
|
+
import { BigNumber, randomAddress, assign, bnZero, toAddressType, EvmAddress, Address, isDefined } from "../../utils";
|
|
4
|
+
import { TokenInfo, Log, PendingRootBundle, RealizedLpFee, L1TokenInfo } from "../../interfaces";
|
|
5
5
|
import { AcrossConfigStoreClient as ConfigStoreClient } from "../AcrossConfigStoreClient";
|
|
6
6
|
import { HubPoolClient, HubPoolUpdate, LpFeeRequest } from "../HubPoolClient";
|
|
7
7
|
import { EventManager, EventOverrides, getEventManager } from "./MockEvents";
|
|
8
|
+
import { ZERO_ADDRESS } from "../../constants";
|
|
8
9
|
|
|
9
10
|
const emptyRootBundle: PendingRootBundle = {
|
|
10
11
|
poolRebalanceRoot: "",
|
|
11
12
|
relayerRefundRoot: "",
|
|
12
13
|
slowRelayRoot: "",
|
|
13
|
-
proposer:
|
|
14
|
+
proposer: EvmAddress.from(ZERO_ADDRESS),
|
|
14
15
|
unclaimedPoolRebalanceLeafCount: 0,
|
|
15
16
|
challengePeriodEndTimestamp: 0,
|
|
16
17
|
bundleEvaluationBlockNumbers: [],
|
|
@@ -22,9 +23,9 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
22
23
|
private realizedLpFeePct: BigNumber = bnZero;
|
|
23
24
|
private realizedLpFeePctOverride = false;
|
|
24
25
|
|
|
25
|
-
private l1TokensMock:
|
|
26
|
+
private l1TokensMock: L1TokenInfo[] = []; // L1Tokens and their associated info.
|
|
26
27
|
|
|
27
|
-
private spokePoolTokens: { [l1Token: string]: { [chainId: number]:
|
|
28
|
+
private spokePoolTokens: { [l1Token: string]: { [chainId: number]: Address } } = {};
|
|
28
29
|
|
|
29
30
|
private eventManager: EventManager;
|
|
30
31
|
|
|
@@ -69,7 +70,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
69
70
|
[chainId],
|
|
70
71
|
[
|
|
71
72
|
{
|
|
72
|
-
spokePool: contract,
|
|
73
|
+
spokePool: toAddressType(contract),
|
|
73
74
|
blockNumber: blockNumber,
|
|
74
75
|
transactionIndex: 0,
|
|
75
76
|
logIndex: 0,
|
|
@@ -82,7 +83,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
82
83
|
this.latestHeightSearched = blockNumber;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
addL1Token(l1Token:
|
|
86
|
+
addL1Token(l1Token: TokenInfo) {
|
|
86
87
|
this.l1TokensMock.push(l1Token);
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -92,19 +93,19 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
92
93
|
|
|
93
94
|
setTokenMapping(l1Token: string, chainId: number, l2Token: string) {
|
|
94
95
|
this.spokePoolTokens[l1Token] ??= {};
|
|
95
|
-
this.spokePoolTokens[l1Token][chainId] = l2Token;
|
|
96
|
+
this.spokePoolTokens[l1Token][chainId] = toAddressType(l2Token);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
l2TokenEnabledForL1TokenAtBlock(l1Token:
|
|
99
|
-
if (this.spokePoolTokens[l1Token]?.[destinationChainId]) {
|
|
99
|
+
l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean {
|
|
100
|
+
if (this.spokePoolTokens[l1Token.toEvmAddress()]?.[destinationChainId]) {
|
|
100
101
|
return true;
|
|
101
102
|
} else {
|
|
102
103
|
return super.l2TokenEnabledForL1TokenAtBlock(l1Token, destinationChainId, hubBlockNumber);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
l2TokenHasPoolRebalanceRoute(l2Token:
|
|
106
|
+
l2TokenHasPoolRebalanceRoute(l2Token: Address, chainId: number, hubPoolBlock: number): boolean {
|
|
106
107
|
const l1Token = Object.keys(this.spokePoolTokens).find(
|
|
107
|
-
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId]
|
|
108
|
+
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId]?.eq(l2Token)
|
|
108
109
|
);
|
|
109
110
|
if (!l1Token) {
|
|
110
111
|
return super.l2TokenHasPoolRebalanceRoute(l2Token, chainId, hubPoolBlock);
|
|
@@ -115,20 +116,24 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
115
116
|
delete this.spokePoolTokens[l1Token]?.[chainId];
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
getL1TokenForL2TokenAtBlock(l2Token:
|
|
119
|
+
getL1TokenForL2TokenAtBlock(l2Token: Address, chainId: number, blockNumber: number): EvmAddress {
|
|
119
120
|
const l1Token = Object.keys(this.spokePoolTokens).find(
|
|
120
|
-
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId]
|
|
121
|
+
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId].eq(l2Token)
|
|
121
122
|
);
|
|
122
|
-
|
|
123
|
+
if (isDefined(l1Token)) {
|
|
124
|
+
return EvmAddress.from(l1Token);
|
|
125
|
+
} else {
|
|
126
|
+
return super.getL1TokenForL2TokenAtBlock(l2Token, chainId, blockNumber);
|
|
127
|
+
}
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
getL2TokenForL1TokenAtBlock(l1Token:
|
|
126
|
-
const l2Token = this.spokePoolTokens[l1Token]?.[chainId];
|
|
130
|
+
getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, chainId: number, blockNumber: number): Address {
|
|
131
|
+
const l2Token = this.spokePoolTokens[l1Token.toEvmAddress()]?.[chainId];
|
|
127
132
|
return l2Token ?? super.getL2TokenForL1TokenAtBlock(l1Token, chainId, blockNumber);
|
|
128
133
|
}
|
|
129
134
|
|
|
130
|
-
getTokenInfoForL1Token(l1Token:
|
|
131
|
-
return this.l1TokensMock.find((token) => token.address
|
|
135
|
+
getTokenInfoForL1Token(l1Token: EvmAddress): TokenInfo | undefined {
|
|
136
|
+
return this.l1TokensMock.find((token) => token.address.eq(l1Token));
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
_update(eventNames: string[]): Promise<HubPoolUpdate> {
|
|
@@ -2,7 +2,7 @@ import assert from "assert";
|
|
|
2
2
|
import { Contract } from "ethers";
|
|
3
3
|
import { random } from "lodash";
|
|
4
4
|
import winston from "winston";
|
|
5
|
-
import { EMPTY_MESSAGE, ZERO_ADDRESS } from "../../constants";
|
|
5
|
+
import { EMPTY_MESSAGE, ZERO_ADDRESS, ZERO_BYTES } from "../../constants";
|
|
6
6
|
import {
|
|
7
7
|
Log,
|
|
8
8
|
Deposit,
|
|
@@ -27,6 +27,9 @@ import {
|
|
|
27
27
|
bnOne,
|
|
28
28
|
toBytes32,
|
|
29
29
|
spreadEventWithBlockNumber,
|
|
30
|
+
Address,
|
|
31
|
+
toAddressType,
|
|
32
|
+
isDefined,
|
|
30
33
|
} from "../../utils";
|
|
31
34
|
import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
|
|
32
35
|
import { HubPoolClient } from "../HubPoolClient";
|
|
@@ -62,8 +65,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
62
65
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
66
|
-
|
|
68
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
|
|
69
|
+
const override = this.destinationTokenForChainOverride[deposit.originChainId];
|
|
70
|
+
return isDefined(override)
|
|
71
|
+
? toAddressType(override, deposit.destinationChainId)
|
|
72
|
+
: super.getDestinationTokenForDeposit(deposit);
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -129,23 +135,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
129
135
|
return this._deposit("FundsDeposited", deposit);
|
|
130
136
|
}
|
|
131
137
|
|
|
132
|
-
protected _deposit(
|
|
138
|
+
protected _deposit(
|
|
139
|
+
event: string,
|
|
140
|
+
deposit: Omit<Deposit, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
141
|
+
): Log {
|
|
133
142
|
const { blockNumber, txnIndex } = deposit;
|
|
134
143
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
135
144
|
depositId ??= this.numberOfDeposits;
|
|
136
145
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
137
146
|
|
|
138
147
|
destinationChainId ??= random(1, 42161, false);
|
|
139
|
-
const depositor =
|
|
140
|
-
const recipient =
|
|
141
|
-
const inputToken =
|
|
142
|
-
const outputToken =
|
|
143
|
-
const exclusiveRelayer =
|
|
148
|
+
const depositor = deposit.depositor?.toBytes32() ?? toBytes32(randomAddress());
|
|
149
|
+
const recipient = deposit.recipient?.toBytes32() ?? toBytes32(depositor);
|
|
150
|
+
const inputToken = deposit.inputToken?.toBytes32() ?? toBytes32(randomAddress());
|
|
151
|
+
const outputToken = deposit.outputToken?.toBytes32() ?? inputToken;
|
|
152
|
+
const exclusiveRelayer = deposit.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
144
153
|
|
|
145
154
|
inputAmount ??= toBNWei(random(1, 1000, false));
|
|
146
155
|
outputAmount ??= inputAmount.mul(toBN("0.95"));
|
|
147
156
|
|
|
148
|
-
const message = deposit
|
|
157
|
+
const message = deposit.message ?? "0x";
|
|
149
158
|
const topics = [destinationChainId, depositId, depositor];
|
|
150
159
|
const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
|
|
151
160
|
const args = {
|
|
@@ -191,19 +200,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
191
200
|
outputAmount ??= inputAmount;
|
|
192
201
|
fillDeadline ??= getCurrentTime() + 60;
|
|
193
202
|
|
|
194
|
-
const depositor =
|
|
195
|
-
const recipient =
|
|
196
|
-
const inputToken =
|
|
197
|
-
const outputToken =
|
|
198
|
-
const exclusiveRelayer =
|
|
199
|
-
const relayer =
|
|
203
|
+
const depositor = fill.depositor?.toBytes32() ?? toBytes32(randomAddress());
|
|
204
|
+
const recipient = fill.recipient?.toBytes32() ?? toBytes32(depositor);
|
|
205
|
+
const inputToken = fill.inputToken?.toBytes32() ?? toBytes32(randomAddress());
|
|
206
|
+
const outputToken = fill.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
207
|
+
const exclusiveRelayer = fill.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
208
|
+
const relayer = fill.relayer?.toBytes32() ?? toBytes32(randomAddress());
|
|
200
209
|
|
|
201
210
|
const topics = [originChainId, depositId, relayer];
|
|
202
211
|
const message = fill.message ?? EMPTY_MESSAGE;
|
|
203
212
|
const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
|
|
213
|
+
const updatedRecipient = fill.relayExecutionInfo?.updatedRecipient.toBytes32() ?? recipient;
|
|
204
214
|
|
|
205
215
|
const relayExecutionInfo = {
|
|
206
|
-
updatedRecipient
|
|
216
|
+
updatedRecipient,
|
|
207
217
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
208
218
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
209
219
|
};
|
|
@@ -223,7 +233,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
223
233
|
depositor,
|
|
224
234
|
recipient,
|
|
225
235
|
relayExecutionInfo: {
|
|
226
|
-
updatedRecipient
|
|
236
|
+
updatedRecipient,
|
|
227
237
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
228
238
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
229
239
|
},
|
|
@@ -253,7 +263,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
253
263
|
}
|
|
254
264
|
|
|
255
265
|
protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
|
|
256
|
-
const depositor =
|
|
266
|
+
const depositor = speedUp.depositor.toBytes32();
|
|
257
267
|
const topics = [speedUp.depositId, depositor];
|
|
258
268
|
const args = { ...speedUp };
|
|
259
269
|
|
|
@@ -264,7 +274,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
264
274
|
args: {
|
|
265
275
|
...args,
|
|
266
276
|
depositor,
|
|
267
|
-
updatedRecipient:
|
|
277
|
+
updatedRecipient: speedUp.updatedRecipient.toBytes32(),
|
|
268
278
|
},
|
|
269
279
|
});
|
|
270
280
|
}
|
|
@@ -294,7 +304,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
294
304
|
const topics = [originChainId, depositId];
|
|
295
305
|
const args = { ...request };
|
|
296
306
|
|
|
297
|
-
const depositor =
|
|
307
|
+
const depositor = args.depositor.toBytes32() ?? toBytes32(randomAddress());
|
|
298
308
|
|
|
299
309
|
return this.eventManager.generateEvent({
|
|
300
310
|
event,
|
|
@@ -304,10 +314,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
304
314
|
...args,
|
|
305
315
|
destinationChainId: this.chainId,
|
|
306
316
|
depositor,
|
|
307
|
-
recipient:
|
|
308
|
-
inputToken:
|
|
309
|
-
outputToken:
|
|
310
|
-
exclusiveRelayer:
|
|
317
|
+
recipient: args.recipient?.toBytes32() ?? depositor,
|
|
318
|
+
inputToken: args.inputToken?.toBytes32() ?? toBytes32(randomAddress()),
|
|
319
|
+
outputToken: args.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
|
|
320
|
+
exclusiveRelayer: args.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
|
|
321
|
+
messageHash: args.messageHash ?? ZERO_BYTES,
|
|
311
322
|
},
|
|
312
323
|
blockNumber: request.blockNumber,
|
|
313
324
|
transactionIndex: request.txnIndex,
|
|
@@ -320,7 +331,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
320
331
|
const fill = {
|
|
321
332
|
...leaf.relayData,
|
|
322
333
|
destinationChainId: this.chainId,
|
|
323
|
-
relayer: ZERO_ADDRESS,
|
|
334
|
+
relayer: toAddressType(ZERO_ADDRESS),
|
|
324
335
|
repaymentChainId: 0,
|
|
325
336
|
relayExecutionInfo: {
|
|
326
337
|
updatedRecipient: leaf.relayData.recipient,
|
|
@@ -2,7 +2,15 @@ import winston from "winston";
|
|
|
2
2
|
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
3
|
import { Address } from "@solana/kit";
|
|
4
4
|
import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getCurrentTime,
|
|
7
|
+
bnZero,
|
|
8
|
+
MakeOptional,
|
|
9
|
+
EventSearchConfig,
|
|
10
|
+
Address as SDKAddress,
|
|
11
|
+
toAddressType,
|
|
12
|
+
isDefined,
|
|
13
|
+
} from "../../utils";
|
|
6
14
|
import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
|
|
7
15
|
import { HubPoolClient } from "../HubPoolClient";
|
|
8
16
|
import { EventOverrides } from "./MockEvents";
|
|
@@ -46,8 +54,9 @@ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
|
|
|
46
54
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
50
|
-
|
|
57
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): SDKAddress {
|
|
58
|
+
const override = this.destinationTokenForChainOverride[deposit.originChainId];
|
|
59
|
+
return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from "../utils";
|
|
1
|
+
import { Address, BigNumber, EvmAddress } from "../utils";
|
|
2
2
|
import { SortableEvent } from "./Common";
|
|
3
3
|
|
|
4
4
|
export interface PoolRebalanceLeaf {
|
|
@@ -8,7 +8,7 @@ export interface PoolRebalanceLeaf {
|
|
|
8
8
|
netSendAmounts: BigNumber[];
|
|
9
9
|
runningBalances: BigNumber[];
|
|
10
10
|
leafId: number;
|
|
11
|
-
l1Tokens:
|
|
11
|
+
l1Tokens: EvmAddress[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface RelayerRefundLeaf {
|
|
@@ -16,8 +16,8 @@ export interface RelayerRefundLeaf {
|
|
|
16
16
|
chainId: number;
|
|
17
17
|
refundAmounts: BigNumber[];
|
|
18
18
|
leafId: number;
|
|
19
|
-
l2TokenAddress:
|
|
20
|
-
refundAddresses:
|
|
19
|
+
l2TokenAddress: Address;
|
|
20
|
+
refundAddresses: Address[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface ProposedRootBundle extends SortableEvent {
|
|
@@ -27,7 +27,7 @@ export interface ProposedRootBundle extends SortableEvent {
|
|
|
27
27
|
poolRebalanceRoot: string;
|
|
28
28
|
relayerRefundRoot: string;
|
|
29
29
|
slowRelayRoot: string;
|
|
30
|
-
proposer:
|
|
30
|
+
proposer: EvmAddress;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type RealizedLpFee = {
|
|
@@ -55,7 +55,7 @@ export interface ExecutedRootBundle extends SortableEvent {
|
|
|
55
55
|
netSendAmounts: BigNumber[];
|
|
56
56
|
runningBalances: BigNumber[];
|
|
57
57
|
leafId: number;
|
|
58
|
-
l1Tokens:
|
|
58
|
+
l1Tokens: EvmAddress[];
|
|
59
59
|
proof: string[];
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -76,8 +76,14 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
|
|
|
76
76
|
groupIndex: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export interface
|
|
80
|
-
address:
|
|
79
|
+
export interface L1TokenInfo {
|
|
80
|
+
address: EvmAddress;
|
|
81
|
+
symbol: string;
|
|
82
|
+
decimals: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface TokenInfo {
|
|
86
|
+
address: Address;
|
|
81
87
|
symbol: string;
|
|
82
88
|
decimals: number;
|
|
83
89
|
}
|
|
@@ -87,27 +93,30 @@ export interface LpToken {
|
|
|
87
93
|
liquidReserves: BigNumber;
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
90
97
|
export interface CrossChainContractsSet extends SortableEvent {
|
|
91
98
|
l2ChainId: number;
|
|
92
|
-
spokePool:
|
|
99
|
+
spokePool: Address;
|
|
93
100
|
}
|
|
94
101
|
|
|
102
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
95
103
|
export interface DestinationTokenWithBlock extends SortableEvent {
|
|
96
|
-
l2Token:
|
|
97
|
-
l1Token:
|
|
104
|
+
l2Token: Address;
|
|
105
|
+
l1Token: EvmAddress;
|
|
98
106
|
}
|
|
99
107
|
|
|
108
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
100
109
|
export interface SetPoolRebalanceRoot extends SortableEvent {
|
|
101
110
|
destinationChainId: number;
|
|
102
|
-
l1Token:
|
|
103
|
-
destinationToken:
|
|
111
|
+
l1Token: EvmAddress;
|
|
112
|
+
destinationToken: Address;
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
export interface PendingRootBundle {
|
|
107
116
|
poolRebalanceRoot: string;
|
|
108
117
|
relayerRefundRoot: string;
|
|
109
118
|
slowRelayRoot: string;
|
|
110
|
-
proposer:
|
|
119
|
+
proposer: EvmAddress;
|
|
111
120
|
unclaimedPoolRebalanceLeafCount: number;
|
|
112
121
|
challengePeriodEndTimestamp: number;
|
|
113
122
|
bundleEvaluationBlockNumbers: number[];
|