@across-protocol/sdk 4.2.7 → 4.2.9-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 +2 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +18 -3
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +7 -7
- 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 +15 -13
- 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 +2 -2
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +57 -53
- 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/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 +20 -20
- package/dist/cjs/clients/HubPoolClient.js +78 -57
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -3
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +35 -29
- 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 +9 -13
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -56
- 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 +18 -13
- package/dist/cjs/interfaces/SpokePool.d.ts +14 -16
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- 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 +3 -3
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +10 -10
- 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 +7 -4
- package/dist/cjs/utils/AddressUtils.js +21 -8
- 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 +2 -2
- package/dist/esm/arch/evm/SpokeUtils.js +19 -4
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.js +8 -8
- 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 +15 -13
- 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 +2 -2
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +58 -54
- 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/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 +22 -21
- package/dist/esm/clients/HubPoolClient.js +91 -61
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -3
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +37 -30
- 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 +9 -13
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +44 -60
- 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 +18 -13
- package/dist/esm/interfaces/SpokePool.d.ts +14 -16
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- 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 +3 -3
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +10 -10
- 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 -4
- package/dist/esm/utils/AddressUtils.js +25 -10
- 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 +4 -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 +2 -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 +2 -2
- 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/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 +22 -21
- 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 +5 -3
- 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 +9 -13
- 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 +18 -13
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +14 -16
- 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 +3 -3
- 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 -4
- 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 +4 -16
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/evm/SpokeUtils.ts +22 -8
- package/src/arch/svm/SpokeUtils.ts +7 -8
- package/src/arch/svm/utils.ts +3 -3
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
- package/src/clients/BundleDataClient/BundleDataClient.ts +49 -47
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
- package/src/clients/BundleDataClient/utils/FillUtils.ts +6 -4
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
- package/src/clients/HubPoolClient.ts +113 -79
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +7 -1
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +104 -37
- package/src/clients/mocks/MockHubPoolClient.ts +24 -19
- package/src/clients/mocks/MockSpokePoolClient.ts +53 -74
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
- package/src/interfaces/HubPool.ts +22 -13
- package/src/interfaces/SpokePool.ts +14 -17
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +10 -8
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +10 -10
- package/src/relayFeeCalculator/relayFeeCalculator.ts +11 -9
- package/src/utils/AddressUtils.ts +32 -14
- 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;
|
|
@@ -302,9 +303,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
302
303
|
* @param relayData RelayData field for the SlowFill request.
|
|
303
304
|
* @returns The corresponding SlowFillRequest event if found, otherwise undefined.
|
|
304
305
|
*/
|
|
305
|
-
public getSlowFillRequest(
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
public getSlowFillRequest(
|
|
307
|
+
relayData: Omit<RelayData, "message"> & { messageHash: string }
|
|
308
|
+
): SlowFillRequestWithBlock | undefined {
|
|
309
|
+
const hash = getRelayEventKey({ ...relayData, destinationChainId: this.chainId });
|
|
308
310
|
return this.slowFillRequests[hash];
|
|
309
311
|
}
|
|
310
312
|
|
|
@@ -383,7 +385,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
383
385
|
if (
|
|
384
386
|
this.hubPoolClient &&
|
|
385
387
|
!isSlowFill(fill) &&
|
|
386
|
-
|
|
388
|
+
chainIsEvm(repaymentChainId) &&
|
|
389
|
+
!fill.relayer.isValidEvmAddress()
|
|
387
390
|
) {
|
|
388
391
|
groupedFills.unrepayableFills.push(fill);
|
|
389
392
|
}
|
|
@@ -416,7 +419,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
416
419
|
chainId: this.chainId,
|
|
417
420
|
message: "Invalid fills found matching deposit ID",
|
|
418
421
|
deposit,
|
|
419
|
-
invalidFills: Object.fromEntries(invalidFillsForDeposit.map((x) => [x.relayer, x])),
|
|
422
|
+
invalidFills: Object.fromEntries(invalidFillsForDeposit.map((x) => [x.relayer.toAddress(), x])),
|
|
420
423
|
notificationPath: "across-invalid-fills",
|
|
421
424
|
});
|
|
422
425
|
}
|
|
@@ -427,7 +430,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
427
430
|
chainId: this.chainId,
|
|
428
431
|
message: "Unrepayable fills found where we need to switch repayment address and or chain",
|
|
429
432
|
deposit,
|
|
430
|
-
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer, x])),
|
|
433
|
+
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer.toAddress(), x])),
|
|
431
434
|
notificationPath: "across-unrepayable-fills",
|
|
432
435
|
});
|
|
433
436
|
}
|
|
@@ -499,14 +502,36 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
499
502
|
const { events: queryResults, currentTime, searchEndBlock } = update;
|
|
500
503
|
|
|
501
504
|
if (eventsToQuery.includes("TokensBridged")) {
|
|
502
|
-
for (const
|
|
503
|
-
|
|
505
|
+
for (const _event of queryResults[eventsToQuery.indexOf("TokensBridged")]) {
|
|
506
|
+
const event = _event as TokensBridged & {
|
|
507
|
+
l2TokenAddress: string;
|
|
508
|
+
};
|
|
509
|
+
this.tokensBridged.push({
|
|
510
|
+
...event,
|
|
511
|
+
l2TokenAddress: toAddressType(event.l2TokenAddress),
|
|
512
|
+
} as TokensBridged);
|
|
504
513
|
}
|
|
505
514
|
}
|
|
506
515
|
|
|
507
516
|
// Performs the indexing of a deposit-like spoke pool event.
|
|
508
517
|
const queryDepositEvents = async (eventName: string) => {
|
|
509
|
-
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
518
|
+
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
519
|
+
const event = _event as DepositWithBlock & {
|
|
520
|
+
depositor: string;
|
|
521
|
+
recipient: string;
|
|
522
|
+
inputToken: string;
|
|
523
|
+
outputToken: string;
|
|
524
|
+
exclusiveRelayer: string;
|
|
525
|
+
};
|
|
526
|
+
return {
|
|
527
|
+
...event,
|
|
528
|
+
depositor: toAddressType(event.depositor),
|
|
529
|
+
recipient: toAddressType(event.recipient),
|
|
530
|
+
inputToken: toAddressType(event.inputToken),
|
|
531
|
+
outputToken: toAddressType(event.outputToken),
|
|
532
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer),
|
|
533
|
+
} as DepositWithBlock;
|
|
534
|
+
}) as DepositWithBlock[];
|
|
510
535
|
if (depositEvents.length > 0) {
|
|
511
536
|
this.log(
|
|
512
537
|
"debug",
|
|
@@ -555,7 +580,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
555
580
|
}
|
|
556
581
|
};
|
|
557
582
|
|
|
558
|
-
for (const event of ["
|
|
583
|
+
for (const event of ["FundsDeposited"]) {
|
|
559
584
|
if (eventsToQuery.includes(event)) {
|
|
560
585
|
await queryDepositEvents(event);
|
|
561
586
|
}
|
|
@@ -563,11 +588,21 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
563
588
|
|
|
564
589
|
// Performs indexing of a "speed up deposit"-like event.
|
|
565
590
|
const querySpeedUpDepositEvents = (eventName: string) => {
|
|
566
|
-
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
591
|
+
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
592
|
+
const event = _event as SpeedUpWithBlock & { depositor: string; updatedRecipient: string };
|
|
593
|
+
return {
|
|
594
|
+
...event,
|
|
595
|
+
depositor: toAddressType(event.depositor),
|
|
596
|
+
updatedRecipient: toAddressType(event.updatedRecipient),
|
|
597
|
+
} as SpeedUpWithBlock;
|
|
598
|
+
});
|
|
567
599
|
|
|
568
600
|
for (const event of speedUpEvents) {
|
|
569
|
-
const speedUp = {
|
|
570
|
-
|
|
601
|
+
const speedUp = {
|
|
602
|
+
...event,
|
|
603
|
+
originChainId: this.chainId,
|
|
604
|
+
};
|
|
605
|
+
assign(this.speedUps, [speedUp.depositor.toAddress(), speedUp.depositId.toString()], [speedUp]);
|
|
571
606
|
|
|
572
607
|
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
573
608
|
// if the hash+data exists.
|
|
@@ -583,7 +618,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
583
618
|
};
|
|
584
619
|
|
|
585
620
|
// Update deposits with speed up requests from depositor.
|
|
586
|
-
["
|
|
621
|
+
["RequestedSpeedUpDeposit"].forEach((event) => {
|
|
587
622
|
if (eventsToQuery.includes(event)) {
|
|
588
623
|
querySpeedUpDepositEvents(event);
|
|
589
624
|
}
|
|
@@ -591,17 +626,29 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
591
626
|
|
|
592
627
|
// Performs indexing of "requested slow fill"-like events.
|
|
593
628
|
const queryRequestedSlowFillEvents = (eventName: string) => {
|
|
594
|
-
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
629
|
+
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
630
|
+
const event = _event as SlowFillRequestWithBlock & {
|
|
631
|
+
depositor: string;
|
|
632
|
+
recipient: string;
|
|
633
|
+
inputToken: string;
|
|
634
|
+
outputToken: string;
|
|
635
|
+
exclusiveRelayer: string;
|
|
636
|
+
};
|
|
637
|
+
return {
|
|
638
|
+
...event,
|
|
639
|
+
depositor: toAddressType(event.depositor),
|
|
640
|
+
recipient: toAddressType(event.recipient),
|
|
641
|
+
inputToken: toAddressType(event.inputToken),
|
|
642
|
+
outputToken: toAddressType(event.outputToken),
|
|
643
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer),
|
|
644
|
+
} as SlowFillRequestWithBlock;
|
|
645
|
+
}) as SlowFillRequestWithBlock[];
|
|
595
646
|
for (const event of slowFillRequests) {
|
|
596
647
|
const slowFillRequest = {
|
|
597
648
|
...event,
|
|
598
649
|
destinationChainId: this.chainId,
|
|
599
650
|
};
|
|
600
651
|
|
|
601
|
-
if (eventName === "RequestedV3SlowFill") {
|
|
602
|
-
slowFillRequest.messageHash = getMessageHash(slowFillRequest.message);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
652
|
const depositHash = getRelayEventKey({ ...slowFillRequest, destinationChainId: this.chainId });
|
|
606
653
|
|
|
607
654
|
// Sanity check that this event is not a duplicate.
|
|
@@ -614,7 +661,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
614
661
|
}
|
|
615
662
|
};
|
|
616
663
|
|
|
617
|
-
["
|
|
664
|
+
["RequestedSlowFill"].forEach((event) => {
|
|
618
665
|
if (eventsToQuery.includes(event)) {
|
|
619
666
|
queryRequestedSlowFillEvents(event);
|
|
620
667
|
}
|
|
@@ -622,7 +669,30 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
622
669
|
|
|
623
670
|
// Performs indexing of filled relay-like events.
|
|
624
671
|
const queryFilledRelayEvents = (eventName: string) => {
|
|
625
|
-
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
672
|
+
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []).map((_event) => {
|
|
673
|
+
const event = _event as FillWithBlock & {
|
|
674
|
+
depositor: string;
|
|
675
|
+
recipient: string;
|
|
676
|
+
inputToken: string;
|
|
677
|
+
outputToken: string;
|
|
678
|
+
exclusiveRelayer: string;
|
|
679
|
+
relayer: string;
|
|
680
|
+
relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
|
|
681
|
+
};
|
|
682
|
+
return {
|
|
683
|
+
...event,
|
|
684
|
+
depositor: toAddressType(event.depositor),
|
|
685
|
+
recipient: toAddressType(event.recipient),
|
|
686
|
+
inputToken: toAddressType(event.inputToken),
|
|
687
|
+
outputToken: toAddressType(event.outputToken),
|
|
688
|
+
exclusiveRelayer: toAddressType(event.exclusiveRelayer),
|
|
689
|
+
relayer: toAddressType(event.relayer),
|
|
690
|
+
relayExecutionInfo: {
|
|
691
|
+
...event.relayExecutionInfo,
|
|
692
|
+
updatedRecipient: toAddressType(event.relayExecutionInfo.updatedRecipient),
|
|
693
|
+
},
|
|
694
|
+
} as FillWithBlock;
|
|
695
|
+
}) as FillWithBlock[];
|
|
626
696
|
|
|
627
697
|
if (fillEvents.length > 0) {
|
|
628
698
|
this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
|
|
@@ -638,11 +708,6 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
638
708
|
destinationChainId: this.chainId,
|
|
639
709
|
};
|
|
640
710
|
|
|
641
|
-
if (eventName === "FilledV3Relay") {
|
|
642
|
-
fill.messageHash = getMessageHash((event as unknown as { message: string }).message);
|
|
643
|
-
fill.relayExecutionInfo.updatedMessageHash = getMessageHash(event.relayExecutionInfo.updatedMessage!);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
711
|
// Sanity check that this event is not a duplicate.
|
|
647
712
|
const duplicateFill = this.fills[fill.originChainId]?.find((f) => duplicateEvent(fill, f));
|
|
648
713
|
if (duplicateFill) {
|
|
@@ -656,7 +721,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
656
721
|
};
|
|
657
722
|
|
|
658
723
|
// Update observed fills with ingested event data.
|
|
659
|
-
["
|
|
724
|
+
["FilledRelay"].forEach((event) => {
|
|
660
725
|
if (eventsToQuery.includes(event)) {
|
|
661
726
|
queryFilledRelayEvents(event);
|
|
662
727
|
}
|
|
@@ -731,9 +796,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
731
796
|
* @param deposit The deposit to retrieve the destination token for.
|
|
732
797
|
* @returns The destination token.
|
|
733
798
|
*/
|
|
734
|
-
protected getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
799
|
+
protected getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
|
|
735
800
|
if (!this.canResolveZeroAddressOutputToken(deposit)) {
|
|
736
|
-
return ZERO_ADDRESS;
|
|
801
|
+
return toAddressType(ZERO_ADDRESS);
|
|
737
802
|
}
|
|
738
803
|
// L1 token should be resolved if we get here:
|
|
739
804
|
const l1Token = this.hubPoolClient!.getL1TokenForL2TokenAtBlock(
|
|
@@ -741,10 +806,12 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
741
806
|
deposit.originChainId,
|
|
742
807
|
deposit.quoteBlockNumber
|
|
743
808
|
)!;
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
809
|
+
const counterpartToken = this.hubPoolClient!.getL2TokenForL1TokenAtBlock(
|
|
810
|
+
l1Token,
|
|
811
|
+
deposit.destinationChainId,
|
|
812
|
+
deposit.quoteBlockNumber
|
|
747
813
|
);
|
|
814
|
+
return counterpartToken ?? toAddressType(ZERO_ADDRESS);
|
|
748
815
|
}
|
|
749
816
|
|
|
750
817
|
/**
|
|
@@ -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,
|
|
@@ -25,9 +25,11 @@ import {
|
|
|
25
25
|
BigNumber,
|
|
26
26
|
bnZero,
|
|
27
27
|
bnOne,
|
|
28
|
-
toAddress,
|
|
29
28
|
toBytes32,
|
|
30
29
|
spreadEventWithBlockNumber,
|
|
30
|
+
Address,
|
|
31
|
+
toAddressType,
|
|
32
|
+
isDefined,
|
|
31
33
|
} from "../../utils";
|
|
32
34
|
import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
|
|
33
35
|
import { HubPoolClient } from "../HubPoolClient";
|
|
@@ -63,8 +65,9 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
63
65
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
67
|
-
|
|
68
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
|
|
69
|
+
const override = this.destinationTokenForChainOverride[deposit.originChainId];
|
|
70
|
+
return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -85,6 +88,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
85
88
|
lastDepositId = _depositIds[i];
|
|
86
89
|
}
|
|
87
90
|
}
|
|
91
|
+
|
|
88
92
|
_getDepositIdAtBlock(blockTag: number): Promise<BigNumber> {
|
|
89
93
|
return Promise.resolve(this.depositIdAtBlock[blockTag]);
|
|
90
94
|
}
|
|
@@ -129,28 +133,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
129
133
|
return this._deposit("FundsDeposited", deposit);
|
|
130
134
|
}
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
136
|
+
protected _deposit(
|
|
137
|
+
event: string,
|
|
138
|
+
deposit: Omit<Deposit, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
139
|
+
): Log {
|
|
137
140
|
const { blockNumber, txnIndex } = deposit;
|
|
138
141
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
139
142
|
depositId ??= this.numberOfDeposits;
|
|
140
143
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
141
144
|
|
|
142
145
|
destinationChainId ??= random(1, 42161, false);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const exclusiveRelayer = addressModifier(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
146
|
+
const depositor = deposit.depositor?.toBytes32() ?? toBytes32(randomAddress());
|
|
147
|
+
const recipient = deposit.recipient?.toBytes32() ?? toBytes32(depositor);
|
|
148
|
+
const inputToken = deposit.inputToken?.toBytes32() ?? toBytes32(randomAddress());
|
|
149
|
+
const outputToken = deposit.outputToken?.toBytes32() ?? inputToken;
|
|
150
|
+
const exclusiveRelayer = deposit.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
149
151
|
|
|
150
152
|
inputAmount ??= toBNWei(random(1, 1000, false));
|
|
151
153
|
outputAmount ??= inputAmount.mul(toBN("0.95"));
|
|
152
154
|
|
|
153
|
-
const message = deposit
|
|
155
|
+
const message = deposit.message ?? "0x";
|
|
154
156
|
const topics = [destinationChainId, depositId, depositor];
|
|
155
157
|
const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
|
|
156
158
|
const args = {
|
|
@@ -180,17 +182,13 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
return this._fillRelay("FilledV3Relay", fill);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fillRelay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
|
|
185
|
+
fillRelay(fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>): Log {
|
|
188
186
|
return this._fillRelay("FilledRelay", fill);
|
|
189
187
|
}
|
|
190
188
|
|
|
191
189
|
protected _fillRelay(
|
|
192
190
|
event: string,
|
|
193
|
-
fill: Omit<Fill, "messageHash"> & { message
|
|
191
|
+
fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
194
192
|
): Log {
|
|
195
193
|
const { blockNumber, txnIndex } = fill;
|
|
196
194
|
let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
|
|
@@ -200,20 +198,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
200
198
|
outputAmount ??= inputAmount;
|
|
201
199
|
fillDeadline ??= getCurrentTime() + 60;
|
|
202
200
|
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const relayer = addressModifier(fill.relayer ?? randomAddress());
|
|
201
|
+
const depositor = fill.depositor?.toBytes32() ?? toBytes32(randomAddress());
|
|
202
|
+
const recipient = fill.recipient?.toBytes32() ?? toBytes32(depositor);
|
|
203
|
+
const inputToken = fill.inputToken?.toBytes32() ?? toBytes32(randomAddress());
|
|
204
|
+
const outputToken = fill.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
205
|
+
const exclusiveRelayer = fill.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
|
|
206
|
+
const relayer = fill.relayer?.toBytes32() ?? toBytes32(randomAddress());
|
|
210
207
|
|
|
211
|
-
const topics = [originChainId, depositId, relayer];
|
|
208
|
+
const topics = [originChainId, depositId, relayer];
|
|
212
209
|
const message = fill.message ?? EMPTY_MESSAGE;
|
|
213
210
|
const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
|
|
211
|
+
const updatedRecipient = fill.relayExecutionInfo?.updatedRecipient.toBytes32() ?? recipient;
|
|
214
212
|
|
|
215
213
|
const relayExecutionInfo = {
|
|
216
|
-
updatedRecipient
|
|
214
|
+
updatedRecipient,
|
|
217
215
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
218
216
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
219
217
|
};
|
|
@@ -233,31 +231,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
233
231
|
depositor,
|
|
234
232
|
recipient,
|
|
235
233
|
relayExecutionInfo: {
|
|
236
|
-
updatedRecipient
|
|
234
|
+
updatedRecipient,
|
|
237
235
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
238
236
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
239
237
|
},
|
|
240
238
|
};
|
|
241
239
|
|
|
242
|
-
const args =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
}
|
|
252
|
-
: {
|
|
253
|
-
// FilledV3Relay
|
|
254
|
-
..._args,
|
|
255
|
-
message,
|
|
256
|
-
relayExecutionInfo: {
|
|
257
|
-
...relayExecutionInfo,
|
|
258
|
-
updatedMessage,
|
|
259
|
-
},
|
|
260
|
-
};
|
|
240
|
+
const args = {
|
|
241
|
+
..._args,
|
|
242
|
+
messageHash: getMessageHash(message),
|
|
243
|
+
relayExecutionInfo: {
|
|
244
|
+
...relayExecutionInfo,
|
|
245
|
+
updatedMessageHash: getMessageHash(updatedMessage),
|
|
246
|
+
},
|
|
247
|
+
};
|
|
261
248
|
|
|
262
249
|
return this.eventManager.generateEvent({
|
|
263
250
|
event,
|
|
@@ -269,17 +256,12 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
269
256
|
});
|
|
270
257
|
}
|
|
271
258
|
|
|
272
|
-
speedUpV3Deposit(speedUp: SpeedUp): Log {
|
|
273
|
-
return this._speedUpDeposit("RequestedSpeedUpV3Deposit", speedUp);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
259
|
speedUpDeposit(speedUp: SpeedUp): Log {
|
|
277
260
|
return this._speedUpDeposit("RequestedSpeedUpDeposit", speedUp);
|
|
278
261
|
}
|
|
279
262
|
|
|
280
263
|
protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
|
|
281
|
-
const
|
|
282
|
-
const depositor = addressModifier(speedUp.depositor);
|
|
264
|
+
const depositor = speedUp.depositor.toBytes32();
|
|
283
265
|
const topics = [speedUp.depositId, depositor];
|
|
284
266
|
const args = { ...speedUp };
|
|
285
267
|
|
|
@@ -290,7 +272,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
290
272
|
args: {
|
|
291
273
|
...args,
|
|
292
274
|
depositor,
|
|
293
|
-
updatedRecipient:
|
|
275
|
+
updatedRecipient: speedUp.updatedRecipient.toBytes32(),
|
|
294
276
|
},
|
|
295
277
|
});
|
|
296
278
|
}
|
|
@@ -308,24 +290,19 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
308
290
|
});
|
|
309
291
|
}
|
|
310
292
|
|
|
311
|
-
|
|
312
|
-
return this._requestSlowFill("RequestedV3SlowFill", request);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
requestSlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
|
|
293
|
+
requestSlowFill(request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>): Log {
|
|
316
294
|
return this._requestSlowFill("RequestedSlowFill", request);
|
|
317
295
|
}
|
|
318
296
|
|
|
319
297
|
protected _requestSlowFill(
|
|
320
298
|
event: string,
|
|
321
|
-
request: Omit<SlowFillRequest, "
|
|
299
|
+
request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>
|
|
322
300
|
): Log {
|
|
323
301
|
const { originChainId, depositId } = request;
|
|
324
302
|
const topics = [originChainId, depositId];
|
|
325
303
|
const args = { ...request };
|
|
326
304
|
|
|
327
|
-
const
|
|
328
|
-
const depositor = addressModifier(args.depositor ?? randomAddress());
|
|
305
|
+
const depositor = args.depositor.toBytes32() ?? toBytes32(randomAddress());
|
|
329
306
|
|
|
330
307
|
return this.eventManager.generateEvent({
|
|
331
308
|
event,
|
|
@@ -333,24 +310,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
333
310
|
topics: topics.map((topic) => topic.toString()),
|
|
334
311
|
args: {
|
|
335
312
|
...args,
|
|
313
|
+
destinationChainId: this.chainId,
|
|
336
314
|
depositor,
|
|
337
|
-
recipient:
|
|
338
|
-
inputToken:
|
|
339
|
-
outputToken:
|
|
340
|
-
exclusiveRelayer:
|
|
315
|
+
recipient: args.recipient?.toBytes32() ?? depositor,
|
|
316
|
+
inputToken: args.inputToken?.toBytes32() ?? toBytes32(randomAddress()),
|
|
317
|
+
outputToken: args.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
|
|
318
|
+
exclusiveRelayer: args.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
|
|
319
|
+
messageHash: args.messageHash ?? ZERO_BYTES,
|
|
341
320
|
},
|
|
342
321
|
blockNumber: request.blockNumber,
|
|
343
322
|
transactionIndex: request.txnIndex,
|
|
344
323
|
});
|
|
345
324
|
}
|
|
346
325
|
|
|
347
|
-
// This is a simple wrapper around
|
|
326
|
+
// This is a simple wrapper around fillRelay().
|
|
348
327
|
// rootBundleId and proof are discarded here - we have no interest in verifying that.
|
|
349
|
-
|
|
328
|
+
executeSlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
|
|
350
329
|
const fill = {
|
|
351
330
|
...leaf.relayData,
|
|
352
331
|
destinationChainId: this.chainId,
|
|
353
|
-
relayer: ZERO_ADDRESS,
|
|
332
|
+
relayer: toAddressType(ZERO_ADDRESS),
|
|
354
333
|
repaymentChainId: 0,
|
|
355
334
|
relayExecutionInfo: {
|
|
356
335
|
updatedRecipient: leaf.relayData.recipient,
|
|
@@ -361,7 +340,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
361
340
|
},
|
|
362
341
|
};
|
|
363
342
|
|
|
364
|
-
return this.
|
|
343
|
+
return this.fillRelay(fill);
|
|
365
344
|
}
|
|
366
345
|
|
|
367
346
|
executeRelayerRefundLeaf(refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
|