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