@across-protocol/sdk 4.2.9-alpha.2 → 4.2.10
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 -5
- package/dist/cjs/arch/evm/SpokeUtils.js +3 -19
- 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 +13 -15
- 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 +2 -4
- 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 +56 -60
- 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 +1 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- 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 +8 -11
- 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 +59 -83
- 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 +37 -51
- 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 +9 -15
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -39
- 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 +14 -19
- 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 +15 -14
- 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 +3 -6
- package/dist/cjs/utils/AddressUtils.js +14 -42
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/ArrayUtils.js +1 -0
- package/dist/cjs/utils/ArrayUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +22 -4
- 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 -5
- package/dist/esm/arch/evm/SpokeUtils.js +4 -20
- 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 +13 -15
- 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 +2 -4
- 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 +57 -61
- 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 +1 -2
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- 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 +9 -12
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +22 -23
- package/dist/esm/clients/HubPoolClient.js +63 -96
- 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 +38 -53
- 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 +10 -16
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -41
- 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 +14 -19
- 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 +16 -15
- 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 +3 -7
- package/dist/esm/utils/AddressUtils.js +19 -52
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/ArrayUtils.js +1 -0
- package/dist/esm/utils/ArrayUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +8 -3
- package/dist/esm/utils/SpokeUtils.js +26 -4
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +16 -18
- 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 -5
- 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 +1 -2
- 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 +22 -23
- 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 +3 -5
- 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 +14 -19
- 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 +3 -7
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +8 -3
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +16 -18
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/arch/evm/SpokeUtils.ts +9 -31
- package/src/arch/svm/SpokeUtils.ts +8 -8
- package/src/arch/svm/utils.ts +3 -3
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
- package/src/clients/BundleDataClient/BundleDataClient.ts +52 -54
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
- package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
- package/src/clients/HubPoolClient.ts +82 -122
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +27 -105
- package/src/clients/mocks/MockHubPoolClient.ts +19 -24
- package/src/clients/mocks/MockSpokePoolClient.ts +26 -37
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
- package/src/interfaces/HubPool.ts +14 -23
- package/src/interfaces/SpokePool.ts +13 -13
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +21 -16
- package/src/relayFeeCalculator/relayFeeCalculator.ts +12 -20
- package/src/utils/AddressUtils.ts +21 -56
- package/src/utils/ArrayUtils.ts +1 -0
- package/src/utils/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +7 -7
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
isDefined,
|
|
14
14
|
getMessageHash,
|
|
15
15
|
isSlowFill,
|
|
16
|
+
isValidEvmAddress,
|
|
16
17
|
isZeroAddress,
|
|
18
|
+
toAddress,
|
|
17
19
|
validateFillForDeposit,
|
|
18
20
|
chainIsEvm,
|
|
19
21
|
chainIsProd,
|
|
20
22
|
Address,
|
|
21
|
-
toAddressType,
|
|
22
23
|
} from "../../utils";
|
|
23
24
|
import { duplicateEvent, sortEventsAscendingInPlace } from "../../utils/EventUtils";
|
|
24
25
|
import { ZERO_ADDRESS } from "../../constants";
|
|
@@ -36,7 +37,6 @@ import {
|
|
|
36
37
|
SortableEvent,
|
|
37
38
|
SpeedUpWithBlock,
|
|
38
39
|
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: string): FillWithBlock[] {
|
|
206
|
+
return this.getFills().filter((fill) => fill.relayer === relayer);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/**
|
|
@@ -251,8 +251,7 @@ 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
|
-
|
|
255
|
-
const speedups = this.speedUps[depositor.toEvmAddress()]?.[depositId.toString()];
|
|
254
|
+
const speedups = this.speedUps[toAddress(depositor)]?.[depositId.toString()];
|
|
256
255
|
|
|
257
256
|
if (!isDefined(speedups) || speedups.length === 0) {
|
|
258
257
|
return deposit;
|
|
@@ -385,8 +384,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
385
384
|
if (
|
|
386
385
|
this.hubPoolClient &&
|
|
387
386
|
!isSlowFill(fill) &&
|
|
388
|
-
chainIsEvm(repaymentChainId)
|
|
389
|
-
!fill.relayer.isValidEvmAddress()
|
|
387
|
+
(!chainIsEvm(repaymentChainId) || !isValidEvmAddress(fill.relayer))
|
|
390
388
|
) {
|
|
391
389
|
groupedFills.unrepayableFills.push(fill);
|
|
392
390
|
}
|
|
@@ -419,7 +417,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
419
417
|
chainId: this.chainId,
|
|
420
418
|
message: "Invalid fills found matching deposit ID",
|
|
421
419
|
deposit,
|
|
422
|
-
invalidFills: Object.fromEntries(invalidFillsForDeposit.map((x) => [x.relayer
|
|
420
|
+
invalidFills: Object.fromEntries(invalidFillsForDeposit.map((x) => [x.relayer, x])),
|
|
423
421
|
notificationPath: "across-invalid-fills",
|
|
424
422
|
});
|
|
425
423
|
}
|
|
@@ -430,7 +428,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
430
428
|
chainId: this.chainId,
|
|
431
429
|
message: "Unrepayable fills found where we need to switch repayment address and or chain",
|
|
432
430
|
deposit,
|
|
433
|
-
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer
|
|
431
|
+
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer, x])),
|
|
434
432
|
notificationPath: "across-unrepayable-fills",
|
|
435
433
|
});
|
|
436
434
|
}
|
|
@@ -502,36 +500,14 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
502
500
|
const { events: queryResults, currentTime, searchEndBlock } = update;
|
|
503
501
|
|
|
504
502
|
if (eventsToQuery.includes("TokensBridged")) {
|
|
505
|
-
for (const
|
|
506
|
-
|
|
507
|
-
l2TokenAddress: string;
|
|
508
|
-
};
|
|
509
|
-
this.tokensBridged.push({
|
|
510
|
-
...event,
|
|
511
|
-
l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
|
|
512
|
-
});
|
|
503
|
+
for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")] as TokensBridged[]) {
|
|
504
|
+
this.tokensBridged.push(event);
|
|
513
505
|
}
|
|
514
506
|
}
|
|
515
507
|
|
|
516
508
|
// Performs the indexing of a deposit-like spoke pool event.
|
|
517
509
|
const queryDepositEvents = async (eventName: string) => {
|
|
518
|
-
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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, this.chainId),
|
|
529
|
-
recipient: toAddressType(event.recipient, event.destinationChainId),
|
|
530
|
-
inputToken: toAddressType(event.inputToken, this.chainId),
|
|
531
|
-
outputToken: toAddressType(event.outputToken, event.destinationChainId),
|
|
532
|
-
exclusiveRelayer: toAddressType(event.exclusiveRelayer, event.destinationChainId),
|
|
533
|
-
} as DepositWithBlock;
|
|
534
|
-
});
|
|
510
|
+
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as DepositWithBlock[];
|
|
535
511
|
if (depositEvents.length > 0) {
|
|
536
512
|
this.log(
|
|
537
513
|
"debug",
|
|
@@ -588,21 +564,11 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
588
564
|
|
|
589
565
|
// Performs indexing of a "speed up deposit"-like event.
|
|
590
566
|
const querySpeedUpDepositEvents = (eventName: string) => {
|
|
591
|
-
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
592
|
-
const event = _event as SpeedUpWithBlock & { depositor: string; updatedRecipient: string };
|
|
593
|
-
return {
|
|
594
|
-
...event,
|
|
595
|
-
depositor: toAddressType(event.depositor, this.chainId),
|
|
596
|
-
updatedRecipient: toAddressType(event.updatedRecipient),
|
|
597
|
-
} as SpeedUpWithBlock;
|
|
598
|
-
});
|
|
567
|
+
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SpeedUpWithBlock[];
|
|
599
568
|
|
|
600
569
|
for (const event of speedUpEvents) {
|
|
601
|
-
const speedUp = {
|
|
602
|
-
|
|
603
|
-
originChainId: this.chainId,
|
|
604
|
-
};
|
|
605
|
-
assign(this.speedUps, [speedUp.depositor.toAddress(), speedUp.depositId.toString()], [speedUp]);
|
|
570
|
+
const speedUp = { ...event, originChainId: this.chainId };
|
|
571
|
+
assign(this.speedUps, [speedUp.depositor, speedUp.depositId.toString()], [speedUp]);
|
|
606
572
|
|
|
607
573
|
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
608
574
|
// if the hash+data exists.
|
|
@@ -626,23 +592,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
626
592
|
|
|
627
593
|
// Performs indexing of "requested slow fill"-like events.
|
|
628
594
|
const queryRequestedSlowFillEvents = (eventName: string) => {
|
|
629
|
-
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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, event.originChainId),
|
|
640
|
-
recipient: toAddressType(event.recipient, this.chainId),
|
|
641
|
-
inputToken: toAddressType(event.inputToken, event.originChainId),
|
|
642
|
-
outputToken: toAddressType(event.outputToken, this.chainId),
|
|
643
|
-
exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
|
|
644
|
-
} as SlowFillRequestWithBlock;
|
|
645
|
-
});
|
|
595
|
+
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SlowFillRequestWithBlock[];
|
|
646
596
|
for (const event of slowFillRequests) {
|
|
647
597
|
const slowFillRequest = {
|
|
648
598
|
...event,
|
|
@@ -669,30 +619,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
669
619
|
|
|
670
620
|
// Performs indexing of filled relay-like events.
|
|
671
621
|
const queryFilledRelayEvents = (eventName: string) => {
|
|
672
|
-
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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, event.originChainId),
|
|
685
|
-
recipient: toAddressType(event.recipient, this.chainId),
|
|
686
|
-
inputToken: toAddressType(event.inputToken, event.originChainId),
|
|
687
|
-
outputToken: toAddressType(event.outputToken, this.chainId),
|
|
688
|
-
exclusiveRelayer: toAddressType(event.exclusiveRelayer, this.chainId),
|
|
689
|
-
relayer: toAddressType(event.relayer, this.chainId),
|
|
690
|
-
relayExecutionInfo: {
|
|
691
|
-
...event.relayExecutionInfo,
|
|
692
|
-
updatedRecipient: toAddressType(event.relayExecutionInfo.updatedRecipient, this.chainId),
|
|
693
|
-
},
|
|
694
|
-
} as FillWithBlock;
|
|
695
|
-
});
|
|
622
|
+
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as FillWithBlock[];
|
|
696
623
|
|
|
697
624
|
if (fillEvents.length > 0) {
|
|
698
625
|
this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
|
|
@@ -728,9 +655,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
728
655
|
});
|
|
729
656
|
|
|
730
657
|
if (eventsToQuery.includes("EnabledDepositRoute")) {
|
|
731
|
-
const enableDepositsEvents = queryResults[
|
|
732
|
-
|
|
733
|
-
] as EnabledDepositRouteWithBlock[];
|
|
658
|
+
const enableDepositsEvents = (queryResults[eventsToQuery.indexOf("EnabledDepositRoute")] ??
|
|
659
|
+
[]) as EnabledDepositRouteWithBlock[];
|
|
734
660
|
|
|
735
661
|
for (const event of enableDepositsEvents) {
|
|
736
662
|
assign(this.depositRoutes, [event.originToken, event.destinationChainId], event.enabled);
|
|
@@ -738,18 +664,16 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
738
664
|
}
|
|
739
665
|
|
|
740
666
|
if (eventsToQuery.includes("RelayedRootBundle")) {
|
|
741
|
-
const relayedRootBundleEvents = queryResults[
|
|
742
|
-
|
|
743
|
-
] as RootBundleRelayWithBlock[];
|
|
667
|
+
const relayedRootBundleEvents = (queryResults[eventsToQuery.indexOf("RelayedRootBundle")] ??
|
|
668
|
+
[]) as RootBundleRelayWithBlock[];
|
|
744
669
|
for (const event of relayedRootBundleEvents) {
|
|
745
670
|
this.rootBundleRelays.push(event);
|
|
746
671
|
}
|
|
747
672
|
}
|
|
748
673
|
|
|
749
674
|
if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
|
|
750
|
-
const refundEvents = queryResults[
|
|
751
|
-
|
|
752
|
-
] as RelayerRefundExecutionWithBlock[];
|
|
675
|
+
const refundEvents = (queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")] ??
|
|
676
|
+
[]) as RelayerRefundExecutionWithBlock[];
|
|
753
677
|
for (const event of refundEvents) {
|
|
754
678
|
this.relayerRefundExecutions.push(event);
|
|
755
679
|
}
|
|
@@ -799,9 +723,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
799
723
|
* @param deposit The deposit to retrieve the destination token for.
|
|
800
724
|
* @returns The destination token.
|
|
801
725
|
*/
|
|
802
|
-
protected getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
726
|
+
protected getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
803
727
|
if (!this.canResolveZeroAddressOutputToken(deposit)) {
|
|
804
|
-
return
|
|
728
|
+
return ZERO_ADDRESS;
|
|
805
729
|
}
|
|
806
730
|
// L1 token should be resolved if we get here:
|
|
807
731
|
const l1Token = this.hubPoolClient!.getL1TokenForL2TokenAtBlock(
|
|
@@ -809,12 +733,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
809
733
|
deposit.originChainId,
|
|
810
734
|
deposit.quoteBlockNumber
|
|
811
735
|
)!;
|
|
812
|
-
|
|
813
|
-
l1Token,
|
|
814
|
-
|
|
815
|
-
deposit.quoteBlockNumber
|
|
736
|
+
return (
|
|
737
|
+
this.hubPoolClient!.getL2TokenForL1TokenAtBlock(l1Token, deposit.destinationChainId, deposit.quoteBlockNumber) ??
|
|
738
|
+
ZERO_ADDRESS
|
|
816
739
|
);
|
|
817
|
-
return counterpartToken ?? toAddressType(ZERO_ADDRESS);
|
|
818
740
|
}
|
|
819
741
|
|
|
820
742
|
/**
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import winston from "winston";
|
|
2
2
|
import { Contract } from "ethers";
|
|
3
|
-
import { BigNumber, randomAddress, assign, bnZero
|
|
4
|
-
import {
|
|
3
|
+
import { BigNumber, randomAddress, assign, bnZero } from "../../utils";
|
|
4
|
+
import { L1Token, Log, PendingRootBundle, RealizedLpFee } 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";
|
|
9
8
|
|
|
10
9
|
const emptyRootBundle: PendingRootBundle = {
|
|
11
10
|
poolRebalanceRoot: "",
|
|
12
11
|
relayerRefundRoot: "",
|
|
13
12
|
slowRelayRoot: "",
|
|
14
|
-
proposer:
|
|
13
|
+
proposer: "",
|
|
15
14
|
unclaimedPoolRebalanceLeafCount: 0,
|
|
16
15
|
challengePeriodEndTimestamp: 0,
|
|
17
16
|
bundleEvaluationBlockNumbers: [],
|
|
@@ -23,9 +22,9 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
23
22
|
private realizedLpFeePct: BigNumber = bnZero;
|
|
24
23
|
private realizedLpFeePctOverride = false;
|
|
25
24
|
|
|
26
|
-
private l1TokensMock:
|
|
25
|
+
private l1TokensMock: L1Token[] = []; // L1Tokens and their associated info.
|
|
27
26
|
|
|
28
|
-
private spokePoolTokens: { [l1Token: string]: { [chainId: number]:
|
|
27
|
+
private spokePoolTokens: { [l1Token: string]: { [chainId: number]: string } } = {};
|
|
29
28
|
|
|
30
29
|
private eventManager: EventManager;
|
|
31
30
|
|
|
@@ -70,7 +69,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
70
69
|
[chainId],
|
|
71
70
|
[
|
|
72
71
|
{
|
|
73
|
-
spokePool:
|
|
72
|
+
spokePool: contract,
|
|
74
73
|
blockNumber: blockNumber,
|
|
75
74
|
transactionIndex: 0,
|
|
76
75
|
logIndex: 0,
|
|
@@ -83,7 +82,7 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
83
82
|
this.latestHeightSearched = blockNumber;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
addL1Token(l1Token:
|
|
85
|
+
addL1Token(l1Token: L1Token) {
|
|
87
86
|
this.l1TokensMock.push(l1Token);
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -93,19 +92,19 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
93
92
|
|
|
94
93
|
setTokenMapping(l1Token: string, chainId: number, l2Token: string) {
|
|
95
94
|
this.spokePoolTokens[l1Token] ??= {};
|
|
96
|
-
this.spokePoolTokens[l1Token][chainId] =
|
|
95
|
+
this.spokePoolTokens[l1Token][chainId] = l2Token;
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
l2TokenEnabledForL1TokenAtBlock(l1Token:
|
|
100
|
-
if (this.spokePoolTokens[l1Token
|
|
98
|
+
l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean {
|
|
99
|
+
if (this.spokePoolTokens[l1Token]?.[destinationChainId]) {
|
|
101
100
|
return true;
|
|
102
101
|
} else {
|
|
103
102
|
return super.l2TokenEnabledForL1TokenAtBlock(l1Token, destinationChainId, hubBlockNumber);
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
|
-
l2TokenHasPoolRebalanceRoute(l2Token:
|
|
105
|
+
l2TokenHasPoolRebalanceRoute(l2Token: string, chainId: number, hubPoolBlock: number): boolean {
|
|
107
106
|
const l1Token = Object.keys(this.spokePoolTokens).find(
|
|
108
|
-
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId]
|
|
107
|
+
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId] === l2Token
|
|
109
108
|
);
|
|
110
109
|
if (!l1Token) {
|
|
111
110
|
return super.l2TokenHasPoolRebalanceRoute(l2Token, chainId, hubPoolBlock);
|
|
@@ -116,24 +115,20 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
116
115
|
delete this.spokePoolTokens[l1Token]?.[chainId];
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
getL1TokenForL2TokenAtBlock(l2Token:
|
|
118
|
+
getL1TokenForL2TokenAtBlock(l2Token: string, chainId: number, blockNumber: number): string {
|
|
120
119
|
const l1Token = Object.keys(this.spokePoolTokens).find(
|
|
121
|
-
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId]
|
|
120
|
+
(l1Token) => this.spokePoolTokens[l1Token]?.[chainId] === l2Token
|
|
122
121
|
);
|
|
123
|
-
|
|
124
|
-
return EvmAddress.from(l1Token);
|
|
125
|
-
} else {
|
|
126
|
-
return super.getL1TokenForL2TokenAtBlock(l2Token, chainId, blockNumber);
|
|
127
|
-
}
|
|
122
|
+
return l1Token ?? super.getL1TokenForL2TokenAtBlock(l2Token, chainId, blockNumber);
|
|
128
123
|
}
|
|
129
124
|
|
|
130
|
-
getL2TokenForL1TokenAtBlock(l1Token:
|
|
131
|
-
const l2Token = this.spokePoolTokens[l1Token
|
|
125
|
+
getL2TokenForL1TokenAtBlock(l1Token: string, chainId: number, blockNumber: number): string {
|
|
126
|
+
const l2Token = this.spokePoolTokens[l1Token]?.[chainId];
|
|
132
127
|
return l2Token ?? super.getL2TokenForL1TokenAtBlock(l1Token, chainId, blockNumber);
|
|
133
128
|
}
|
|
134
129
|
|
|
135
|
-
getTokenInfoForL1Token(l1Token:
|
|
136
|
-
return this.l1TokensMock.find((token) => token.address
|
|
130
|
+
getTokenInfoForL1Token(l1Token: string): L1Token | undefined {
|
|
131
|
+
return this.l1TokensMock.find((token) => token.address === l1Token);
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
_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
|
|
5
|
+
import { EMPTY_MESSAGE, ZERO_ADDRESS } from "../../constants";
|
|
6
6
|
import {
|
|
7
7
|
Log,
|
|
8
8
|
Deposit,
|
|
@@ -27,9 +27,6 @@ import {
|
|
|
27
27
|
bnOne,
|
|
28
28
|
toBytes32,
|
|
29
29
|
spreadEventWithBlockNumber,
|
|
30
|
-
Address,
|
|
31
|
-
toAddressType,
|
|
32
|
-
isDefined,
|
|
33
30
|
} from "../../utils";
|
|
34
31
|
import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
|
|
35
32
|
import { HubPoolClient } from "../HubPoolClient";
|
|
@@ -65,11 +62,8 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
65
62
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
69
|
-
|
|
70
|
-
return isDefined(override)
|
|
71
|
-
? toAddressType(override, deposit.destinationChainId)
|
|
72
|
-
: super.getDestinationTokenForDeposit(deposit);
|
|
65
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
66
|
+
return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -135,26 +129,23 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
135
129
|
return this._deposit("FundsDeposited", deposit);
|
|
136
130
|
}
|
|
137
131
|
|
|
138
|
-
protected _deposit(
|
|
139
|
-
event: string,
|
|
140
|
-
deposit: Omit<Deposit, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
141
|
-
): Log {
|
|
132
|
+
protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
142
133
|
const { blockNumber, txnIndex } = deposit;
|
|
143
134
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
144
135
|
depositId ??= this.numberOfDeposits;
|
|
145
136
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
146
137
|
|
|
147
138
|
destinationChainId ??= random(1, 42161, false);
|
|
148
|
-
const depositor = deposit.depositor
|
|
149
|
-
const recipient = deposit.recipient
|
|
150
|
-
const inputToken = deposit.inputToken
|
|
151
|
-
const outputToken = deposit.outputToken
|
|
152
|
-
const exclusiveRelayer = deposit.exclusiveRelayer
|
|
139
|
+
const depositor = toBytes32(deposit.depositor ?? randomAddress());
|
|
140
|
+
const recipient = toBytes32(deposit.recipient ?? depositor);
|
|
141
|
+
const inputToken = toBytes32(deposit.inputToken ?? randomAddress());
|
|
142
|
+
const outputToken = toBytes32(deposit.outputToken ?? inputToken);
|
|
143
|
+
const exclusiveRelayer = toBytes32(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
153
144
|
|
|
154
145
|
inputAmount ??= toBNWei(random(1, 1000, false));
|
|
155
146
|
outputAmount ??= inputAmount.mul(toBN("0.95"));
|
|
156
147
|
|
|
157
|
-
const message = deposit
|
|
148
|
+
const message = deposit["message"] ?? "0x";
|
|
158
149
|
const topics = [destinationChainId, depositId, depositor];
|
|
159
150
|
const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
|
|
160
151
|
const args = {
|
|
@@ -200,20 +191,19 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
200
191
|
outputAmount ??= inputAmount;
|
|
201
192
|
fillDeadline ??= getCurrentTime() + 60;
|
|
202
193
|
|
|
203
|
-
const depositor = fill.depositor
|
|
204
|
-
const recipient = fill.recipient
|
|
205
|
-
const inputToken = fill.inputToken
|
|
206
|
-
const outputToken = fill.outputToken
|
|
207
|
-
const exclusiveRelayer = fill.exclusiveRelayer
|
|
208
|
-
const relayer = fill.relayer
|
|
194
|
+
const depositor = toBytes32(fill.depositor ?? randomAddress());
|
|
195
|
+
const recipient = toBytes32(fill.recipient ?? depositor);
|
|
196
|
+
const inputToken = toBytes32(fill.inputToken ?? randomAddress());
|
|
197
|
+
const outputToken = toBytes32(fill.outputToken ?? ZERO_ADDRESS);
|
|
198
|
+
const exclusiveRelayer = toBytes32(fill.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
199
|
+
const relayer = toBytes32(fill.relayer ?? randomAddress());
|
|
209
200
|
|
|
210
201
|
const topics = [originChainId, depositId, relayer];
|
|
211
202
|
const message = fill.message ?? EMPTY_MESSAGE;
|
|
212
203
|
const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
|
|
213
|
-
const updatedRecipient = fill.relayExecutionInfo?.updatedRecipient.toBytes32() ?? recipient;
|
|
214
204
|
|
|
215
205
|
const relayExecutionInfo = {
|
|
216
|
-
updatedRecipient,
|
|
206
|
+
updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
|
|
217
207
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
218
208
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
219
209
|
};
|
|
@@ -233,7 +223,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
233
223
|
depositor,
|
|
234
224
|
recipient,
|
|
235
225
|
relayExecutionInfo: {
|
|
236
|
-
updatedRecipient,
|
|
226
|
+
updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
|
|
237
227
|
updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
|
|
238
228
|
fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
|
|
239
229
|
},
|
|
@@ -263,7 +253,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
263
253
|
}
|
|
264
254
|
|
|
265
255
|
protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
|
|
266
|
-
const depositor = speedUp.depositor
|
|
256
|
+
const depositor = toBytes32(speedUp.depositor);
|
|
267
257
|
const topics = [speedUp.depositId, depositor];
|
|
268
258
|
const args = { ...speedUp };
|
|
269
259
|
|
|
@@ -274,7 +264,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
274
264
|
args: {
|
|
275
265
|
...args,
|
|
276
266
|
depositor,
|
|
277
|
-
updatedRecipient: speedUp.updatedRecipient
|
|
267
|
+
updatedRecipient: toBytes32(speedUp.updatedRecipient),
|
|
278
268
|
},
|
|
279
269
|
});
|
|
280
270
|
}
|
|
@@ -304,7 +294,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
304
294
|
const topics = [originChainId, depositId];
|
|
305
295
|
const args = { ...request };
|
|
306
296
|
|
|
307
|
-
const depositor = args.depositor
|
|
297
|
+
const depositor = toBytes32(args.depositor ?? randomAddress());
|
|
308
298
|
|
|
309
299
|
return this.eventManager.generateEvent({
|
|
310
300
|
event,
|
|
@@ -314,11 +304,10 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
314
304
|
...args,
|
|
315
305
|
destinationChainId: this.chainId,
|
|
316
306
|
depositor,
|
|
317
|
-
recipient: args.recipient
|
|
318
|
-
inputToken: args.inputToken
|
|
319
|
-
outputToken: args.outputToken
|
|
320
|
-
exclusiveRelayer: args.exclusiveRelayer
|
|
321
|
-
messageHash: args.messageHash ?? ZERO_BYTES,
|
|
307
|
+
recipient: toBytes32(args.recipient ?? depositor),
|
|
308
|
+
inputToken: toBytes32(args.inputToken ?? randomAddress()),
|
|
309
|
+
outputToken: toBytes32(args.outputToken ?? ZERO_ADDRESS),
|
|
310
|
+
exclusiveRelayer: toBytes32(args.exclusiveRelayer ?? ZERO_ADDRESS),
|
|
322
311
|
},
|
|
323
312
|
blockNumber: request.blockNumber,
|
|
324
313
|
transactionIndex: request.txnIndex,
|
|
@@ -331,7 +320,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
331
320
|
const fill = {
|
|
332
321
|
...leaf.relayData,
|
|
333
322
|
destinationChainId: this.chainId,
|
|
334
|
-
relayer:
|
|
323
|
+
relayer: ZERO_ADDRESS,
|
|
335
324
|
repaymentChainId: 0,
|
|
336
325
|
relayExecutionInfo: {
|
|
337
326
|
updatedRecipient: leaf.relayData.recipient,
|
|
@@ -2,15 +2,7 @@ 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 {
|
|
6
|
-
getCurrentTime,
|
|
7
|
-
bnZero,
|
|
8
|
-
MakeOptional,
|
|
9
|
-
EventSearchConfig,
|
|
10
|
-
Address as SDKAddress,
|
|
11
|
-
toAddressType,
|
|
12
|
-
isDefined,
|
|
13
|
-
} from "../../utils";
|
|
5
|
+
import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
|
|
14
6
|
import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
|
|
15
7
|
import { HubPoolClient } from "../HubPoolClient";
|
|
16
8
|
import { EventOverrides } from "./MockEvents";
|
|
@@ -54,9 +46,8 @@ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
|
|
|
54
46
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
55
47
|
}
|
|
56
48
|
|
|
57
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
58
|
-
|
|
59
|
-
return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
|
|
49
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
50
|
+
return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
|
|
60
51
|
}
|
|
61
52
|
|
|
62
53
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber } 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: string[];
|
|
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: string;
|
|
20
|
+
refundAddresses: string[];
|
|
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: string;
|
|
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: string[];
|
|
59
59
|
proof: string[];
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -76,14 +76,8 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
|
|
|
76
76
|
groupIndex: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export interface
|
|
80
|
-
address:
|
|
81
|
-
symbol: string;
|
|
82
|
-
decimals: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface TokenInfo {
|
|
86
|
-
address: Address;
|
|
79
|
+
export interface L1Token {
|
|
80
|
+
address: string;
|
|
87
81
|
symbol: string;
|
|
88
82
|
decimals: number;
|
|
89
83
|
}
|
|
@@ -93,30 +87,27 @@ export interface LpToken {
|
|
|
93
87
|
liquidReserves: BigNumber;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
97
90
|
export interface CrossChainContractsSet extends SortableEvent {
|
|
98
91
|
l2ChainId: number;
|
|
99
|
-
spokePool:
|
|
92
|
+
spokePool: string;
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
103
95
|
export interface DestinationTokenWithBlock extends SortableEvent {
|
|
104
|
-
l2Token:
|
|
105
|
-
l1Token:
|
|
96
|
+
l2Token: string;
|
|
97
|
+
l1Token: string;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
109
100
|
export interface SetPoolRebalanceRoot extends SortableEvent {
|
|
110
101
|
destinationChainId: number;
|
|
111
|
-
l1Token:
|
|
112
|
-
destinationToken:
|
|
102
|
+
l1Token: string;
|
|
103
|
+
destinationToken: string;
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
export interface PendingRootBundle {
|
|
116
107
|
poolRebalanceRoot: string;
|
|
117
108
|
relayerRefundRoot: string;
|
|
118
109
|
slowRelayRoot: string;
|
|
119
|
-
proposer:
|
|
110
|
+
proposer: string;
|
|
120
111
|
unclaimedPoolRebalanceLeafCount: number;
|
|
121
112
|
challengePeriodEndTimestamp: number;
|
|
122
113
|
bundleEvaluationBlockNumbers: number[];
|