@across-protocol/sdk 4.2.16-alpha.0 → 4.2.16-alpha.3

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 (211) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +6 -2
  2. package/dist/cjs/arch/evm/SpokeUtils.js +21 -6
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +9 -5
  5. package/dist/cjs/arch/svm/SpokeUtils.js +70 -71
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/svm/utils.d.ts +3 -5
  8. package/dist/cjs/arch/svm/utils.js +20 -28
  9. package/dist/cjs/arch/svm/utils.js.map +1 -1
  10. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  12. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  13. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  14. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
  15. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  16. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  17. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
  20. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  21. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  22. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  23. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  24. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  25. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  26. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +11 -8
  27. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  28. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  29. package/dist/cjs/clients/HubPoolClient.js +83 -58
  30. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  31. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  32. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  34. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +64 -45
  35. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  36. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
  38. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  40. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
  41. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  42. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  43. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +3 -4
  44. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  45. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
  46. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  47. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  48. package/dist/cjs/interfaces/HubPool.d.ts +19 -14
  49. package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
  50. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  51. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -10
  52. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  53. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +5 -5
  54. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +42 -49
  55. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  56. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  57. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
  58. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  59. package/dist/cjs/utils/AddressUtils.d.ts +12 -13
  60. package/dist/cjs/utils/AddressUtils.js +44 -46
  61. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  62. package/dist/cjs/utils/EventUtils.js +1 -1
  63. package/dist/cjs/utils/EventUtils.js.map +1 -1
  64. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  65. package/dist/cjs/utils/SpokeUtils.js +4 -22
  66. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  67. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  68. package/dist/cjs/utils/TokenUtils.js +4 -6
  69. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  70. package/dist/esm/arch/evm/SpokeUtils.d.ts +6 -2
  71. package/dist/esm/arch/evm/SpokeUtils.js +22 -7
  72. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  73. package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -5
  74. package/dist/esm/arch/svm/SpokeUtils.js +74 -75
  75. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  76. package/dist/esm/arch/svm/utils.d.ts +6 -8
  77. package/dist/esm/arch/svm/utils.js +21 -27
  78. package/dist/esm/arch/svm/utils.js.map +1 -1
  79. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  80. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  81. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  82. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  83. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  84. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  85. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  86. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  88. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +5 -3
  89. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  90. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  91. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  92. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  93. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  94. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  95. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
  96. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  97. package/dist/esm/clients/HubPoolClient.d.ts +23 -22
  98. package/dist/esm/clients/HubPoolClient.js +97 -63
  99. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  100. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  101. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  102. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  103. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +67 -47
  104. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  105. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  106. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  107. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  108. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  109. package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
  110. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  111. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  112. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +4 -5
  113. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  114. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
  115. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  116. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  117. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  118. package/dist/esm/interfaces/SpokePool.d.ts +13 -13
  119. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  120. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +11 -11
  121. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  122. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
  123. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +44 -51
  124. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  125. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  126. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
  127. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  128. package/dist/esm/utils/AddressUtils.d.ts +13 -14
  129. package/dist/esm/utils/AddressUtils.js +50 -56
  130. package/dist/esm/utils/AddressUtils.js.map +1 -1
  131. package/dist/esm/utils/EventUtils.js +2 -2
  132. package/dist/esm/utils/EventUtils.js.map +1 -1
  133. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  134. package/dist/esm/utils/SpokeUtils.js +4 -26
  135. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  136. package/dist/esm/utils/TokenUtils.d.ts +4 -16
  137. package/dist/esm/utils/TokenUtils.js +5 -7
  138. package/dist/esm/utils/TokenUtils.js.map +1 -1
  139. package/dist/types/arch/evm/SpokeUtils.d.ts +6 -2
  140. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  141. package/dist/types/arch/svm/SpokeUtils.d.ts +9 -5
  142. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  143. package/dist/types/arch/svm/utils.d.ts +6 -8
  144. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  145. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  146. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  147. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  148. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  149. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  150. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  151. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  152. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  153. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  154. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  155. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  156. package/dist/types/clients/HubPoolClient.d.ts +23 -22
  157. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  158. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  159. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  160. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  161. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  162. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  163. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  164. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  165. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  166. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  167. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
  168. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  169. package/dist/types/interfaces/HubPool.d.ts +19 -14
  170. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  171. package/dist/types/interfaces/SpokePool.d.ts +13 -13
  172. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  173. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  174. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  175. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
  176. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  177. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  178. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  179. package/dist/types/utils/AddressUtils.d.ts +13 -14
  180. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  181. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  182. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  183. package/dist/types/utils/TokenUtils.d.ts +4 -16
  184. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  185. package/package.json +2 -3
  186. package/src/arch/evm/SpokeUtils.ts +52 -12
  187. package/src/arch/svm/SpokeUtils.ts +108 -59
  188. package/src/arch/svm/utils.ts +11 -20
  189. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  190. package/src/clients/BundleDataClient/BundleDataClient.ts +57 -53
  191. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  192. package/src/clients/BundleDataClient/utils/FillUtils.ts +10 -4
  193. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  194. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  195. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
  196. package/src/clients/HubPoolClient.ts +126 -82
  197. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
  198. package/src/clients/SpokePoolClient/SpokePoolClient.ts +118 -35
  199. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  200. package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
  201. package/src/clients/mocks/MockSvmCpiEventsClient.ts +3 -5
  202. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  203. package/src/interfaces/HubPool.ts +23 -14
  204. package/src/interfaces/SpokePool.ts +13 -13
  205. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +14 -12
  206. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +42 -46
  207. package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
  208. package/src/utils/AddressUtils.ts +58 -60
  209. package/src/utils/EventUtils.ts +2 -2
  210. package/src/utils/SpokeUtils.ts +11 -33
  211. package/src/utils/TokenUtils.ts +10 -11
