@across-protocol/sdk 4.2.14-alpha.0 → 4.2.14
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 +5 -22
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +11 -14
- 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 +7 -3
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +77 -69
- 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 +23 -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/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 +6 -23
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.js +12 -15
- 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 +15 -3
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +86 -71
- 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 +23 -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/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 +15 -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 +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 +23 -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/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 +11 -53
- package/src/arch/svm/SpokeUtils.ts +11 -44
- 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 +66 -107
- 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 +25 -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/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +7 -7
|
@@ -13,16 +13,19 @@ 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";
|
|
25
26
|
import {
|
|
27
|
+
BridgedToHubPoolWithBlock,
|
|
28
|
+
ClaimedRelayerRefundWithBlock,
|
|
26
29
|
Deposit,
|
|
27
30
|
DepositWithBlock,
|
|
28
31
|
EnabledDepositRouteWithBlock,
|
|
@@ -36,7 +39,6 @@ import {
|
|
|
36
39
|
SortableEvent,
|
|
37
40
|
SpeedUpWithBlock,
|
|
38
41
|
TokensBridged,
|
|
39
|
-
RelayExecutionEventInfo,
|
|
40
42
|
} from "../../interfaces";
|
|
41
43
|
import { BaseAbstractClient, UpdateFailureReason } from "../BaseAbstractClient";
|
|
42
44
|
import { AcrossConfigStoreClient } from "../AcrossConfigStoreClient";
|
|
@@ -68,6 +70,7 @@ export const knownEventNames = [
|
|
|
68
70
|
"RequestedSlowFill",
|
|
69
71
|
"FilledV3Relay",
|
|
70
72
|
"FilledRelay",
|
|
73
|
+
"ClaimedRelayerRefund",
|
|
71
74
|
];
|
|
72
75
|
|
|
73
76
|
/**
|
|
@@ -84,6 +87,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
84
87
|
protected tokensBridged: TokensBridged[] = [];
|
|
85
88
|
protected rootBundleRelays: RootBundleRelayWithBlock[] = [];
|
|
86
89
|
protected relayerRefundExecutions: RelayerRefundExecutionWithBlock[] = [];
|
|
90
|
+
protected claimedRelayerRefunds: ClaimedRelayerRefundWithBlock[] = [];
|
|
91
|
+
protected bridgedToHubPool: BridgedToHubPoolWithBlock[] = [];
|
|
87
92
|
protected configStoreClient: AcrossConfigStoreClient | undefined;
|
|
88
93
|
protected invalidFills: Set<string> = new Set();
|
|
89
94
|
public readonly depositHashes: { [depositHash: string]: DepositWithBlock } = {};
|
|
@@ -202,8 +207,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
202
207
|
* @param relayer The relayer address.
|
|
203
208
|
* @returns A list of fills.
|
|
204
209
|
*/
|
|
205
|
-
public getFillsForRelayer(relayer:
|
|
206
|
-
return this.getFills().filter((fill) => fill.relayer
|
|
210
|
+
public getFillsForRelayer(relayer: string): FillWithBlock[] {
|
|
211
|
+
return this.getFills().filter((fill) => fill.relayer === relayer);
|
|
207
212
|
}
|
|
208
213
|
|
|
209
214
|
/**
|
|
@@ -242,6 +247,22 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
242
247
|
return this.relayerRefundExecutions;
|
|
243
248
|
}
|
|
244
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Retrieves a list of claimed relayer refunds from the SpokePool contract.
|
|
252
|
+
* @returns A list of claimed relayer refunds.
|
|
253
|
+
*/
|
|
254
|
+
public getClaimedRelayerRefunds(): ClaimedRelayerRefundWithBlock[] {
|
|
255
|
+
return this.claimedRelayerRefunds;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Retrieves a list of bridged to hub pool events from the SpokePool contract.
|
|
260
|
+
* @returns A list of bridged to hub pool events.
|
|
261
|
+
*/
|
|
262
|
+
public getBridgedToHubPoolEvents(): BridgedToHubPoolWithBlock[] {
|
|
263
|
+
return this.bridgedToHubPool;
|
|
264
|
+
}
|
|
265
|
+
|
|
245
266
|
/**
|
|
246
267
|
* Appends a speed up signature to a specific deposit.
|
|
247
268
|
* @param deposit The deposit to append the speed up signature to.
|
|
@@ -251,8 +272,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
251
272
|
const { depositId, depositor } = deposit;
|
|
252
273
|
|
|
253
274
|
// 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()];
|
|
275
|
+
const speedups = this.speedUps[toAddress(depositor)]?.[depositId.toString()];
|
|
256
276
|
|
|
257
277
|
if (!isDefined(speedups) || speedups.length === 0) {
|
|
258
278
|
return deposit;
|
|
@@ -385,8 +405,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
385
405
|
if (
|
|
386
406
|
this.hubPoolClient &&
|
|
387
407
|
!isSlowFill(fill) &&
|
|
388
|
-
chainIsEvm(repaymentChainId)
|
|
389
|
-
!fill.relayer.isValidEvmAddress()
|
|
408
|
+
(!chainIsEvm(repaymentChainId) || !isValidEvmAddress(fill.relayer))
|
|
390
409
|
) {
|
|
391
410
|
groupedFills.unrepayableFills.push(fill);
|
|
392
411
|
}
|
|
@@ -409,7 +428,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
409
428
|
chainId: this.chainId,
|
|
410
429
|
message: "Unrepayable fills found where we need to switch repayment address and or chain",
|
|
411
430
|
deposit,
|
|
412
|
-
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer
|
|
431
|
+
unrepayableFills: Object.fromEntries(unrepayableFillsForDeposit.map((x) => [x.relayer, x])),
|
|
413
432
|
notificationPath: "across-unrepayable-fills",
|
|
414
433
|
});
|
|
415
434
|
}
|
|
@@ -481,36 +500,14 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
481
500
|
const { events: queryResults, currentTime, searchEndBlock } = update;
|
|
482
501
|
|
|
483
502
|
if (eventsToQuery.includes("TokensBridged")) {
|
|
484
|
-
for (const
|
|
485
|
-
|
|
486
|
-
l2TokenAddress: string;
|
|
487
|
-
};
|
|
488
|
-
this.tokensBridged.push({
|
|
489
|
-
...event,
|
|
490
|
-
l2TokenAddress: toAddressType(event.l2TokenAddress, this.chainId),
|
|
491
|
-
});
|
|
503
|
+
for (const event of queryResults[eventsToQuery.indexOf("TokensBridged")] as TokensBridged[]) {
|
|
504
|
+
this.tokensBridged.push(event);
|
|
492
505
|
}
|
|
493
506
|
}
|
|
494
507
|
|
|
495
508
|
// Performs the indexing of a deposit-like spoke pool event.
|
|
496
509
|
const queryDepositEvents = async (eventName: string) => {
|
|
497
|
-
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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
|
-
});
|
|
510
|
+
const depositEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as DepositWithBlock[];
|
|
514
511
|
if (depositEvents.length > 0) {
|
|
515
512
|
this.log(
|
|
516
513
|
"debug",
|
|
@@ -567,21 +564,11 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
567
564
|
|
|
568
565
|
// Performs indexing of a "speed up deposit"-like event.
|
|
569
566
|
const querySpeedUpDepositEvents = (eventName: string) => {
|
|
570
|
-
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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
|
-
});
|
|
567
|
+
const speedUpEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SpeedUpWithBlock[];
|
|
578
568
|
|
|
579
569
|
for (const event of speedUpEvents) {
|
|
580
|
-
const speedUp = {
|
|
581
|
-
|
|
582
|
-
originChainId: this.chainId,
|
|
583
|
-
};
|
|
584
|
-
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]);
|
|
585
572
|
|
|
586
573
|
// Find deposit hash matching this speed up event and update the deposit data associated with the hash,
|
|
587
574
|
// if the hash+data exists.
|
|
@@ -605,23 +592,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
605
592
|
|
|
606
593
|
// Performs indexing of "requested slow fill"-like events.
|
|
607
594
|
const queryRequestedSlowFillEvents = (eventName: string) => {
|
|
608
|
-
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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
|
-
});
|
|
595
|
+
const slowFillRequests = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as SlowFillRequestWithBlock[];
|
|
625
596
|
for (const event of slowFillRequests) {
|
|
626
597
|
const slowFillRequest = {
|
|
627
598
|
...event,
|
|
@@ -648,30 +619,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
648
619
|
|
|
649
620
|
// Performs indexing of filled relay-like events.
|
|
650
621
|
const queryFilledRelayEvents = (eventName: string) => {
|
|
651
|
-
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? [])
|
|
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
|
-
});
|
|
622
|
+
const fillEvents = (queryResults[eventsToQuery.indexOf(eventName)] ?? []) as FillWithBlock[];
|
|
675
623
|
|
|
676
624
|
if (fillEvents.length > 0) {
|
|
677
625
|
this.log("debug", `Using ${fillEvents.length} newly queried ${eventName} events for chain ${this.chainId}`, {
|
|
@@ -707,9 +655,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
707
655
|
});
|
|
708
656
|
|
|
709
657
|
if (eventsToQuery.includes("EnabledDepositRoute")) {
|
|
710
|
-
const enableDepositsEvents = queryResults[
|
|
711
|
-
|
|
712
|
-
] as EnabledDepositRouteWithBlock[];
|
|
658
|
+
const enableDepositsEvents = (queryResults[eventsToQuery.indexOf("EnabledDepositRoute")] ??
|
|
659
|
+
[]) as EnabledDepositRouteWithBlock[];
|
|
713
660
|
|
|
714
661
|
for (const event of enableDepositsEvents) {
|
|
715
662
|
assign(this.depositRoutes, [event.originToken, event.destinationChainId], event.enabled);
|
|
@@ -717,26 +664,40 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
717
664
|
}
|
|
718
665
|
|
|
719
666
|
if (eventsToQuery.includes("RelayedRootBundle")) {
|
|
720
|
-
const relayedRootBundleEvents = queryResults[
|
|
721
|
-
|
|
722
|
-
] as RootBundleRelayWithBlock[];
|
|
667
|
+
const relayedRootBundleEvents = (queryResults[eventsToQuery.indexOf("RelayedRootBundle")] ??
|
|
668
|
+
[]) as RootBundleRelayWithBlock[];
|
|
723
669
|
for (const event of relayedRootBundleEvents) {
|
|
724
670
|
this.rootBundleRelays.push(event);
|
|
725
671
|
}
|
|
726
672
|
}
|
|
727
673
|
|
|
728
674
|
if (eventsToQuery.includes("ExecutedRelayerRefundRoot")) {
|
|
729
|
-
const refundEvents = queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")]
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
this.relayerRefundExecutions.push(
|
|
675
|
+
const refundEvents = (queryResults[eventsToQuery.indexOf("ExecutedRelayerRefundRoot")] ??
|
|
676
|
+
[]) as RelayerRefundExecutionWithBlock[];
|
|
677
|
+
for (const event of refundEvents) {
|
|
678
|
+
this.relayerRefundExecutions.push(event);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (eventsToQuery.includes("ClaimedRelayerRefund")) {
|
|
683
|
+
const claimedRelayerRefundEvents = (queryResults[eventsToQuery.indexOf("ClaimedRelayerRefund")] ??
|
|
684
|
+
[]) as (ClaimedRelayerRefundWithBlock & { claimAmount?: BigNumber })[];
|
|
685
|
+
for (const event of claimedRelayerRefundEvents) {
|
|
686
|
+
this.claimedRelayerRefunds.push({
|
|
733
687
|
...event,
|
|
734
|
-
|
|
735
|
-
refundAddresses: event.refundAddresses.map((addr) => toAddressType(addr, this.chainId)),
|
|
688
|
+
amount: event.amount || event.claimAmount, // Note: This field is named differently in EVM and SVM
|
|
736
689
|
});
|
|
737
690
|
}
|
|
738
691
|
}
|
|
739
692
|
|
|
693
|
+
if (eventsToQuery.includes("BridgedToHubPool")) {
|
|
694
|
+
const bridgedToHubPoolEvents = (queryResults[eventsToQuery.indexOf("BridgedToHubPool")] ??
|
|
695
|
+
[]) as (BridgedToHubPoolWithBlock & { amount?: BigNumber })[];
|
|
696
|
+
for (const event of bridgedToHubPoolEvents) {
|
|
697
|
+
this.bridgedToHubPool.push(event);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
740
701
|
if (duplicateEvents.length > 0) {
|
|
741
702
|
this.log("debug", "Duplicate events listed", {
|
|
742
703
|
duplicateEvents,
|
|
@@ -781,9 +742,9 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
781
742
|
* @param deposit The deposit to retrieve the destination token for.
|
|
782
743
|
* @returns The destination token.
|
|
783
744
|
*/
|
|
784
|
-
protected getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
745
|
+
protected getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
785
746
|
if (!this.canResolveZeroAddressOutputToken(deposit)) {
|
|
786
|
-
return
|
|
747
|
+
return ZERO_ADDRESS;
|
|
787
748
|
}
|
|
788
749
|
// L1 token should be resolved if we get here:
|
|
789
750
|
const l1Token = this.hubPoolClient!.getL1TokenForL2TokenAtBlock(
|
|
@@ -791,12 +752,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
791
752
|
deposit.originChainId,
|
|
792
753
|
deposit.quoteBlockNumber
|
|
793
754
|
)!;
|
|
794
|
-
|
|
795
|
-
l1Token,
|
|
796
|
-
|
|
797
|
-
deposit.quoteBlockNumber
|
|
755
|
+
return (
|
|
756
|
+
this.hubPoolClient!.getL2TokenForL1TokenAtBlock(l1Token, deposit.destinationChainId, deposit.quoteBlockNumber) ??
|
|
757
|
+
ZERO_ADDRESS
|
|
798
758
|
);
|
|
799
|
-
return counterpartToken ?? toAddressType(ZERO_ADDRESS);
|
|
800
759
|
}
|
|
801
760
|
|
|
802
761
|
/**
|
|
@@ -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 {
|