@across-protocol/sdk 4.2.14-alpha.1 → 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.
Files changed (194) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +2 -5
  2. package/dist/cjs/arch/evm/SpokeUtils.js +5 -22
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.js +11 -14
  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 +13 -15
  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 +2 -4
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  12. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  13. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +56 -60
  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 +1 -2
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  21. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  22. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  23. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  24. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  25. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -11
  26. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  27. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  28. package/dist/cjs/clients/HubPoolClient.js +60 -84
  29. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  30. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  31. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  32. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +7 -3
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +77 -69
  34. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  36. package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -39
  40. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  42. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  43. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/interfaces/HubPool.d.ts +14 -19
  45. package/dist/cjs/interfaces/SpokePool.d.ts +23 -13
  46. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  47. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
  48. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  49. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  50. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +15 -14
  51. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  52. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  53. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
  54. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  55. package/dist/cjs/utils/AddressUtils.d.ts +3 -6
  56. package/dist/cjs/utils/AddressUtils.js +14 -42
  57. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  58. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  59. package/dist/cjs/utils/SpokeUtils.js +22 -4
  60. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  61. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  62. package/dist/cjs/utils/TokenUtils.js +3 -3
  63. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  64. package/dist/esm/arch/evm/SpokeUtils.d.ts +2 -5
  65. package/dist/esm/arch/evm/SpokeUtils.js +6 -23
  66. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  67. package/dist/esm/arch/svm/SpokeUtils.js +12 -15
  68. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  69. package/dist/esm/arch/svm/utils.d.ts +1 -1
  70. package/dist/esm/arch/svm/utils.js +13 -15
  71. package/dist/esm/arch/svm/utils.js.map +1 -1
  72. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  73. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  74. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  75. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  76. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +57 -61
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  78. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  79. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  80. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  81. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  83. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  84. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  85. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  86. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  88. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +9 -12
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  90. package/dist/esm/clients/HubPoolClient.d.ts +22 -23
  91. package/dist/esm/clients/HubPoolClient.js +64 -97
  92. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  93. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  94. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  95. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +15 -3
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +86 -71
  97. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  98. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  99. package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
  100. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  101. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -41
  103. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  104. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  105. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  106. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  107. package/dist/esm/interfaces/HubPool.d.ts +14 -19
  108. package/dist/esm/interfaces/SpokePool.d.ts +23 -13
  109. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  110. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
  111. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  112. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  113. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +16 -15
  114. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  115. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  116. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
  117. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  118. package/dist/esm/utils/AddressUtils.d.ts +3 -7
  119. package/dist/esm/utils/AddressUtils.js +19 -52
  120. package/dist/esm/utils/AddressUtils.js.map +1 -1
  121. package/dist/esm/utils/SpokeUtils.d.ts +8 -3
  122. package/dist/esm/utils/SpokeUtils.js +26 -4
  123. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  124. package/dist/esm/utils/TokenUtils.d.ts +16 -18
  125. package/dist/esm/utils/TokenUtils.js +3 -3
  126. package/dist/esm/utils/TokenUtils.js.map +1 -1
  127. package/dist/types/arch/evm/SpokeUtils.d.ts +2 -5
  128. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  129. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  130. package/dist/types/arch/svm/utils.d.ts +1 -1
  131. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  132. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  133. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  134. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  135. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  136. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  137. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  138. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  139. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  140. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  141. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  142. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  143. package/dist/types/clients/HubPoolClient.d.ts +22 -23
  144. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  145. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  146. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +15 -3
  147. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  148. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  149. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  150. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  151. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  152. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  153. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  154. package/dist/types/interfaces/HubPool.d.ts +14 -19
  155. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  156. package/dist/types/interfaces/SpokePool.d.ts +23 -13
  157. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  158. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  159. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  160. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  161. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  163. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  164. package/dist/types/utils/AddressUtils.d.ts +3 -7
  165. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  166. package/dist/types/utils/SpokeUtils.d.ts +8 -3
  167. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  168. package/dist/types/utils/TokenUtils.d.ts +16 -18
  169. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  170. package/package.json +3 -2
  171. package/src/arch/evm/SpokeUtils.ts +11 -53
  172. package/src/arch/svm/SpokeUtils.ts +11 -44
  173. package/src/arch/svm/utils.ts +3 -3
  174. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
  175. package/src/clients/BundleDataClient/BundleDataClient.ts +52 -54
  176. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
  177. package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
  178. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
  179. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  180. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
  181. package/src/clients/HubPoolClient.ts +83 -126
  182. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
  183. package/src/clients/SpokePoolClient/SpokePoolClient.ts +66 -107
  184. package/src/clients/mocks/MockHubPoolClient.ts +19 -24
  185. package/src/clients/mocks/MockSpokePoolClient.ts +26 -37
  186. package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
  187. package/src/interfaces/HubPool.ts +14 -23
  188. package/src/interfaces/SpokePool.ts +25 -13
  189. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
  190. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +21 -16
  191. package/src/relayFeeCalculator/relayFeeCalculator.ts +12 -20
  192. package/src/utils/AddressUtils.ts +21 -56
  193. package/src/utils/SpokeUtils.ts +33 -11
  194. package/src/utils/TokenUtils.ts +7 -7