@@ -2,7 +2,7 @@ import assert from "assert";
2
2
  import { Contract, EventFilter } from "ethers";
3
3
  import _ from "lodash";
4
4
  import winston from "winston";
5
- import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP, ZERO_ADDRESS } from "../constants";
5
+ import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP } from "../constants";
6
6
  import {
7
7
  CachingMechanismInterface,
8
8
  CancelledRootBundle,
@@ -12,7 +12,7 @@ import {
12
12
  DestinationTokenWithBlock,
13
13
  DisputedRootBundle,
14
14
  ExecutedRootBundle,
15
- L1Token,
15
+ TokenInfo,
16
16
  Log,
17
17
  LpToken,
18
18
  PendingRootBundle,
@@ -20,6 +20,7 @@ import {
20
20
  RealizedLpFee,
21
21
  SetPoolRebalanceRoot,
22
22
  TokenRunningBalance,
23
+ L1TokenInfo,
23
24
  } from "../interfaces";
24
25
  import * as lpFeeCalculator from "../lpFeeCalculator";
25
26
  import { EVMBlockFinder } from "../arch/evm";
@@ -43,10 +44,12 @@ import {
43
44
  toBN,
44
45
  getTokenInfo,
45
46
  getUsdcSymbol,
46
- compareAddressesSimple,
47
47
  chainIsSvm,
48
48
  getDeployedAddress,
49
49
  SvmAddress,
50
+ EvmAddress,
51
+ Address,
52
+ toAddressType,
50
53
  } from "../utils";
51
54
  import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
52
55
  import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
@@ -84,7 +87,8 @@ export type LpFeeRequest = Pick<Deposit, "originChainId" | "inputToken" | "input
84
87
  export class HubPoolClient extends BaseAbstractClient {
85
88
  // L1Token -> destinationChainId -> destinationToken
86
89
  protected l1TokensToDestinationTokens: L1TokensToDestinationTokens = {};
87
- protected l1Tokens: L1Token[] = []; // L1Tokens and their associated info.
90
+ protected l1Tokens: L1TokenInfo[] = []; // L1Tokens and their associated info.
91
+ // @dev `token` here is a 20-byte hex sting
88
92
  protected lpTokens: { [token: string]: LpToken } = {};
89
93
  protected proposedRootBundles: ProposedRootBundle[] = [];
90
94
  protected canceledRootBundles: CancelledRootBundle[] = [];
@@ -92,6 +96,7 @@ export class HubPoolClient extends BaseAbstractClient {
92
96
  protected executedRootBundles: ExecutedRootBundle[] = [];
93
97
  protected crossChainContracts: { [l2ChainId: number]: CrossChainContractsSet[] } = {};
94
98
  protected l1TokensToDestinationTokensWithBlock: {
99
+ // @dev `l1Token` here is a 20-byte hex sting
95
100
  [l1Token: string]: { [destinationChainId: number]: DestinationTokenWithBlock[] };
96
101
  } = {};
97
102
  protected pendingRootBundle: PendingRootBundle | undefined;
@@ -160,7 +165,7 @@ export class HubPoolClient extends BaseAbstractClient {
160
165
  return this.executedRootBundles;
161
166
  }
162
167
 
163
- getSpokePoolForBlock(chain: number, block: number = Number.MAX_SAFE_INTEGER): string {
168
+ getSpokePoolForBlock(chain: number, block: number = Number.MAX_SAFE_INTEGER): Address {
164
169
  if (!this.crossChainContracts[chain]) {
165
170
  throw new Error(`No cross chain contracts set for ${chain}`);
166
171
  }
@@ -174,33 +179,33 @@ export class HubPoolClient extends BaseAbstractClient {
174
179
  }
175
180
  }
176
181
 
177
- getSpokePoolActivationBlock(chain: number, spokePool: string): number | undefined {
182
+ getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined {
178
183
  // Return first time that this spoke pool was registered in the HubPool as a cross chain contract. We can use
179
184
  // this block as the oldest block that we should query for SpokePoolClient purposes.
180
- const mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(
181
- (crossChainContract) => crossChainContract.spokePool === spokePool
185
+ const mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find((crossChainContract) =>
186
+ crossChainContract.spokePool.eq(spokePool)
182
187
  );
183
188
  return mostRecentSpokePoolUpdateBeforeBlock?.blockNumber;
184
189
  }
185
190
 
186
191
  // Returns the latest L2 token to use for an L1 token as of the input hub block.
187
192
  getL2TokenForL1TokenAtBlock(
188
- l1Token: string,
193
+ l1Token: EvmAddress,
189
194
  destinationChainId: number,
190
195
  latestHubBlock = Number.MAX_SAFE_INTEGER
191
- ): string {
192
- if (!this.l1TokensToDestinationTokensWithBlock?.[l1Token]?.[destinationChainId]) {
196
+ ): Address {
197
+ if (!this.l1TokensToDestinationTokensWithBlock?.[l1Token.toEvmAddress()]?.[destinationChainId]) {
193
198
  const chain = getNetworkName(destinationChainId);
194
- const { symbol } = this.l1Tokens.find(({ address }) => address === l1Token) ?? { symbol: l1Token };
199
+ const { symbol } = this.l1Tokens.find(({ address }) => address.eq(l1Token)) ?? { symbol: l1Token.toString() };
195
200
  throw new Error(`Could not find SpokePool mapping for ${symbol} on ${chain} and L1 token ${l1Token}`);
196
201
  }
197
202
  // Find the last mapping published before the target block.
198
203
  const l2Token: DestinationTokenWithBlock | undefined = sortEventsDescending(
199
- this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId]
204
+ this.l1TokensToDestinationTokensWithBlock[l1Token.toEvmAddress()][destinationChainId]
200
205
  ).find((mapping: DestinationTokenWithBlock) => mapping.blockNumber <= latestHubBlock);
201
206
  if (!l2Token) {
202
207
  const chain = getNetworkName(destinationChainId);
203
- const { symbol } = this.l1Tokens.find(({ address }) => address === l1Token) ?? { symbol: l1Token };
208
+ const { symbol } = this.l1Tokens.find(({ address }) => address.eq(l1Token)) ?? { symbol: l1Token.toString() };
204
209
  throw new Error(
205
210
  `Could not find SpokePool mapping for ${symbol} on ${chain} at or before HubPool block ${latestHubBlock}!`
206
211
  );
@@ -208,18 +213,23 @@ export class HubPoolClient extends BaseAbstractClient {
208
213
  return l2Token.l2Token;
209
214
  }
210
215
 
216
+ // TODO: this might have to deal with truncated Solana addresses? Depends on what input is given actually
217
+ // TODO: might craete `getL1TokenForL2EVMTokenAtBlock` and some other fn
211
218
  // Returns the latest L1 token to use for an L2 token as of the input hub block.
212
219
  getL1TokenForL2TokenAtBlock(
213
- l2Token: string,
220
+ l2Token: Address, // ! TODO: assuming that for Svm token, we'll have a proper full SvmAddress in this var
214
221
  destinationChainId: number,
215
222
  latestHubBlock = Number.MAX_SAFE_INTEGER
216
- ): string {
223
+ ): EvmAddress {
217
224
  const l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
218
- .filter((l1Token) => this.l2TokenEnabledForL1Token(l1Token, destinationChainId))
225
+ .filter((l1Token) => this.l2TokenEnabledForL1Token(EvmAddress.from(l1Token), destinationChainId))
219
226
  .map((l1Token) => {
220
227
  // Return all matching L2 token mappings that are equal to or earlier than the target block.
221
228
  return this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(
222
- (mapping) => mapping.l2Token === l2Token && mapping.blockNumber <= latestHubBlock
229
+ // ! TODO: Okay. Here, in `l1TokensToDestinationTokensWithBlock`, we might be saving truncated solana addresses (as `l1TokensToDestinationTokensWithBlock` is probably generated from events)
230
+ // ! TODO: Considering this, this filtering should be a bit different. If .isSvmAddress => check not for equality, but for *truncated equality*. If .isEvmAddress, check for equality
231
+ (dstTokenWithBlock) =>
232
+ dstTokenWithBlock.l2Token.eq(l2Token) && dstTokenWithBlock.blockNumber <= latestHubBlock
223
233
  );
224
234
  })
225
235
  .flat();
@@ -235,32 +245,33 @@ export class HubPoolClient extends BaseAbstractClient {
235
245
 
236
246
  protected getL1TokenForDeposit(
237
247
  deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">
238
- ): string {
248
+ ): EvmAddress {
239
249
  // L1-->L2 token mappings are set via PoolRebalanceRoutes which occur on mainnet,
240
250
  // so we use the latest token mapping. This way if a very old deposit is filled, the relayer can use the
241
251
  // latest L2 token mapping to find the L1 token counterpart.
242
252
  return this.getL1TokenForL2TokenAtBlock(deposit.inputToken, deposit.originChainId, deposit.quoteBlockNumber);
243
253
  }
244
254
 
245
- l2TokenEnabledForL1Token(l1Token: string, destinationChainId: number): boolean {
246
- return this.l1TokensToDestinationTokens?.[l1Token]?.[destinationChainId] != undefined;
255
+ l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean {
256
+ return this.l1TokensToDestinationTokens?.[l1Token.toEvmAddress()]?.[destinationChainId] != undefined;
247
257
  }
248
258
 
249
- l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean {
259
+ l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean {
250
260
  // Find the last mapping published before the target block.
251
261
  const l2Token: DestinationTokenWithBlock | undefined = sortEventsDescending(
252
- this.l1TokensToDestinationTokensWithBlock?.[l1Token]?.[destinationChainId] ?? []
262
+ this.l1TokensToDestinationTokensWithBlock?.[l1Token.toEvmAddress()]?.[destinationChainId] ?? []
253
263
  ).find((mapping: DestinationTokenWithBlock) => mapping.blockNumber <= hubBlockNumber);
254
264
  return l2Token !== undefined;
255
265
  }
256
266
 
257
- l2TokenHasPoolRebalanceRoute(l2Token: string, l2ChainId: number, hubPoolBlock = this.latestHeightSearched): boolean {
267
+ l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock = this.latestHeightSearched): boolean {
258
268
  return Object.values(this.l1TokensToDestinationTokensWithBlock).some((destinationTokenMapping) => {
259
269
  return Object.entries(destinationTokenMapping).some(([_l2ChainId, setPoolRebalanceRouteEvents]) => {
260
270
  return setPoolRebalanceRouteEvents.some((e) => {
261
271
  return (
262
272
  e.blockNumber <= hubPoolBlock &&
263
- compareAddressesSimple(e.l2Token, l2Token) &&
273
+ // TODO: compare the last 20 bytes of l2Token only. Solana workaround, is this correct?
274
+ e.l2Token.eq(l2Token) &&
264
275
  Number(_l2ChainId) === l2ChainId
265
276
  );
266
277
  });
@@ -271,15 +282,16 @@ export class HubPoolClient extends BaseAbstractClient {
271
282
  /**
272
283
  * @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
273
284
  * @param tokenAddress Token address on `chain`
274
- * @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
285
+ * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
275
286
  * @returns Token info for the given token address on the L2 chain including symbol and decimal.
276
287
  */
277
- getTokenInfoForAddress(tokenAddress: string, chain: number): L1Token {
278
- const tokenInfo = getTokenInfo(tokenAddress, chain);
288
+ // TODO: didn't change `tokenAddress` here to Address because of downstream getTokenInfo impl
289
+ getTokenInfoForAddress(tokenAddress: string, chainId: number): TokenInfo {
290
+ const tokenInfo = getTokenInfo(tokenAddress, chainId);
279
291
  // @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
280
292
  // entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
281
- if (tokenInfo.symbol.toLowerCase() === "usdc" && chain !== this.chainId) {
282
- tokenInfo.symbol = getUsdcSymbol(tokenAddress, chain) ?? "UNKNOWN";
293
+ if (tokenInfo.symbol.toLowerCase() === "usdc" && chainId !== this.chainId) {
294
+ tokenInfo.symbol = getUsdcSymbol(tokenAddress, chainId) ?? "UNKNOWN";
283
295
  }
284
296
  return tokenInfo;
285
297
  }
@@ -311,7 +323,7 @@ export class HubPoolClient extends BaseAbstractClient {
311
323
  return blockNumbers;
312
324
  }
313
325
 
314
- async getCurrentPoolUtilization(l1Token: string): Promise<BigNumber> {
326
+ async getCurrentPoolUtilization(l1Token: EvmAddress): Promise<BigNumber> {
315
327
  const blockNumber = this.latestHeightSearched ?? (await this.hubPool.provider.getBlockNumber());
316
328
  return await this.getUtilization(l1Token, blockNumber, bnZero, getCurrentTime(), 0);
317
329
  }
@@ -326,7 +338,7 @@ export class HubPoolClient extends BaseAbstractClient {
326
338
  * @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
327
339
  */
328
340
  protected async getUtilization(
329
- hubPoolToken: string,
341
+ hubPoolToken: EvmAddress,
330
342
  blockNumber: number,
331
343
  depositAmount: BigNumber,
332
344
  timestamp: number,
@@ -337,10 +349,14 @@ export class HubPoolClient extends BaseAbstractClient {
337
349
  const overrides = { blockTag: blockNumber };
338
350
  if (depositAmount.eq(0)) {
339
351
  // For zero amount, just get the utilisation at `blockNumber`.
340
- return await this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken, overrides);
352
+ return await this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken.toEvmAddress(), overrides);
341
353
  }
342
354
 
343
- return await this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken, depositAmount, overrides);
355
+ return await this.hubPool.callStatic.liquidityUtilizationPostRelay(
356
+ hubPoolToken.toEvmAddress(),
357
+ depositAmount,
358
+ overrides
359
+ );
344
360
  };
345
361
 
346
362
  // Resolve the cache locally so that we can appease typescript
@@ -355,8 +371,8 @@ export class HubPoolClient extends BaseAbstractClient {
355
371
  // @note Avoid collisions with pre-existing cache keys by appending an underscore (_) for post-relay utilization.
356
372
  // @fixme This can be removed once the existing keys have been ejected from the cache (i.e. 7 days).
357
373
  const key = depositAmount.eq(0)
358
- ? `utilization_${hubPoolToken}_${blockNumber}`
359
- : `utilization_${hubPoolToken}_${blockNumber}_${depositAmount.toString()}_`;
374
+ ? `utilization_${hubPoolToken.toEvmAddress()}_${blockNumber}`
375
+ : `utilization_${hubPoolToken.toEvmAddress()}_${blockNumber}_${depositAmount.toString()}_`;
360
376
  const result = await cache.get<string>(key);
361
377
  if (isDefined(result)) {
362
378
  return BigNumber.from(result);
@@ -393,14 +409,14 @@ export class HubPoolClient extends BaseAbstractClient {
393
409
 
394
410
  // Map SpokePool token addresses to HubPool token addresses.
395
411
  // Note: Should only be accessed via `getHubPoolToken()` or `getHubPoolTokens()`.
396
- const hubPoolTokens: { [k: string]: string } = {};
397
- const getHubPoolToken = (deposit: LpFeeRequest, quoteBlockNumber: number): string | undefined => {
412
+ const hubPoolTokens: { [k: string]: EvmAddress } = {};
413
+ const getHubPoolToken = (deposit: LpFeeRequest, quoteBlockNumber: number): EvmAddress | undefined => {
398
414
  const tokenKey = `${deposit.originChainId}-${deposit.inputToken}`;
399
415
  if (this.l2TokenHasPoolRebalanceRoute(deposit.inputToken, deposit.originChainId, quoteBlockNumber)) {
400
416
  return (hubPoolTokens[tokenKey] ??= this.getL1TokenForDeposit({ ...deposit, quoteBlockNumber }));
401
417
  } else return undefined;
402
418
  };
403
- const getHubPoolTokens = (): string[] => dedupArray(Object.values(hubPoolTokens).filter(isDefined));
419
+ const getHubPoolTokens = (): EvmAddress[] => dedupArray(Object.values(hubPoolTokens).filter(isDefined));
404
420
 
405
421
  // Helper to resolve the unqiue hubPoolToken & quoteTimestamp mappings.
406
422
  const resolveUniqueQuoteTimestamps = (deposit: LpFeeRequest): void => {
@@ -414,17 +430,17 @@ export class HubPoolClient extends BaseAbstractClient {
414
430
  }
415
431
 
416
432
  // Append the quoteTimestamp for this HubPool token, if it isn't already enqueued.
417
- utilizationTimestamps[hubPoolToken] ??= [];
418
- if (!utilizationTimestamps[hubPoolToken].includes(quoteTimestamp)) {
419
- utilizationTimestamps[hubPoolToken].push(quoteTimestamp);
433
+ utilizationTimestamps[hubPoolToken.toEvmAddress()] ??= [];
434
+ if (!utilizationTimestamps[hubPoolToken.toEvmAddress()].includes(quoteTimestamp)) {
435
+ utilizationTimestamps[hubPoolToken.toEvmAddress()].push(quoteTimestamp);
420
436
  }
421
437
  };
422
438
 
423
439
  // Helper to resolve existing HubPool token utilisation for an array of unique block numbers.
424
440
  // Produces a mapping of blockNumber -> utilization for a specific token.
425
- const resolveUtilization = async (hubPoolToken: string): Promise<Record<number, BigNumber>> => {
441
+ const resolveUtilization = async (hubPoolToken: EvmAddress): Promise<Record<number, BigNumber>> => {
426
442
  return Object.fromEntries(
427
- await mapAsync(utilizationTimestamps[hubPoolToken], async (quoteTimestamp) => {
443
+ await mapAsync(utilizationTimestamps[hubPoolToken.toEvmAddress()], async (quoteTimestamp) => {
428
444
  const blockNumber = quoteBlocks[quoteTimestamp];
429
445
  const utilization = await this.getUtilization(
430
446
  hubPoolToken,
@@ -460,7 +476,7 @@ export class HubPoolClient extends BaseAbstractClient {
460
476
  quoteBlock
461
477
  );
462
478
 
463
- const preUtilization = utilization[hubPoolToken][quoteBlock];
479
+ const preUtilization = utilization[hubPoolToken.toEvmAddress()][quoteBlock];
464
480
  const postUtilization = await this.getUtilization(
465
481
  hubPoolToken,
466
482
  quoteBlock,
@@ -488,7 +504,10 @@ export class HubPoolClient extends BaseAbstractClient {
488
504
  // For each token / quoteBlock pair, resolve the utilisation for each quoted block.
489
505
  // This can be reused for each deposit with the same HubPool token and quoteTimestamp pair.
490
506
  utilization = Object.fromEntries(
491
- await mapAsync(getHubPoolTokens(), async (hubPoolToken) => [hubPoolToken, await resolveUtilization(hubPoolToken)])
507
+ await mapAsync(getHubPoolTokens(), async (hubPoolToken) => [
508
+ hubPoolToken.toEvmAddress(),
509
+ await resolveUtilization(hubPoolToken),
510
+ ])
492
511
  );
493
512
 
494
513
  // For each deposit, compute the post-relay HubPool utilisation independently.
@@ -506,22 +525,22 @@ export class HubPoolClient extends BaseAbstractClient {
506
525
  });
507
526
  }
508
527
 
509
- getL1Tokens(): L1Token[] {
528
+ getL1Tokens(): L1TokenInfo[] {
510
529
  return this.l1Tokens;
511
530
  }
512
531
 
513
- getTokenInfoForL1Token(l1Token: string): L1Token | undefined {
514
- return this.l1Tokens.find((token) => token.address === l1Token);
532
+ getTokenInfoForL1Token(l1Token: EvmAddress): L1TokenInfo | undefined {
533
+ return this.l1Tokens.find((token) => token.address.eq(l1Token));
515
534
  }
516
535
 
517
- getLpTokenInfoForL1Token(l1Token: string): LpToken | undefined {
518
- return this.lpTokens[l1Token];
536
+ getLpTokenInfoForL1Token(l1Token: EvmAddress): LpToken | undefined {
537
+ return this.lpTokens[l1Token.toEvmAddress()];
519
538
  }
520
539
 
521
540
  areTokensEquivalent(
522
- tokenA: string,
541
+ tokenA: Address,
523
542
  chainIdA: number,
524
- tokenB: string,
543
+ tokenB: Address,
525
544
  chainIdB: number,
526
545
  hubPoolBlock = this.latestHeightSearched
527
546
  ): boolean {
@@ -534,14 +553,14 @@ export class HubPoolClient extends BaseAbstractClient {
534
553
  // Resolve both SpokePool tokens back to their respective HubPool tokens and verify that they match.
535
554
  const l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
536
555
  const l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
537
- if (l1TokenA !== l1TokenB) {
556
+ if (!l1TokenA.eq(l1TokenB)) {
538
557
  return false;
539
558
  }
540
559
 
541
560
  // Resolve both HubPool tokens back to a current SpokePool token and verify that they match.
542
561
  const _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
543
562
  const _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
544
- return tokenA === _tokenA && tokenB === _tokenB;
563
+ return tokenA.eq(_tokenA) && tokenB.eq(_tokenB);
545
564
  }
546
565
 
547
566
  getSpokeActivationBlockForChain(chainId: number): number {
@@ -778,34 +797,35 @@ export class HubPoolClient extends BaseAbstractClient {
778
797
  getLatestExecutedRootBundleContainingL1Token(
779
798
  block: number,
780
799
  chain: number,
781
- l1Token: string
800
+ l1Token: EvmAddress
782
801
  ): ExecutedRootBundle | undefined {
783
802
  // Search ExecutedRootBundles in descending block order to find the most recent event before the target block.
784
803
  return sortEventsDescending(this.executedRootBundles).find((executedLeaf: ExecutedRootBundle) => {
785
804
  return (
786
805
  executedLeaf.blockNumber <= block &&
787
806
  executedLeaf.chainId === chain &&
788
- executedLeaf.l1Tokens.some((token) => token.toLowerCase() === l1Token.toLowerCase())
807
+ executedLeaf.l1Tokens.some((token) => token.eq(l1Token))
789
808
  );
790
809
  });
791
810
  }
792
811
 
793
- getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: string): TokenRunningBalance {
812
+ getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: EvmAddress): TokenRunningBalance {
794
813
  const executedRootBundle = this.getLatestExecutedRootBundleContainingL1Token(block, chain, l1Token);
795
814
 
796
815
  return this.getRunningBalanceForToken(l1Token, executedRootBundle);
797
816
  }
798
817
 
799
818
  public getRunningBalanceForToken(
800
- l1Token: string,
819
+ l1Token: EvmAddress,
801
820
  executedRootBundle: ExecutedRootBundle | undefined
802
821
  ): TokenRunningBalance {
803
822
  let runningBalance = toBN(0);
804
823
  if (executedRootBundle) {
805
- const indexOfL1Token = executedRootBundle.l1Tokens
806
- .map((l1Token) => l1Token.toLowerCase())
807
- .indexOf(l1Token.toLowerCase());
808
- runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
824
+ const indexOfL1Token = executedRootBundle.l1Tokens.findIndex((tokenInBundle) => tokenInBundle.eq(l1Token));
825
+ // TODO: not sure this if is required. Wasn't here before. Probably `getRunningBalanceForToken` is used on checked tokens only
826
+ if (indexOfL1Token !== -1) {
827
+ runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
828
+ }
809
829
  }
810
830
 
811
831
  return { runningBalance };
@@ -873,7 +893,10 @@ export class HubPoolClient extends BaseAbstractClient {
873
893
  return {
874
894
  success: true,
875
895
  currentTime,
876
- pendingRootBundleProposal,
896
+ pendingRootBundleProposal: {
897
+ ...pendingRootBundleProposal,
898
+ proposer: toAddressType(pendingRootBundleProposal.proposer, this.chainId),
899
+ },
877
900
  searchEndBlock: searchConfig.to,
878
901
  events: _events,
879
902
  };
@@ -898,9 +921,9 @@ export class HubPoolClient extends BaseAbstractClient {
898
921
 
899
922
  if (eventsToQuery.includes("CrossChainContractsSet")) {
900
923
  for (const event of events["CrossChainContractsSet"]) {
901
- const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet;
924
+ const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet & { spokePool: string };
902
925
  const dataToAdd: CrossChainContractsSet = {
903
- spokePool: args.spokePool,
926
+ spokePool: toAddressType(args.spokePool, this.chainId),
904
927
  blockNumber: args.blockNumber,
905
928
  txnRef: args.txnRef,
906
929
  logIndex: args.logIndex,
@@ -916,7 +939,8 @@ export class HubPoolClient extends BaseAbstractClient {
916
939
  if (!solanaSpokePool) {
917
940
  throw new Error(`SVM spoke pool not found for chain ${args.l2ChainId}`);
918
941
  }
919
- const truncatedAddress = SvmAddress.from(solanaSpokePool).toEvmAddress();
942
+ const svmSpoke = SvmAddress.from(solanaSpokePool);
943
+ const truncatedAddress = svmSpoke.truncateToBytes20();
920
944
  // Verify the event address matches our expected truncated address
921
945
  if (args.spokePool.toLowerCase() !== truncatedAddress.toLowerCase()) {
922
946
  throw new Error(
@@ -924,8 +948,7 @@ export class HubPoolClient extends BaseAbstractClient {
924
948
  `Expected ${truncatedAddress}, got ${args.spokePool}`
925
949
  );
926
950
  }
927
- // Store the full Solana address
928
- dataToAdd.spokePool = SvmAddress.from(solanaSpokePool).toBytes32();
951
+ dataToAdd.spokePool = svmSpoke;
929
952
  }
930
953
  assign(this.crossChainContracts, [args.l2ChainId], [dataToAdd]);
931
954
  }
@@ -933,34 +956,37 @@ export class HubPoolClient extends BaseAbstractClient {
933
956
 
934
957
  if (eventsToQuery.includes("SetPoolRebalanceRoute")) {
935
958
  for (const event of events["SetPoolRebalanceRoute"]) {
936
- const args = spreadEventWithBlockNumber(event) as SetPoolRebalanceRoot;
959
+ const args = spreadEventWithBlockNumber(event) as SetPoolRebalanceRoot & {
960
+ l1Token: string;
961
+ destinationToken: string;
962
+ };
937
963
 
938
964
  // If the destination chain is SVM, then we need to convert the destination token to the Solana address.
939
965
  // This is because the HubPool contract only holds a truncated address for the USDC token and currently
940
966
  // only supports USDC as a destination token for Solana.
941
- let destinationToken = args.destinationToken;
967
+ let destinationToken = toAddressType(args.destinationToken, this.chainId);
942
968
  if (chainIsSvm(args.destinationChainId)) {
943
969
  const usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
944
- const truncatedAddress = SvmAddress.from(usdcTokenSol).toEvmAddress();
945
- if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) {
970
+ const svmUsdc = SvmAddress.from(usdcTokenSol);
971
+ if (destinationToken.truncateToBytes20() !== svmUsdc.truncateToBytes20()) {
946
972
  throw new Error(
947
973
  `SVM USDC address mismatch for chain ${args.destinationChainId}. ` +
948
- `Expected ${truncatedAddress}, got ${destinationToken}`
974
+ `Expected ${svmUsdc.truncateToBytes20()}, got ${destinationToken}`
949
975
  );
950
976
  }
951
- destinationToken = SvmAddress.from(usdcTokenSol).toBytes32();
977
+ destinationToken = svmUsdc;
952
978
  }
953
979
 
954
980
  // If the destination token is set to the zero address in an event, then this means Across should no longer
955
981
  // rebalance to this chain.
956
- if (destinationToken !== ZERO_ADDRESS) {
982
+ if (!destinationToken.isZeroAddress()) {
957
983
  assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
958
984
  assign(
959
985
  this.l1TokensToDestinationTokensWithBlock,
960
986
  [args.l1Token, args.destinationChainId],
961
987
  [
962
988
  {
963
- l1Token: args.l1Token,
989
+ l1Token: toAddressType(args.l1Token, this.chainId),
964
990
  l2Token: destinationToken,
965
991
  blockNumber: args.blockNumber,
966
992
  txnIndex: args.txnIndex,
@@ -982,7 +1008,15 @@ export class HubPoolClient extends BaseAbstractClient {
982
1008
  );
983
1009
 
984
1010
  const [tokenInfo, lpTokenInfo] = await Promise.all([
985
- Promise.all(uniqueL1Tokens.map((l1Token: string) => fetchTokenInfo(l1Token, this.hubPool.provider))),
1011
+ Promise.all(
1012
+ uniqueL1Tokens.map(async (l1Token: string) => {
1013
+ const tokenInfo: L1TokenInfo = await fetchTokenInfo(l1Token, this.hubPool.provider);
1014
+ return {
1015
+ ...tokenInfo,
1016
+ address: EvmAddress.from(l1Token),
1017
+ };
1018
+ })
1019
+ ),
986
1020
  Promise.all(
987
1021
  uniqueL1Tokens.map(
988
1022
  async (l1Token: string) => await this.hubPool.pooledTokens(l1Token, { blockTag: update.searchEndBlock })
@@ -990,7 +1024,7 @@ export class HubPoolClient extends BaseAbstractClient {
990
1024
  ),
991
1025
  ]);
992
1026
  for (const info of tokenInfo) {
993
- if (!this.l1Tokens.find((token) => compareAddressesSimple(token.address, info.address))) {
1027
+ if (!this.l1Tokens.find((token) => token.address.eq(info.address))) {
994
1028
  if (info.decimals > 0 && info.decimals <= 18) {
995
1029
  this.l1Tokens.push(info);
996
1030
  } else {
@@ -1011,7 +1045,13 @@ export class HubPoolClient extends BaseAbstractClient {
1011
1045
  this.proposedRootBundles.push(
1012
1046
  ...events["ProposeRootBundle"]
1013
1047
  .filter((event) => !this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber))
1014
- .map((event) => spreadEventWithBlockNumber(event) as ProposedRootBundle)
1048
+ .map((_event) => {
1049
+ const args = spreadEventWithBlockNumber(_event) as ProposedRootBundle & { proposer: string };
1050
+ return {
1051
+ ...args,
1052
+ proposer: toAddressType(args.proposer, this.chainId),
1053
+ };
1054
+ })
1015
1055
  );
1016
1056
  }
1017
1057
 
@@ -1034,7 +1074,7 @@ export class HubPoolClient extends BaseAbstractClient {
1034
1074
  }
1035
1075
 
1036
1076
  // Set running balances and incentive balances for this bundle.
1037
- const executedRootBundle = spreadEventWithBlockNumber(event) as ExecutedRootBundle;
1077
+ const executedRootBundle = spreadEventWithBlockNumber(event) as ExecutedRootBundle & { l1Tokens: string[] };
1038
1078
  const { l1Tokens, runningBalances } = executedRootBundle;
1039
1079
  const nTokens = l1Tokens.length;
1040
1080
 
@@ -1046,7 +1086,11 @@ export class HubPoolClient extends BaseAbstractClient {
1046
1086
  );
1047
1087
  }
1048
1088
  executedRootBundle.runningBalances = runningBalances.slice(0, nTokens);
1049
- this.executedRootBundles.push(executedRootBundle);
1089
+ const executedRootBundleWithL1Tokens = {
1090
+ ...executedRootBundle,
1091
+ l1Tokens: executedRootBundle.l1Tokens.map(toAddressType, this.chainId),
1092
+ };
1093
+ this.executedRootBundles.push(executedRootBundleWithL1Tokens);
1050
1094
  }
1051
1095
  }
1052
1096
 
@@ -17,6 +17,7 @@ import {
17
17
  MakeOptional,
18
18
  toBN,
19
19
  EvmAddress,
20
+ toAddressType,
20
21
  } from "../../utils";
21
22
  import {
22
23
  EventSearchConfig,
@@ -194,6 +195,11 @@ export class EVMSpokePoolClient extends SpokePoolClient {
194
195
 
195
196
  deposit = {
196
197
  ...spreadEventWithBlockNumber(event),
198
+ inputToken: toAddressType(event.args.inputToken, this.chainId),
199
+ outputToken: toAddressType(event.args.outputToken, event.args.destinationChainId),
200
+ depositor: toAddressType(event.args.depositor, this.chainId),
201
+ recipient: toAddressType(event.args.recipient, event.args.destinationChainId),
202
+ exclusiveRelayer: toAddressType(event.args.exclusiveRelayer, event.args.destinationChainId),
197
203
  originChainId: this.chainId,
198
204
  quoteBlockNumber: await this.getBlockNumber(Number(event.args["quoteTimestamp"])),
199
205
  fromLiteChain: true, // To be updated immediately afterwards.