@across-protocol/sdk 4.2.7 → 4.2.9-alpha.0

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