@@ -1,9 +1,8 @@
1
1
  import assert from "assert";
2
2
  import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
3
3
  import { CHAIN_IDs } from "../../constants";
4
- import { Deposit, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
4
+ import { Deposit, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
5
5
  import {
6
- EvmAddress,
7
6
  bnUint32Max,
8
7
  BigNumber,
9
8
  toBN,
@@ -14,11 +13,11 @@ import {
14
13
  isDefined,
15
14
  isUnsafeDepositId,
16
15
  isZeroAddress,
16
+ getDepositRelayData,
17
17
  getNetworkName,
18
18
  paginatedEventQuery,
19
19
  spreadEventWithBlockNumber,
20
- Address,
21
- toAddressType,
20
+ toBytes32,
22
21
  } from "../../utils";
23
22
 
24
23
  type BlockTag = providers.BlockTag;
@@ -31,31 +30,11 @@ type BlockTag = providers.BlockTag;
31
30
  */
32
31
  export function populateV3Relay(
33
32
  spokePool: Contract,
34
- deposit: Omit<Deposit, "messageHash" | "fromLiteChain" | "toLiteChain"> & {
35
- recipient: EvmAddress;
36
- exclusiveRelayer: EvmAddress;
37
- },
38
- relayer: Address,
33
+ deposit: Omit<Deposit, "messageHash">,
34
+ relayer: string,
39
35
  repaymentChainId = deposit.destinationChainId
40
36
  ): Promise<PopulatedTransaction> {
41
- assert(
42
- relayer.isValidOn(repaymentChainId),
43
- `Invalid repayment address for chain ${repaymentChainId}: ${relayer.toAddress()}.`
44
- );
45
- const relayData = {
46
- depositor: deposit.depositor.toBytes32(),
47
- recipient: deposit.recipient.toBytes32(),
48
- inputToken: deposit.inputToken.toBytes32(),
49
- outputToken: deposit.outputToken.toBytes32(),
50
- inputAmount: deposit.inputAmount,
51
- outputAmount: deposit.outputAmount,
52
- originChainId: deposit.originChainId,
53
- depositId: deposit.depositId,
54
- fillDeadline: deposit.fillDeadline,
55
- exclusivityDeadline: deposit.exclusivityDeadline,
56
- message: deposit.message,
57
- exclusiveRelayer: deposit.exclusiveRelayer.toBytes32(),
58
- };
37
+ const relayData = getDepositRelayData(deposit);
59
38
 
60
39
  if (isDefined(deposit.speedUpSignature)) {
61
40
  assert(isDefined(deposit.updatedRecipient) && !isZeroAddress(deposit.updatedRecipient));
@@ -64,18 +43,16 @@ export function populateV3Relay(
64
43
  return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
65
44
  relayData,
66
45
  repaymentChainId,
67
- relayer.toBytes32(),
46
+ toBytes32(relayer),
68
47
  deposit.updatedOutputAmount,
69
- deposit.updatedRecipient.toBytes32(),
48
+ toBytes32(deposit.updatedRecipient),
70
49
  deposit.updatedMessage,
71
50
  deposit.speedUpSignature,
72
- { from: relayer.toAddress() }
51
+ { from: relayer }
73
52
  );
74
53
  }
75
54
 
76
- return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, relayer.toBytes32(), {
77
- from: relayer.toAddress(),
78
- });
55
+ return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, toBytes32(relayer), { from: relayer });
79
56
  }
80
57
 
81
58
  /**
@@ -338,27 +315,8 @@ export async function findFillEvent(
338
315
  const destinationChainId = Object.values(CHAIN_IDs).includes(relayData.originChainId)
339
316
  ? (await spokePool.provider.getNetwork()).chainId
340
317
  : Number(await spokePool.chainId());
341
- const fillEvent = spreadEventWithBlockNumber(event) as FillWithBlock & {
342
- depositor: string;
343
- recipient: string;
344
- inputToken: string;
345
- outputToken: string;
346
- exclusiveRelayer: string;
347
- relayer: string;
348
- relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
349
- };
350
318
  const fill = {
351
- ...fillEvent,
352
- inputToken: toAddressType(fillEvent.inputToken, relayData.originChainId),
353
- outputToken: toAddressType(fillEvent.outputToken, destinationChainId),
354
- depositor: toAddressType(fillEvent.depositor, relayData.originChainId),
355
- recipient: toAddressType(fillEvent.recipient, destinationChainId),
356
- exclusiveRelayer: toAddressType(fillEvent.exclusiveRelayer, destinationChainId),
357
- relayer: toAddressType(fillEvent.relayer, destinationChainId),
358
- relayExecutionInfo: {
359
- ...fillEvent.relayExecutionInfo,
360
- updatedRecipient: toAddressType(fillEvent.relayExecutionInfo.updatedRecipient, destinationChainId),
361
- },
319
+ ...spreadEventWithBlockNumber(event),
362
320
  destinationChainId,
363
321
  messageHash: getMessageHash(event.args.message),
364
322
  } as FillWithBlock;
@@ -27,14 +27,7 @@ import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
27
27
  import { Logger } from "winston";
28
28
 
29
29
  import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
30
- import {
31
- Deposit,
32
- DepositWithBlock,
33
- FillStatus,
34
- FillWithBlock,
35
- RelayData,
36
- RelayExecutionEventInfo,
37
- } from "../../interfaces";
30
+ import { Deposit, DepositWithBlock, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
38
31
  import { BigNumber, SvmAddress, chainIsSvm, chunk, isUnsafeDepositId, keccak256, toAddressType } from "../../utils";
39
32
  import {
40
33
  SvmCpiEventsClient,
@@ -143,19 +136,13 @@ export async function findDeposit(
143
136
  return undefined;
144
137
  }
145
138
 
146
- const unwrappedDepositEvent = unwrapEventData(depositEvent.data) as Record<string, unknown>;
147
139
  // Return the deposit event with block info
148
140
  return {
149
141
  txnRef: depositEvent.signature.toString(),
150
142
  blockNumber: Number(depositEvent.slot),
151
143
  txnIndex: 0,
152
144
  logIndex: 0,
153
- ...unwrappedDepositEvent,
154
- depositor: toAddressType(unwrappedDepositEvent.depositor as string),
155
- recipient: toAddressType(unwrappedDepositEvent.recipient as string),
156
- inputToken: toAddressType(unwrappedDepositEvent.inputToken as string),
157
- outputToken: toAddressType(unwrappedDepositEvent.outputToken as string),
158
- exclusiveRelayer: toAddressType(unwrappedDepositEvent.exclusiveRelayer as string),
145
+ ...(unwrapEventData(depositEvent.data) as Record<string, unknown>),
159
146
  } as DepositWithBlock;
160
147
  }
161
148
 
@@ -331,34 +318,14 @@ export async function findFillEvent(
331
318
 
332
319
  if (fillEvents.length > 0) {
333
320
  const rawFillEvent = fillEvents[0];
334
- const eventData = unwrapEventData(rawFillEvent.data) as FillWithBlock & {
335
- depositor: string;
336
- recipient: string;
337
- inputToken: string;
338
- outputToken: string;
339
- exclusiveRelayer: string;
340
- relayer: string;
341
- relayExecutionInfo: RelayExecutionEventInfo & { updatedRecipient: string };
342
- };
343
- const originChainId = eventData.originChainId;
344
321
  const parsedFillEvent = {
345
- ...eventData,
346
322
  transactionHash: rawFillEvent.signature,
347
323
  blockNumber: Number(rawFillEvent.slot),
348
324
  transactionIndex: 0,
349
325
  logIndex: 0,
350
326
  destinationChainId,
351
- inputToken: toAddressType(eventData.inputToken, originChainId),
352
- outputToken: toAddressType(eventData.outputToken, destinationChainId),
353
- relayer: toAddressType(eventData.relayer, destinationChainId),
354
- exclusiveRelayer: toAddressType(eventData.exclusiveRelayer, destinationChainId),
355
- depositor: toAddressType(eventData.depositor, originChainId),
356
- recipient: toAddressType(eventData.recipient, destinationChainId),
357
- relayExecutionInfo: {
358
- ...eventData.relayExecutionInfo,
359
- updatedRecipient: eventData.relayExecutionInfo.updatedRecipient,
360
- },
361
- } as FillWithBlock;
327
+ ...(unwrapEventData(rawFillEvent.data) as Record<string, unknown>),
328
+ } as unknown as FillWithBlock;
362
329
  return parsedFillEvent;
363
330
  }
364
331
 
@@ -390,7 +357,7 @@ export async function fillRelayInstruction(
390
357
  deposit.exclusiveRelayer,
391
358
  deposit.inputToken,
392
359
  deposit.outputToken,
393
- ].map((addr) => addr.forceSvmAddress());
360
+ ].map((addr) => toAddressType(addr).forceSvmAddress());
394
361
 
395
362
  const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
396
363
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
@@ -401,7 +368,7 @@ export async function fillRelayInstruction(
401
368
  const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
402
369
  getStatePda(spokePool.toV2Address()),
403
370
  getFillStatusPda(spokePool.toV2Address(), deposit, deposit.destinationChainId),
404
- getEventAuthority(spokePool.toV2Address()),
371
+ getEventAuthority(),
405
372
  ]);
406
373
  const depositIdBuffer = new Uint8Array(32);
407
374
  const shortenedBuffer = new Uint8Array(Buffer.from(deposit.depositId.toHexString().slice(2), "hex"));
@@ -624,11 +591,11 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
624
591
  assert(relayData.message.startsWith("0x"), "Message must be a hex string");
625
592
 
626
593
  const contentToHash = Buffer.concat([
627
- Uint8Array.from(addressEncoder.encode(address(relayData.depositor.toBase58()))),
628
- Uint8Array.from(addressEncoder.encode(address(relayData.recipient.toBase58()))),
629
- Uint8Array.from(addressEncoder.encode(address(relayData.exclusiveRelayer.toBase58()))),
630
- Uint8Array.from(addressEncoder.encode(address(relayData.inputToken.toBase58()))),
631
- Uint8Array.from(addressEncoder.encode(address(relayData.outputToken.toBase58()))),
594
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.depositor, "base16").toV2Address())),
595
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.recipient, "base16").toV2Address())),
596
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.exclusiveRelayer, "base16").toV2Address())),
597
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.inputToken, "base16").toV2Address())),
598
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.outputToken, "base16").toV2Address())),
632
599
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.inputAmount.toString()))),
633
600
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
634
601
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.originChainId.toString()))),
@@ -273,13 +273,13 @@ export async function getInstructionParamsPda(programId: Address, signer: Addres
273
273
  * Returns the PDA for the Event Authority.
274
274
  * @returns The PDA for the Event Authority.
275
275
  */
276
- export async function getEventAuthority(programId: Address): Promise<Address> {
276
+ export const getEventAuthority = async () => {
277
277
  const [eventAuthority] = await getProgramDerivedAddress({
278
- programAddress: programId,
278
+ programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
279
279
  seeds: ["__event_authority"],
280
280
  });
281
281
  return eventAuthority;
282
- }
282
+ };
283
283
 
284
284
  /**
285
285
  * Returns a random SVM address.
@@ -5,7 +5,6 @@ import winston from "winston";
5
5
  import { isError } from "../../typeguards";
6
6
  import {
7
7
  EventSearchConfig,
8
- EvmAddress,
9
8
  MakeOptional,
10
9
  isArrayOf,
11
10
  isDefined,
@@ -108,7 +107,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
108
107
  }
109
108
 
110
109
  getRateModelForBlockNumber(
111
- l1Token: EvmAddress,
110
+ l1Token: string,
112
111
  originChainId: number | string,
113
112
  destinationChainId: number | string,
114
113
  blockNumber: number | undefined = undefined
@@ -122,9 +121,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
122
121
 
123
122
  const defaultRateModelUpdate = sortEventsDescending(this.cumulativeRateModelUpdates).find(
124
123
  (config) =>
125
- config.blockNumber <= (blockNumber ?? 0) &&
126
- config.l1Token === l1Token.toEvmAddress() &&
127
- config.rateModel !== undefined
124
+ config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token && config.rateModel !== undefined
128
125
  );
129
126
  if (!defaultRateModelUpdate) {
130
127
  throw new Error(`Could not find TokenConfig update for ${l1Token} at block ${blockNumber}`);
@@ -133,12 +130,12 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
133
130
  }
134
131
 
135
132
  getRouteRateModelForBlockNumber(
136
- l1Token: EvmAddress,
133
+ l1Token: string,
137
134
  route: string,
138
135
  blockNumber: number | undefined = undefined
139
136
  ): RateModel | undefined {
140
137
  const config = (sortEventsDescending(this.cumulativeRouteRateModelUpdates) as RouteRateModelUpdate[]).find(
141
- (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token.toEvmAddress()
138
+ (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token
142
139
  );
143
140
  if (config?.routeRateModel[route] === undefined) {
144
141
  return undefined;
@@ -40,9 +40,9 @@ import {
40
40
  isZeroValueDeposit,
41
41
  isZeroValueFillOrSlowFillRequest,
42
42
  chainIsEvm,
43
+ isValidEvmAddress,
43
44
  duplicateEvent,
44
45
  invalidOutputToken,
45
- Address,
46
46
  } from "../../utils";
47
47
  import winston from "winston";
48
48
  import {
@@ -67,20 +67,22 @@ type DataCache = Record<string, Promise<LoadDataReturnValue>>;
67
67
  // V3 dictionary helper functions
68
68
  function updateExpiredDepositsV3(dict: ExpiredDepositsToRefundV3, deposit: V3DepositWithBlock): void {
69
69
  // A deposit refund for a deposit is invalid if the depositor has a bytes32 address input for an EVM chain. It is valid otherwise.
70
- if (chainIsEvm(deposit.originChainId) && !deposit.depositor.isValidEvmAddress()) {
70
+ if (chainIsEvm(deposit.originChainId) && !isValidEvmAddress(deposit.depositor)) {
71
71
  return;
72
72
  }
73
73
  const { originChainId, inputToken } = deposit;
74
- dict[originChainId] ??= {};
75
- dict[originChainId][inputToken.toBytes32()] ??= [];
76
- dict[originChainId][inputToken.toBytes32()].push(deposit);
74
+ if (!dict?.[originChainId]?.[inputToken]) {
75
+ assign(dict, [originChainId, inputToken], []);
76
+ }
77
+ dict[originChainId][inputToken].push(deposit);
77
78
  }
78
79
 
79
80
  function updateBundleDepositsV3(dict: BundleDepositsV3, deposit: V3DepositWithBlock): void {
80
81
  const { originChainId, inputToken } = deposit;
81
- dict[originChainId] ??= {};
82
- dict[originChainId][inputToken.toBytes32()] ??= [];
83
- dict[originChainId][inputToken.toBytes32()].push(deposit);
82
+ if (!dict?.[originChainId]?.[inputToken]) {
83
+ assign(dict, [originChainId, inputToken], []);
84
+ }
85
+ dict[originChainId][inputToken].push(deposit);
84
86
  }
85
87
 
86
88
  function updateBundleFillsV3(
@@ -88,28 +90,29 @@ function updateBundleFillsV3(
88
90
  fill: V3FillWithBlock,
89
91
  lpFeePct: BigNumber,
90
92
  repaymentChainId: number,
91
- repaymentToken: Address,
92
- repaymentAddress: Address
93
+ repaymentToken: string,
94
+ repaymentAddress: string
93
95
  ): void {
94
96
  // We shouldn't pass any unrepayable fills into this function, so we perform an extra safety check.
95
- if (chainIsEvm(repaymentChainId) && !fill.relayer.isValidEvmAddress()) {
97
+ if (chainIsEvm(repaymentChainId) && !isValidEvmAddress(fill.relayer)) {
96
98
  return;
97
99
  }
98
- dict[repaymentChainId] ??= {};
99
- dict[repaymentChainId][repaymentToken.toBytes32()] ??= {
100
- fills: [],
101
- totalRefundAmount: bnZero,
102
- realizedLpFees: bnZero,
103
- refunds: {},
104
- };
100
+ if (!dict?.[repaymentChainId]?.[repaymentToken]) {
101
+ assign(dict, [repaymentChainId, repaymentToken], {
102
+ fills: [],
103
+ totalRefundAmount: bnZero,
104
+ realizedLpFees: bnZero,
105
+ refunds: {},
106
+ });
107
+ }
105
108
 
106
109
  const bundleFill: BundleFillV3 = { ...fill, lpFeePct, relayer: repaymentAddress };
107
110
 
108
111
  // Add all fills, slow and fast, to dictionary.
109
- assign(dict, [repaymentChainId, repaymentToken.toBytes32(), "fills"], [bundleFill]);
112
+ assign(dict, [repaymentChainId, repaymentToken, "fills"], [bundleFill]);
110
113
 
111
114
  // All fills update the bundle LP fees.
112
- const refundObj = dict[repaymentChainId][repaymentToken.toBytes32()];
115
+ const refundObj = dict[repaymentChainId][repaymentToken];
113
116
  const realizedLpFee = bundleFill.inputAmount.mul(bundleFill.lpFeePct).div(fixedPointAdjustment);
114
117
  refundObj.realizedLpFees = refundObj.realizedLpFees ? refundObj.realizedLpFees.add(realizedLpFee) : realizedLpFee;
115
118
 
@@ -123,11 +126,10 @@ function updateBundleFillsV3(
123
126
  // Instantiate dictionary if it doesn't exist.
124
127
  refundObj.refunds ??= {};
125
128
 
126
- if (refundObj.refunds[bundleFill.relayer.toBytes32()]) {
127
- refundObj.refunds[bundleFill.relayer.toBytes32()] =
128
- refundObj.refunds[bundleFill.relayer.toBytes32()].add(refundAmount);
129
+ if (refundObj.refunds[bundleFill.relayer]) {
130
+ refundObj.refunds[bundleFill.relayer] = refundObj.refunds[bundleFill.relayer].add(refundAmount);
129
131
  } else {
130
- refundObj.refunds[bundleFill.relayer.toBytes32()] = refundAmount;
132
+ refundObj.refunds[bundleFill.relayer] = refundAmount;
131
133
  }
132
134
  }
133
135
  }
@@ -137,19 +139,21 @@ function updateBundleExcessSlowFills(
137
139
  deposit: V3DepositWithBlock & { lpFeePct: BigNumber }
138
140
  ): void {
139
141
  const { destinationChainId, outputToken } = deposit;
140
- dict[destinationChainId] ??= {};
141
- dict[destinationChainId][outputToken.toBytes32()] ??= [];
142
- dict[destinationChainId][outputToken.toBytes32()].push(deposit);
142
+ if (!dict?.[destinationChainId]?.[outputToken]) {
143
+ assign(dict, [destinationChainId, outputToken], []);
144
+ }
145
+ dict[destinationChainId][outputToken].push(deposit);
143
146
  }
144
147
 
145
148
  function updateBundleSlowFills(dict: BundleSlowFills, deposit: V3DepositWithBlock & { lpFeePct: BigNumber }): void {
146
- if (chainIsEvm(deposit.destinationChainId) && !deposit.recipient.isValidEvmAddress()) {
149
+ if (chainIsEvm(deposit.destinationChainId) && !isValidEvmAddress(deposit.recipient)) {
147
150
  return;
148
151
  }
149
152
  const { destinationChainId, outputToken } = deposit;
150
- dict[destinationChainId] ??= {};
151
- dict[destinationChainId][outputToken.toBytes32()] ??= [];
152
- dict[destinationChainId][outputToken.toBytes32()].push(deposit);
153
+ if (!dict?.[destinationChainId]?.[outputToken]) {
154
+ assign(dict, [destinationChainId, outputToken], []);
155
+ }
156
+ dict[destinationChainId][outputToken].push(deposit);
153
157
  }
154
158
 
155
159
  // @notice Shared client for computing data needed to construct or validate a bundle.
@@ -485,23 +489,21 @@ export class BundleDataClient {
485
489
  // worst from the relayer's perspective.
486
490
  const { relayer, inputAmount: refundAmount } = fill;
487
491
  refundsForChain[chainToSendRefundTo] ??= {};
488
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()] ??= {};
489
- const existingRefundAmount =
490
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()][relayer.toBytes32()] ?? bnZero;
491
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()][relayer.toBytes32()] =
492
- existingRefundAmount.add(refundAmount);
492
+ refundsForChain[chainToSendRefundTo][repaymentToken] ??= {};
493
+ const existingRefundAmount = refundsForChain[chainToSendRefundTo][repaymentToken][relayer] ?? bnZero;
494
+ refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
493
495
  });
494
496
  }
495
497
  return refundsForChain;
496
498
  }
497
499
 
498
- getUpcomingDepositAmount(chainId: number, l2Token: Address, latestBlockToSearch: number): BigNumber {
500
+ getUpcomingDepositAmount(chainId: number, l2Token: string, latestBlockToSearch: number): BigNumber {
499
501
  if (this.spokePoolClients[chainId] === undefined) {
500
502
  return toBN(0);
501
503
  }
502
504
  return this.spokePoolClients[chainId]
503
505
  .getDeposits()
504
- .filter((deposit) => deposit.blockNumber > latestBlockToSearch && deposit.inputToken.eq(l2Token))
506
+ .filter((deposit) => deposit.blockNumber > latestBlockToSearch && deposit.inputToken === l2Token)
505
507
  .reduce((acc, deposit) => {
506
508
  return acc.add(deposit.inputAmount);
507
509
  }, toBN(0));
@@ -624,18 +626,18 @@ export class BundleDataClient {
624
626
  const executedRefunds: { [tokenAddress: string]: { [relayer: string]: BigNumber } } = {};
625
627
  for (const refundLeaf of executedRefundLeaves) {
626
628
  const tokenAddress = refundLeaf.l2TokenAddress;
627
- if (executedRefunds[tokenAddress.toBytes32()] === undefined) {
628
- executedRefunds[tokenAddress.toBytes32()] = {};
629
+ if (executedRefunds[tokenAddress] === undefined) {
630
+ executedRefunds[tokenAddress] = {};
629
631
  }
630
- const executedTokenRefunds = executedRefunds[tokenAddress.toBytes32()];
632
+ const executedTokenRefunds = executedRefunds[tokenAddress];
631
633
 
632
634
  for (let i = 0; i < refundLeaf.refundAddresses.length; i++) {
633
635
  const relayer = refundLeaf.refundAddresses[i];
634
636
  const refundAmount = refundLeaf.refundAmounts[i];
635
- if (executedTokenRefunds[relayer.toBytes32()] === undefined) {
636
- executedTokenRefunds[relayer.toBytes32()] = bnZero;
637
+ if (executedTokenRefunds[relayer] === undefined) {
638
+ executedTokenRefunds[relayer] = bnZero;
637
639
  }
638
- executedTokenRefunds[relayer.toBytes32()] = executedTokenRefunds[relayer.toBytes32()].add(refundAmount);
640
+ executedTokenRefunds[relayer] = executedTokenRefunds[relayer].add(refundAmount);
639
641
  }
640
642
  }
641
643
  return executedRefunds;
@@ -676,15 +678,15 @@ export class BundleDataClient {
676
678
  return allRefunds;
677
679
  }
678
680
 
679
- getRefundsFor(bundleRefunds: CombinedRefunds, relayer: Address, chainId: number, token: Address): BigNumber {
680
- if (!bundleRefunds[chainId] || !bundleRefunds[chainId][token.toBytes32()]) {
681
+ getRefundsFor(bundleRefunds: CombinedRefunds, relayer: string, chainId: number, token: string): BigNumber {
682
+ if (!bundleRefunds[chainId] || !bundleRefunds[chainId][token]) {
681
683
  return BigNumber.from(0);
682
684
  }
683
- const allRefunds = bundleRefunds[chainId][token.toBytes32()];
684
- return allRefunds && allRefunds[relayer.toBytes32()] ? allRefunds[relayer.toBytes32()] : BigNumber.from(0);
685
+ const allRefunds = bundleRefunds[chainId][token];
686
+ return allRefunds && allRefunds[relayer] ? allRefunds[relayer] : BigNumber.from(0);
685
687
  }
686
688
 
687
- getTotalRefund(refunds: CombinedRefunds[], relayer: Address, chainId: number, refundToken: Address): BigNumber {
689
+ getTotalRefund(refunds: CombinedRefunds[], relayer: string, chainId: number, refundToken: string): BigNumber {
688
690
  return refunds.reduce((totalRefund, refunds) => {
689
691
  return totalRefund.add(this.getRefundsFor(refunds, relayer, chainId, refundToken));
690
692
  }, bnZero);
@@ -897,11 +899,7 @@ export class BundleDataClient {
897
899
  "Not using correct bundle deposit hash key"
898
900
  );
899
901
  if (deposit.blockNumber >= originChainBlockRange[0]) {
900
- if (
901
- bundleDepositsV3?.[originChainId]?.[deposit.inputToken.toBytes32()]?.find((d) =>
902
- duplicateEvent(deposit, d)
903
- )
904
- ) {
902
+ if (bundleDepositsV3?.[originChainId]?.[deposit.inputToken]?.find((d) => duplicateEvent(deposit, d))) {
905
903
  this.logger.debug({
906
904
  at: "BundleDataClient#loadData",
907
905
  message: "Duplicate deposit detected",
@@ -17,7 +17,6 @@ import {
17
17
  fixedPointAdjustment,
18
18
  count2DDictionaryValues,
19
19
  count3DDictionaryValues,
20
- toAddressType,
21
20
  } from "../../../utils";
22
21
  import {
23
22
  addLastRunningBalance,
@@ -66,10 +65,10 @@ export function getRefundsFromBundle(
66
65
  Object.entries(depositsForChain).forEach(([l2TokenAddress, deposits]) => {
67
66
  deposits.forEach((deposit) => {
68
67
  if (combinedRefunds[originChainId][l2TokenAddress] === undefined) {
69
- combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor.toBytes32()]: deposit.inputAmount };
68
+ combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor]: deposit.inputAmount };
70
69
  } else {
71
- const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor.toBytes32()];
72
- combinedRefunds[originChainId][l2TokenAddress][deposit.depositor.toBytes32()] = deposit.inputAmount.add(
70
+ const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor];
71
+ combinedRefunds[originChainId][l2TokenAddress][deposit.depositor] = deposit.inputAmount.add(
73
72
  existingRefundAmount ?? bnZero
74
73
  );
75
74
  }
@@ -154,23 +153,19 @@ export function _buildPoolRebalanceRoot(
154
153
  // If the repayment token and repayment chain ID do not map to a PoolRebalanceRoute graph, then
155
154
  // there are no relevant L1 running balances.
156
155
  if (
157
- !clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(
158
- toAddressType(l2TokenAddress, repaymentChainId),
159
- repaymentChainId,
160
- mainnetBundleEndBlock
161
- )
156
+ !clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(l2TokenAddress, repaymentChainId, mainnetBundleEndBlock)
162
157
  ) {
163
158
  chainWithRefundsOnly.add(repaymentChainId);
164
159
  return;
165
160
  }
166
161
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
167
- toAddressType(l2TokenAddress, repaymentChainId),
162
+ l2TokenAddress,
168
163
  repaymentChainId,
169
164
  mainnetBundleEndBlock
170
165
  );
171
166
 
172
- updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart.toEvmAddress(), totalRefundAmount);
173
- updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart.toEvmAddress(), totalRealizedLpFee);
167
+ updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart, totalRefundAmount);
168
+ updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart, totalRealizedLpFee);
174
169
  }
175
170
  );
176
171
  });
@@ -187,17 +182,12 @@ export function _buildPoolRebalanceRoot(
187
182
  Object.entries(depositsForChain).forEach(([outputToken, deposits]) => {
188
183
  deposits.forEach((deposit) => {
189
184
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
190
- toAddressType(outputToken, destinationChainId),
185
+ outputToken,
191
186
  destinationChainId,
192
187
  mainnetBundleEndBlock
193
188
  );
194
189
  const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
195
- updateRunningBalance(
196
- runningBalances,
197
- destinationChainId,
198
- l1TokenCounterpart.toEvmAddress(),
199
- deposit.inputAmount.sub(lpFee)
200
- );
190
+ updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, deposit.inputAmount.sub(lpFee));
201
191
  // Slow fill LP fees are accounted for when the slow fill executes and a V3FilledRelay is emitted. i.e. when
202
192
  // the slow fill execution is included in bundleFillsV3.
203
193
  });
@@ -216,17 +206,12 @@ export function _buildPoolRebalanceRoot(
216
206
  Object.entries(slowFilledDepositsForChain).forEach(([outputToken, slowFilledDeposits]) => {
217
207
  slowFilledDeposits.forEach((deposit) => {
218
208
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
219
- toAddressType(outputToken, destinationChainId),
209
+ outputToken,
220
210
  destinationChainId,
221
211
  mainnetBundleEndBlock
222
212
  );
223
213
  const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
224
- updateRunningBalance(
225
- runningBalances,
226
- destinationChainId,
227
- l1TokenCounterpart.toEvmAddress(),
228
- lpFee.sub(deposit.inputAmount)
229
- );
214
+ updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, lpFee.sub(deposit.inputAmount));
230
215
  // Slow fills don't add to lpFees, only when the slow fill is executed and a V3FilledRelay is emitted, so
231
216
  // we don't need to subtract it here. Moreover, the HubPoole expects bundleLpFees to be > 0.
232
217
  });
@@ -286,11 +271,11 @@ export function _buildPoolRebalanceRoot(
286
271
  return;
287
272
  }
288
273
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
289
- toAddressType(inputToken, originChainId),
274
+ inputToken,
290
275
  originChainId,
291
276
  mainnetBundleEndBlock
292
277
  );
293
- updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart.toEvmAddress(), deposit.inputAmount);
278
+ updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart, deposit.inputAmount);
294
279
  });
295
280
  });
296
281
  });
@@ -2,7 +2,7 @@ import _ from "lodash";
2
2
  import assert from "assert";
3
3
  import { providers } from "ethers";
4
4
  import { DepositWithBlock, Fill, FillWithBlock } from "../../../interfaces";
5
- import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm, Address, toAddressType } from "../../../utils";
5
+ import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm } from "../../../utils";
6
6
  import { HubPoolClient } from "../../HubPoolClient";
7
7
  import { SVMProvider } from "../../../arch/svm";
8
8
 
@@ -25,7 +25,7 @@ export function getRefundInformationFromFill(
25
25
  bundleEndBlockForMainnet: number
26
26
  ): {
27
27
  chainToSendRefundTo: number;
28
- repaymentToken: Address;
28
+ repaymentToken: string;
29
29
  } {
30
30
  const chainToSendRefundTo = _getRepaymentChainId(relayData, hubPoolClient, bundleEndBlockForMainnet);
31
31
  if (chainToSendRefundTo === relayData.originChainId) {
@@ -49,7 +49,6 @@ export function getRefundInformationFromFill(
49
49
  chainToSendRefundTo,
50
50
  bundleEndBlockForMainnet
51
51
  );
52
-
53
52
  return {
54
53
  chainToSendRefundTo,
55
54
  repaymentToken,
@@ -126,8 +125,7 @@ export async function verifyFillRepayment(
126
125
  return undefined;
127
126
  }
128
127
  }
129
- fill.relayer = toAddressType(destinationRelayer);
130
- assert(fill.relayer.isValidEvmAddress(), `Cannot re-assign fill to msg.sender: ${destinationRelayer}`);
128
+ fill.relayer = destinationRelayer;
131
129
  } else {
132
130
  return undefined;
133
131
  }
@@ -202,5 +200,5 @@ function _repaymentAddressNeedsToBeOverwritten(fill: Fill): boolean {
202
200
  // - i.e. If chainIsSvm && !isValidSvmAddress(fill.relayer) then return false
203
201
  // If chainIsEvm && !isValidEvmAddress(fill.relayer) then return false
204
202
  // If chainIsEvm && isValidEvmAddress(fill.relayer) then return true
205
- return chainIsEvm(fill.repaymentChainId) && !fill.relayer.isValidEvmAddress();
203
+ return !isValidEvmAddress(fill.relayer);
206
204
  }
@@ -21,12 +21,6 @@ export function buildPoolRebalanceLeafTree(poolRebalanceLeaves: PoolRebalanceLea
21
21
  }
22
22
 
23
23
  const paramType = getParamType("MerkleLibTest", "verifyPoolRebalance", "rebalance");
24
- const hashFn = (input: PoolRebalanceLeaf) => {
25
- const ethersLeaf = {
26
- ...input,
27
- l1Tokens: input.l1Tokens.map((l1Token) => l1Token.toEvmAddress()),
28
- };
29
- return utils.keccak256(utils.defaultAbiCoder.encode([paramType], [ethersLeaf]));
30
- };
24
+ const hashFn = (input: PoolRebalanceLeaf) => utils.keccak256(utils.defaultAbiCoder.encode([paramType], [input]));
31
25
  return new MerkleTree<PoolRebalanceLeaf>(poolRebalanceLeaves, hashFn);
32
26
  }