@across-protocol/contracts 3.0.18 → 3.0.19

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 (74) hide show
  1. package/README.md +2 -0
  2. package/artifacts/build-info/9cb910e5bb5dd730cd01af84a0fb0466.json +1 -0
  3. package/artifacts/contracts/Ink_SpokePool.sol/Ink_SpokePool.dbg.json +4 -0
  4. package/artifacts/contracts/Ink_SpokePool.sol/Ink_SpokePool.json +2316 -0
  5. package/contracts/Ink_SpokePool.sol +72 -0
  6. package/dist/deploy/consts.js +8 -2
  7. package/dist/deployments/deployments.json +7 -1
  8. package/dist/hardhat.config.js +17 -0
  9. package/dist/scripts/svm/addressToPublicKey.js +2 -2
  10. package/dist/scripts/svm/bridgeLiabilityToHubPool.d.ts +1 -4
  11. package/dist/scripts/svm/bridgeLiabilityToHubPool.js +5 -15
  12. package/dist/scripts/svm/closeRelayerPdas.js +3 -3
  13. package/dist/scripts/svm/executeRebalanceToHubPool.d.ts +1 -4
  14. package/dist/scripts/svm/executeRebalanceToHubPool.js +6 -16
  15. package/dist/scripts/svm/executeRebalanceToSpokePool.js +14 -27
  16. package/dist/scripts/svm/fakeFillWithRandomDistribution.js +6 -7
  17. package/dist/scripts/svm/initialize.js +2 -2
  18. package/dist/scripts/svm/proposeRebalanceToSpokePool.js +11 -15
  19. package/dist/scripts/svm/publicKeyToAddress.js +2 -2
  20. package/dist/scripts/svm/queryDeposits.js +2 -2
  21. package/dist/scripts/svm/queryFills.js +10 -11
  22. package/dist/scripts/svm/remoteHubPoolPauseDeposits.js +10 -24
  23. package/dist/scripts/svm/remoteHubPoolSetDepositRoute.js +16 -29
  24. package/dist/scripts/svm/remotePauseDeposits.js +21 -27
  25. package/dist/scripts/svm/simpleFakeRelayerRepayment.js +3 -3
  26. package/dist/scripts/svm/simpleFill.js +3 -4
  27. package/dist/scripts/svm/utils/helpers.d.ts +3 -1
  28. package/dist/scripts/svm/utils/helpers.js +13 -3
  29. package/dist/src/svm/coders.d.ts +37 -0
  30. package/dist/src/svm/coders.js +250 -0
  31. package/dist/src/svm/conversionUtils.d.ts +22 -0
  32. package/dist/src/svm/conversionUtils.js +73 -0
  33. package/dist/src/svm/index.d.ts +6 -0
  34. package/dist/src/svm/index.js +22 -0
  35. package/dist/src/svm/instructionParamsUtils.d.ts +31 -0
  36. package/dist/src/svm/instructionParamsUtils.js +128 -0
  37. package/dist/src/svm/relayHashUtils.d.ts +30 -0
  38. package/dist/src/svm/relayHashUtils.js +209 -0
  39. package/dist/src/svm/solanaProgramUtils.d.ts +38 -0
  40. package/dist/src/svm/solanaProgramUtils.js +147 -0
  41. package/dist/src/svm/transactionUtils.d.ts +8 -0
  42. package/dist/src/svm/transactionUtils.js +55 -0
  43. package/dist/src/types/svm.d.ts +118 -0
  44. package/dist/src/types/svm.js +2 -0
  45. package/dist/test/svm/MulticallHandler.js +2 -2
  46. package/dist/test/svm/SvmSpoke.Bundle.js +48 -48
  47. package/dist/test/svm/SvmSpoke.Deposit.js +13 -13
  48. package/dist/test/svm/SvmSpoke.Fill.AcrossPlus.js +15 -17
  49. package/dist/test/svm/SvmSpoke.Fill.js +29 -30
  50. package/dist/test/svm/SvmSpoke.HandleReceiveMessage.js +2 -2
  51. package/dist/test/svm/SvmSpoke.Ownership.js +6 -6
  52. package/dist/test/svm/SvmSpoke.RefundClaims.js +5 -5
  53. package/dist/test/svm/SvmSpoke.Routes.js +3 -3
  54. package/dist/test/svm/SvmSpoke.SlowFill.AcrossPlus.js +19 -20
  55. package/dist/test/svm/SvmSpoke.SlowFill.js +18 -18
  56. package/dist/test/svm/SvmSpoke.TokenBridge.js +13 -13
  57. package/dist/test/svm/SvmSpoke.common.d.ts +1 -49
  58. package/dist/test/svm/SvmSpoke.common.js +4 -4
  59. package/dist/test/svm/cctpHelpers.js +2 -2
  60. package/dist/test/svm/utils.d.ts +5 -66
  61. package/dist/test/svm/utils.js +10 -226
  62. package/dist/typechain/contracts/Ink_SpokePool.d.ts +1251 -0
  63. package/dist/typechain/contracts/Ink_SpokePool.js +2 -0
  64. package/dist/typechain/contracts/index.d.ts +1 -0
  65. package/dist/typechain/factories/contracts/Ink_SpokePool__factory.d.ts +1833 -0
  66. package/dist/typechain/factories/contracts/Ink_SpokePool__factory.js +2347 -0
  67. package/dist/typechain/factories/contracts/index.d.ts +1 -0
  68. package/dist/typechain/factories/contracts/index.js +3 -1
  69. package/dist/typechain/hardhat.d.ts +9 -0
  70. package/dist/typechain/index.d.ts +2 -0
  71. package/dist/typechain/index.js +5 -3
  72. package/package.json +2 -2
  73. package/dist/src/SvmUtils.d.ts +0 -72
  74. package/dist/src/SvmUtils.js +0 -496
@@ -0,0 +1,72 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity ^0.8.0;
3
+ import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol";
4
+
5
+ import "./Ovm_SpokePool.sol";
6
+ import "./external/interfaces/CCTPInterfaces.sol";
7
+ import { IOpUSDCBridgeAdapter } from "./external/interfaces/IOpUSDCBridgeAdapter.sol";
8
+
9
+ /**
10
+ * @notice Ink Spoke pool.
11
+ * @custom:security-contact bugs@across.to
12
+ */
13
+ contract Ink_SpokePool is Ovm_SpokePool {
14
+ using SafeERC20 for IERC20;
15
+
16
+ // Address of the custom L2 USDC bridge.
17
+ address private constant USDC_BRIDGE = address(0);
18
+
19
+ /// @custom:oz-upgrades-unsafe-allow constructor
20
+ constructor(
21
+ address _wrappedNativeTokenAddress,
22
+ uint32 _depositQuoteTimeBuffer,
23
+ uint32 _fillDeadlineBuffer,
24
+ IERC20 _l2Usdc,
25
+ ITokenMessenger _cctpTokenMessenger
26
+ )
27
+ Ovm_SpokePool(
28
+ _wrappedNativeTokenAddress,
29
+ _depositQuoteTimeBuffer,
30
+ _fillDeadlineBuffer,
31
+ _l2Usdc,
32
+ _cctpTokenMessenger
33
+ )
34
+ {} // solhint-disable-line no-empty-blocks
35
+
36
+ /**
37
+ * @notice Construct the OVM World Chain SpokePool.
38
+ * @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate
39
+ * relay hash collisions.
40
+ * @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin.
41
+ * @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will
42
+ */
43
+ function initialize(
44
+ uint32 _initialDepositId,
45
+ address _crossDomainAdmin,
46
+ address _withdrawalRecipient
47
+ ) public initializer {
48
+ __OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH);
49
+ }
50
+
51
+ /**
52
+ * @notice Ink-specific logic to bridge tokens back to the hub pool contract on L1.
53
+ * @param amountToReturn Amount of the token to bridge back.
54
+ * @param l2TokenAddress Address of the l2 Token to bridge back. This token will either be bridged back to the token defined in the mapping `remoteL1Tokens`,
55
+ * or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`.
56
+ * @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since World Chain has a USDC bridge which uses
57
+ * a custom interface. This is because the USDC token on World Chain is meant to be upgraded to a native, CCTP supported version in the future.
58
+ */
59
+ function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override {
60
+ // Handle custom USDC bridge which doesn't conform to the standard bridge interface. In the future, CCTP may be used to bridge USDC to mainnet, in which
61
+ // case bridging logic is handled by the Ovm_SpokePool code. In the meantime, if CCTP is not enabled, then use the USDC bridge. Once CCTP is activated on
62
+ // WorldChain, this block of code will be unused.
63
+ if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) {
64
+ usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn);
65
+ IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage(
66
+ withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 hub pool contract.
67
+ amountToReturn, // _amount.
68
+ l1Gas // _minGasLimit. Same value used in other OpStack bridges.
69
+ );
70
+ } else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress);
71
+ }
72
+ }
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CIRCLE_DOMAIN_IDs = exports.POLYGON_CHAIN_IDS = exports.L2_ADDRESS_MAP = exports.OP_STACK_ADDRESS_MAP = exports.L1_ADDRESS_MAP = exports.AZERO_GAS_PRICE = exports.ARBITRUM_MAX_SUBMISSION_COST = exports.FILL_DEADLINE_BUFFER = exports.QUOTE_TIME_BUFFER = exports.AZERO = exports.WAZERO = exports.WMATIC = exports.WETH = exports.USDCe = exports.USDC = exports.ZERO_ADDRESS = void 0;
4
- var common_1 = require("@uma/common");
5
- Object.defineProperty(exports, "ZERO_ADDRESS", { enumerable: true, get: function () { return common_1.ZERO_ADDRESS; } });
4
+ const common_1 = require("@uma/common");
6
5
  const utils_1 = require("../utils");
6
+ var common_2 = require("@uma/common");
7
+ Object.defineProperty(exports, "ZERO_ADDRESS", { enumerable: true, get: function () { return common_2.ZERO_ADDRESS; } });
7
8
  exports.USDC = utils_1.TOKEN_SYMBOLS_MAP.USDC.addresses;
8
9
  exports.USDCe = utils_1.TOKEN_SYMBOLS_MAP["USDC.e"].addresses;
9
10
  exports.WETH = utils_1.TOKEN_SYMBOLS_MAP.WETH.addresses;
@@ -74,6 +75,11 @@ exports.OP_STACK_ADDRESS_MAP = {
74
75
  L1CrossDomainMessenger: "0x5D4472f31Bd9385709ec61305AFc749F0fA8e9d0",
75
76
  L1StandardBridge: "0x697402166Fbf2F22E970df8a6486Ef171dbfc524",
76
77
  },
78
+ [utils_1.CHAIN_IDs.INK]: {
79
+ L1CrossDomainMessenger: "0x69d3cf86b2bf1a9e99875b7e2d9b6a84426c171f",
80
+ L1StandardBridge: "0x88ff1e5b602916615391f55854588efcbb7663f0",
81
+ L1OpUSDCBridgeAdapter: common_1.ZERO_ADDRESS,
82
+ },
77
83
  [utils_1.CHAIN_IDs.LISK]: {
78
84
  L1CrossDomainMessenger: "0x31B72D76FB666844C41EdF08dF0254875Dbb7edB",
79
85
  L1StandardBridge: "0x2658723Bf70c7667De6B25F99fcce13A16D25d08",
@@ -28,7 +28,8 @@
28
28
  "Redstone_Adapter": { "address": "0x188F8C95B7cfB7993B53a4F643efa687916f73fA", "blockNumber": 20432774 },
29
29
  "Zora_Adapter": { "address": "0x024f2fc31cbdd8de17194b1892c834f98ef5169b", "blockNumber": 20512287 },
30
30
  "WorldChain_Adapter": { "address": "0xA8399e221a583A57F54Abb5bA22f31b5D6C09f32", "blockNumber": 20963234 },
31
- "AlephZero_Adapter": { "address": "0x6F4083304C2cA99B077ACE06a5DcF670615915Af", "blockNumber": 21131132 }
31
+ "AlephZero_Adapter": { "address": "0x6F4083304C2cA99B077ACE06a5DcF670615915Af", "blockNumber": 21131132 },
32
+ "Ink_Adapter": { "address": "0x7e90a40c7519b041a7df6498fbf5662e8cfc61d2", "blockNumber": 21438590 }
32
33
  },
33
34
  "10": {
34
35
  "SpokePool": { "address": "0x6f26Bf09B1C792e3228e5467807a900A503c0281", "blockNumber": 93903076 },
@@ -157,5 +158,10 @@
157
158
  "41455": {
158
159
  "SpokePool": { "address": "0x13fDac9F9b4777705db45291bbFF3c972c6d1d97", "blockNumber": 4240318 },
159
160
  "MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 4112529 }
161
+ },
162
+ "57073": {
163
+ "SpokePool": { "address": "0xeF684C38F94F48775959ECf2012D7E864ffb9dd4", "blockNumber": 1139240 },
164
+ "SpokePoolVerifier": { "address": "0xB4A8d45647445EA9FC3E1058096142390683dBC2", "blockNumber": 1152853 },
165
+ "MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 1145284 }
160
166
  }
161
167
  }
@@ -101,6 +101,7 @@ const config = {
101
101
  "contracts/Base_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
102
102
  "contracts/Optimism_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
103
103
  "contracts/WorldChain_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
104
+ "contracts/Ink_SpokePool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
104
105
  },
105
106
  },
106
107
  zksolc: {
@@ -203,6 +204,13 @@ const config = {
203
204
  accounts: { mnemonic },
204
205
  companionNetworks: { l1: "sepolia" },
205
206
  },
207
+ ink: {
208
+ chainId: constants_1.CHAIN_IDs.INK,
209
+ url: "https://rpc-gel.inkonchain.com",
210
+ saveDeployments: true,
211
+ accounts: { mnemonic },
212
+ companionNetworks: { l1: "mainnet" },
213
+ },
206
214
  linea: {
207
215
  chainId: constants_1.CHAIN_IDs.LINEA,
208
216
  url: `https://linea-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
@@ -337,6 +345,7 @@ const config = {
337
345
  zora: "routescan",
338
346
  worldchain: "blockscout",
339
347
  alephzero: "blockscout",
348
+ ink: "blockscout",
340
349
  },
341
350
  customChains: [
342
351
  {
@@ -363,6 +372,14 @@ const config = {
363
372
  browserURL: "https://sepolia.basescan.org",
364
373
  },
365
374
  },
375
+ {
376
+ network: "ink",
377
+ chainId: constants_1.CHAIN_IDs.INK,
378
+ urls: {
379
+ apiURL: "https://explorer.inkonchain.com/api",
380
+ browserURL: "https://explorer.inkonchain.com",
381
+ },
382
+ },
366
383
  {
367
384
  network: "linea",
368
385
  chainId: constants_1.CHAIN_IDs.LINEA,
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const SvmUtils_1 = require("../../src/SvmUtils");
6
+ const svm_1 = require("../../src/svm");
7
7
  const yargs_1 = __importDefault(require("yargs"));
8
8
  const helpers_1 = require("yargs/helpers");
9
9
  const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("address", {
@@ -13,7 +13,7 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("
13
13
  }).argv;
14
14
  async function logPublicKey() {
15
15
  const address = (await argv).address;
16
- const publicKey = (0, SvmUtils_1.evmAddressToPublicKey)(address);
16
+ const publicKey = (0, svm_1.evmAddressToPublicKey)(address);
17
17
  console.log("Ethereum Address:", address);
18
18
  console.log("Associated Public Key:", publicKey.toString());
19
19
  }
@@ -6,14 +6,11 @@
6
6
  * updates the Hub Pool’s USDC balance.
7
7
  *
8
8
  * Required Environment Variables:
9
- * - TESTNET: (Optional) Set to "true" to use Sepolia; defaults to mainnet.
10
9
  * - MNEMONIC: Wallet mnemonic to sign the Ethereum transaction.
11
10
  * - HUB_POOL_ADDRESS: Ethereum address of the Hub Pool.
12
- * - NODE_URL_1: Ethereum RPC URL for mainnet (ignored if TESTNET=true).
13
- * - NODE_URL_11155111: Ethereum RPC URL for Sepolia (ignored if TESTNET=false).
11
+ * - NODE_URL_${CHAIN_ID}: Ethereum RPC URL (must point to the Mainnet or Sepolia depending on Solana cluster).
14
12
  *
15
13
  * Example Usage:
16
- * TESTNET=true \
17
14
  * NODE_URL_11155111=$NODE_URL_11155111 \
18
15
  * MNEMONIC=$MNEMONIC \
19
16
  * HUB_POOL_ADDRESS=$HUB_POOL_ADDRESS \
@@ -7,14 +7,11 @@
7
7
  * updates the Hub Pool’s USDC balance.
8
8
  *
9
9
  * Required Environment Variables:
10
- * - TESTNET: (Optional) Set to "true" to use Sepolia; defaults to mainnet.
11
10
  * - MNEMONIC: Wallet mnemonic to sign the Ethereum transaction.
12
11
  * - HUB_POOL_ADDRESS: Ethereum address of the Hub Pool.
13
- * - NODE_URL_1: Ethereum RPC URL for mainnet (ignored if TESTNET=true).
14
- * - NODE_URL_11155111: Ethereum RPC URL for Sepolia (ignored if TESTNET=false).
12
+ * - NODE_URL_${CHAIN_ID}: Ethereum RPC URL (must point to the Mainnet or Sepolia depending on Solana cluster).
15
13
  *
16
14
  * Example Usage:
17
- * TESTNET=true \
18
15
  * NODE_URL_11155111=$NODE_URL_11155111 \
19
16
  * MNEMONIC=$MNEMONIC \
20
17
  * HUB_POOL_ADDRESS=$HUB_POOL_ADDRESS \
@@ -74,7 +71,8 @@ const tokenMessengerMinterIdl = require("../../target/idl/token_messenger_minter
74
71
  const ethereumDomain = 0; // Ethereum
75
72
  const solanaDomain = 5; // Solana
76
73
  // Set up Ethereum provider and signer.
77
- const nodeURL = process.env.TESTNET === "true" ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
74
+ const isDevnet = (0, helpers_1.isSolanaDevnet)(provider);
75
+ const nodeURL = isDevnet ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
78
76
  const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(nodeURL);
79
77
  const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic((0, helpers_1.requireEnv)("MNEMONIC")).connect(ethersProvider);
80
78
  // Get the HubPool contract instance.
@@ -126,15 +124,7 @@ const messageTransmitterAbi = [
126
124
  ];
127
125
  async function bridgeLiabilityToHubPool() {
128
126
  const seed = constants_1.SOLANA_SPOKE_STATE_SEED; // Seed is always 0 for the state account PDA in public networks.
129
- // Resolve Solana cluster, EVM chain ID, Iris API URL and USDC addresses.
130
- let isDevnet;
131
- const solanaRpcEndpoint = provider.connection.rpcEndpoint;
132
- if (solanaRpcEndpoint.includes("devnet"))
133
- isDevnet = true;
134
- else if (solanaRpcEndpoint.includes("mainnet"))
135
- isDevnet = false;
136
- else
137
- throw new Error(`Unsupported solanaCluster endpoint: ${solanaRpcEndpoint}`);
127
+ // Resolve Solana USDC addresses.
138
128
  const svmUsdc = isDevnet ? constants_1.SOLANA_USDC_DEVNET : constants_1.SOLANA_USDC_MAINNET;
139
129
  const [statePda, _] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("state"), seed.toArrayLike(Buffer, "le", 8)], svmSpokeProgram.programId);
140
130
  const irisApiUrl = isDevnet ? constants_1.CIRCLE_IRIS_API_URL_DEVNET : constants_1.CIRCLE_IRIS_API_URL_MAINNET;
@@ -148,7 +138,7 @@ async function bridgeLiabilityToHubPool() {
148
138
  const usdcBalanceBefore = await usdc.balanceOf(hubPoolAddress);
149
139
  console.log("Receiving liability from Solana Spoke Pool to Ethereum Hub Pool...");
150
140
  console.table([
151
- { Property: "isTestnet", Value: process.env.TESTNET === "true" },
141
+ { Property: "isTestnet", Value: isDevnet },
152
142
  { Property: "hubPoolAddress", Value: hubPoolAddress },
153
143
  { Property: "svmSpokeProgramProgramId", Value: svmSpokeProgram.programId.toString() },
154
144
  { Property: "providerPublicKey", Value: provider.wallet.publicKey.toString() },
@@ -33,7 +33,7 @@ const anchor_1 = require("@coral-xyz/anchor");
33
33
  const web3_js_1 = require("@solana/web3.js");
34
34
  const yargs_1 = __importDefault(require("yargs"));
35
35
  const helpers_1 = require("yargs/helpers");
36
- const SvmUtils_1 = require("../../src/SvmUtils");
36
+ const svm_1 = require("../../src/svm");
37
37
  // Set up the provider
38
38
  const provider = anchor_1.AnchorProvider.env();
39
39
  anchor.setProvider(provider);
@@ -54,7 +54,7 @@ async function closeExpiredRelays() {
54
54
  { Property: "programId", Value: programId.toString() },
55
55
  ]);
56
56
  try {
57
- const events = await (0, SvmUtils_1.readProgramEvents)(provider.connection, program);
57
+ const events = await (0, svm_1.readProgramEvents)(provider.connection, program);
58
58
  const fillEvents = events.filter((event) => event.name === "filledV3Relay" && new web3_js_1.PublicKey(event.data.relayer).equals(relayer));
59
59
  console.log(`Number of fill events found: ${fillEvents.length}`);
60
60
  if (fillEvents.length === 0) {
@@ -95,7 +95,7 @@ async function closeFillPda(eventData, seed) {
95
95
  // Fetch the state to get the chainId
96
96
  const state = await program.account.state.fetch(statePda);
97
97
  const chainId = new anchor_1.BN(state.chainId);
98
- const relayHashUint8Array = (0, SvmUtils_1.calculateRelayEventHashUint8Array)(relayEventData, chainId);
98
+ const relayHashUint8Array = (0, svm_1.calculateRelayEventHashUint8Array)(relayEventData, chainId);
99
99
  const [fillStatusPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("fills"), relayHashUint8Array], programId);
100
100
  try {
101
101
  // Check if the fillStatusPda account exists
@@ -6,18 +6,15 @@
6
6
  * liabilities for bridging back to the Hub Pool.
7
7
  *
8
8
  * Required Environment Variables:
9
- * - TESTNET: (Optional) Set to "true" to use Sepolia; defaults to mainnet.
10
9
  * - MNEMONIC: Wallet mnemonic to sign the Ethereum transaction.
11
10
  * - HUB_POOL_ADDRESS: Ethereum address of the Hub Pool.
12
- * - NODE_URL_1: Ethereum RPC URL for mainnet (ignored if TESTNET=true).
13
- * - NODE_URL_11155111: Ethereum RPC URL for Sepolia (ignored if TESTNET=false).
11
+ * - NODE_URL_${CHAIN_ID}: Ethereum RPC URL (must point to the Mainnet or Sepolia depending on Solana cluster).
14
12
  *
15
13
  * Required Arguments:
16
14
  * - `--netSendAmount`: The unscaled amount of USDC to rebalance (e.g., for USDC with 6 decimals, 1 = 0.000001 USDC).
17
15
  * - `--resumeRemoteTx`: (Optional) Hash of a previously submitted remote transaction to resume.
18
16
  *
19
17
  * Example Usage:
20
- * TESTNET=true \
21
18
  * NODE_URL_11155111=$NODE_URL_11155111 \
22
19
  * MNEMONIC=$MNEMONIC \
23
20
  * HUB_POOL_ADDRESS=$HUB_POOL_ADDRESS \
@@ -7,18 +7,15 @@
7
7
  * liabilities for bridging back to the Hub Pool.
8
8
  *
9
9
  * Required Environment Variables:
10
- * - TESTNET: (Optional) Set to "true" to use Sepolia; defaults to mainnet.
11
10
  * - MNEMONIC: Wallet mnemonic to sign the Ethereum transaction.
12
11
  * - HUB_POOL_ADDRESS: Ethereum address of the Hub Pool.
13
- * - NODE_URL_1: Ethereum RPC URL for mainnet (ignored if TESTNET=true).
14
- * - NODE_URL_11155111: Ethereum RPC URL for Sepolia (ignored if TESTNET=false).
12
+ * - NODE_URL_${CHAIN_ID}: Ethereum RPC URL (must point to the Mainnet or Sepolia depending on Solana cluster).
15
13
  *
16
14
  * Required Arguments:
17
15
  * - `--netSendAmount`: The unscaled amount of USDC to rebalance (e.g., for USDC with 6 decimals, 1 = 0.000001 USDC).
18
16
  * - `--resumeRemoteTx`: (Optional) Hash of a previously submitted remote transaction to resume.
19
17
  *
20
18
  * Example Usage:
21
- * TESTNET=true \
22
19
  * NODE_URL_11155111=$NODE_URL_11155111 \
23
20
  * MNEMONIC=$MNEMONIC \
24
21
  * HUB_POOL_ADDRESS=$HUB_POOL_ADDRESS \
@@ -72,7 +69,7 @@ const constants_2 = require("./utils/constants");
72
69
  const helpers_2 = require("./utils/helpers");
73
70
  const common_1 = require("@uma/common");
74
71
  const cctpHelpers_1 = require("../../test/svm/cctpHelpers");
75
- const utils_1 = require("../../test/svm/utils");
72
+ const svm_1 = require("../../src/svm");
76
73
  // Set up Solana provider.
77
74
  const provider = anchor_1.AnchorProvider.env();
78
75
  anchor.setProvider(provider);
@@ -86,7 +83,8 @@ const [authorityPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("
86
83
  const [selfAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("self_authority")], svmSpokeProgram.programId);
87
84
  const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], svmSpokeProgram.programId);
88
85
  // Set up Ethereum provider and signer.
89
- const nodeURL = process.env.TESTNET === "true" ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
86
+ const isDevnet = (0, helpers_2.isSolanaDevnet)(provider);
87
+ const nodeURL = isDevnet ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
90
88
  const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(nodeURL);
91
89
  const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic((0, helpers_2.requireEnv)("MNEMONIC")).connect(ethersProvider);
92
90
  // Get the HubPool contract instance.
@@ -105,14 +103,6 @@ async function executeRebalanceToHubPool() {
105
103
  const netSendAmount = ethers_1.BigNumber.from(resolvedArgv.netSendAmount);
106
104
  const resumeRemoteTx = resolvedArgv.resumeRemoteTx;
107
105
  // Resolve Solana cluster, EVM chain ID, Iris API URL and USDC addresses.
108
- let isDevnet;
109
- const solanaRpcEndpoint = provider.connection.rpcEndpoint;
110
- if (solanaRpcEndpoint.includes("devnet"))
111
- isDevnet = true;
112
- else if (solanaRpcEndpoint.includes("mainnet"))
113
- isDevnet = false;
114
- else
115
- throw new Error(`Unsupported solanaCluster endpoint: ${solanaRpcEndpoint}`);
116
106
  const solanaCluster = isDevnet ? "devnet" : "mainnet";
117
107
  const solanaChainId = (0, helpers_2.getSolanaChainId)(solanaCluster);
118
108
  const irisApiUrl = isDevnet ? constants_2.CIRCLE_IRIS_API_URL_DEVNET : constants_2.CIRCLE_IRIS_API_URL_MAINNET;
@@ -127,7 +117,7 @@ async function executeRebalanceToHubPool() {
127
117
  const [rootBundlePda] = getRootBundlePda(state.rootBundleId, seed);
128
118
  console.log("Executing rebalance to hub pool...");
129
119
  console.table([
130
- { Property: "isTestnet", Value: process.env.TESTNET === "true" },
120
+ { Property: "isTestnet", Value: isDevnet },
131
121
  { Property: "originChainId", Value: evmChainId.toString() },
132
122
  { Property: "targetChainId", Value: solanaChainId.toString() },
133
123
  { Property: "hubPoolAddress", Value: hubPool.address },
@@ -324,7 +314,7 @@ async function executeRelayerRefundLeaf(signer, program, statePda, rootBundle, r
324
314
  if (!lookupTableAccount) {
325
315
  throw new Error("AddressLookupTableAccount not fetched");
326
316
  }
327
- await (0, utils_1.loadExecuteRelayerRefundLeafParams)(program, signer.publicKey, rootBundleId, leaf, proofAsNumbers);
317
+ await (0, svm_1.loadExecuteRelayerRefundLeafParams)(program, signer.publicKey, rootBundleId, leaf, proofAsNumbers);
328
318
  console.log(`loaded execute relayer refund leaf params ${instructionParams}. \nExecuting relayer refund leaf...`);
329
319
  const executeInstruction = await program.methods
330
320
  .executeRelayerRefundLeaf()
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // This script executes root bundle on HubPool that rebalances tokens to Solana Spoke Pool. Required environment:
3
- // - ETHERS_PROVIDER_URL: Ethereum RPC provider URL.
4
- // - ETHERS_MNEMONIC: Mnemonic of the wallet that will sign the sending transaction on Ethereum
3
+ // - NODE_URL_${CHAIN_ID}: Ethereum RPC URL (must point to the Mainnet or Sepolia depending on Solana cluster).
4
+ // - MNEMONIC: Mnemonic of the wallet that will sign the sending transaction on Ethereum
5
5
  // - HUB_POOL_ADDRESS: Hub Pool address
6
6
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
7
  if (k2 === undefined) k2 = k;
@@ -34,17 +34,19 @@ const anchor = __importStar(require("@coral-xyz/anchor"));
34
34
  const anchor_1 = require("@coral-xyz/anchor");
35
35
  const web3_js_1 = require("@solana/web3.js");
36
36
  const spl_token_1 = require("@solana/spl-token");
37
+ const common_1 = require("@uma/common");
37
38
  // eslint-disable-next-line camelcase
38
39
  const constants_1 = require("../../utils/constants");
39
40
  const yargs_1 = __importDefault(require("yargs"));
40
41
  const helpers_1 = require("yargs/helpers");
41
- const SvmUtils_1 = require("../../src/SvmUtils");
42
+ const svm_1 = require("../../src/svm");
42
43
  const ethers_1 = require("ethers");
43
44
  // eslint-disable-next-line camelcase
44
45
  const typechain_1 = require("../../typechain");
45
46
  const constants_2 = require("./utils/constants");
46
47
  const poolRebalanceTree_1 = require("./utils/poolRebalanceTree");
47
48
  const cctpHelpers_1 = require("../../test/svm/cctpHelpers");
49
+ const helpers_2 = require("./utils/helpers");
48
50
  // Set up Solana provider.
49
51
  const provider = anchor_1.AnchorProvider.env();
50
52
  anchor.setProvider(provider);
@@ -55,20 +57,13 @@ const messageTransmitterIdl = require("../../target/idl/message_transmitter.json
55
57
  const messageTransmitterProgram = new anchor_1.Program(messageTransmitterIdl, provider);
56
58
  const tokenMessengerMinterIdl = require("../../target/idl/token_messenger_minter.json");
57
59
  const tokenMessengerMinterProgram = new anchor_1.Program(tokenMessengerMinterIdl, provider);
58
- // Set up Ethereum provider.
59
- if (!process.env.ETHERS_PROVIDER_URL) {
60
- throw new Error("Environment variable ETHERS_PROVIDER_URL is not set");
61
- }
62
- const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(process.env.ETHERS_PROVIDER_URL);
63
- if (!process.env.ETHERS_MNEMONIC) {
64
- throw new Error("Environment variable ETHERS_MNEMONIC is not set");
65
- }
66
- const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic(process.env.ETHERS_MNEMONIC).connect(ethersProvider);
60
+ // Set up Ethereum provider and signer.
61
+ const isDevnet = (0, helpers_2.isSolanaDevnet)(provider);
62
+ const nodeURL = isDevnet ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
63
+ const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(nodeURL);
64
+ const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic((0, helpers_2.requireEnv)("MNEMONIC")).connect(ethersProvider);
67
65
  // Get the HubPool contract instance.
68
- if (!process.env.HUB_POOL_ADDRESS) {
69
- throw new Error("Environment variable HUB_POOL_ADDRESS is not set");
70
- }
71
- const hubPoolAddress = ethers_1.ethers.utils.getAddress(process.env.HUB_POOL_ADDRESS);
66
+ const hubPoolAddress = ethers_1.ethers.utils.getAddress((0, helpers_2.requireEnv)("HUB_POOL_ADDRESS"));
72
67
  const hubPool = typechain_1.HubPool__factory.connect(hubPoolAddress, ethersProvider);
73
68
  // CCTP domains.
74
69
  const remoteDomain = 0; // Ethereum
@@ -90,17 +85,9 @@ async function executeRebalanceToSpokePool() {
90
85
  const seed = new anchor_1.BN(0); // Seed is always 0 for the state account PDA in public networks.
91
86
  const netSendAmount = resolvedArgv.netSendAmount ? ethers_1.BigNumber.from(resolvedArgv.netSendAmount) : ethers_1.BigNumber.from(0);
92
87
  const resumeRemoteTx = resolvedArgv.resumeRemoteTx;
93
- // Resolve Solana cluster, EVM chain ID, Iris API URL and USDC addresses.
94
- let isDevnet;
95
- const solanaRpcEndpoint = provider.connection.rpcEndpoint;
96
- if (solanaRpcEndpoint.includes("devnet"))
97
- isDevnet = true;
98
- else if (solanaRpcEndpoint.includes("mainnet"))
99
- isDevnet = false;
100
- else
101
- throw new Error(`Unsupported solanaCluster endpoint: ${solanaRpcEndpoint}`);
88
+ // Resolve chain IDs, Iris API URL and USDC addresses.
102
89
  const solanaCluster = isDevnet ? "devnet" : "mainnet";
103
- const solanaChainId = ethers_1.BigNumber.from(BigInt(ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(`solana-${solanaCluster}`))) & BigInt("0xFFFFFFFFFFFFFFFF"));
90
+ const solanaChainId = (0, helpers_2.getSolanaChainId)(solanaCluster);
104
91
  const irisApiUrl = isDevnet ? constants_2.CIRCLE_IRIS_API_URL_DEVNET : constants_2.CIRCLE_IRIS_API_URL_MAINNET;
105
92
  const supportedEvmChainId = isDevnet ? constants_1.CHAIN_IDs.SEPOLIA : constants_1.CHAIN_IDs.MAINNET; // Sepolia is bridged to devnet, Ethereum to mainnet in CCTP.
106
93
  const evmChainId = (await ethersProvider.getNetwork()).chainId;
@@ -136,7 +123,7 @@ async function executeRebalanceToSpokePool() {
136
123
  const [remoteTokenMessengerKey] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("remote_token_messenger"), Buffer.from(remoteDomain.toString())], tokenMessengerMinterProgram.programId);
137
124
  const [tokenMinterAccount] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_minter")], tokenMessengerMinterProgram.programId);
138
125
  const [localToken] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("local_token"), solanaTokenKey.toBuffer()], tokenMessengerMinterProgram.programId);
139
- const [tokenPair] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_pair"), Buffer.from(remoteDomain.toString()), (0, SvmUtils_1.evmAddressToPublicKey)(l1TokenAddress).toBuffer()], tokenMessengerMinterProgram.programId);
126
+ const [tokenPair] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_pair"), Buffer.from(remoteDomain.toString()), (0, svm_1.evmAddressToPublicKey)(l1TokenAddress).toBuffer()], tokenMessengerMinterProgram.programId);
140
127
  const [custodyTokenAccount] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("custody"), solanaTokenKey.toBuffer()], tokenMessengerMinterProgram.programId);
141
128
  const [tokenMessengerEventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], tokenMessengerMinterProgram.programId);
142
129
  // Fetch attestation from CCTP attestation service.
@@ -34,8 +34,7 @@ const web3_js_1 = require("@solana/web3.js");
34
34
  const spl_token_1 = require("@solana/spl-token");
35
35
  const yargs_1 = __importDefault(require("yargs"));
36
36
  const helpers_1 = require("yargs/helpers");
37
- const SvmUtils_1 = require("../../src/SvmUtils");
38
- const utils_1 = require("../../test/svm/utils");
37
+ const svm_1 = require("../../src/svm");
39
38
  // Set up the provider and signer.
40
39
  const provider = anchor_1.AnchorProvider.env();
41
40
  anchor.setProvider(provider);
@@ -98,9 +97,9 @@ async function fillV3RelayToRandom() {
98
97
  transferInstructions.push(transferInstruction);
99
98
  }
100
99
  // Encode handler message for the token distribution.
101
- const multicallHandlerCoder = new SvmUtils_1.MulticallHandlerCoder(transferInstructions);
100
+ const multicallHandlerCoder = new svm_1.MulticallHandlerCoder(transferInstructions);
102
101
  const handlerMessage = multicallHandlerCoder.encode();
103
- const message = new SvmUtils_1.AcrossPlusMessageCoder({
102
+ const message = new svm_1.AcrossPlusMessageCoder({
104
103
  handler,
105
104
  readOnlyLen: multicallHandlerCoder.readOnlyLen,
106
105
  valueAmount: new anchor_1.BN(0),
@@ -128,7 +127,7 @@ async function fillV3RelayToRandom() {
128
127
  // Fetch the state from the on-chain program to get chainId
129
128
  const state = await program.account.state.fetch(statePda);
130
129
  const chainId = new anchor_1.BN(state.chainId);
131
- const relayHashUint8Array = (0, SvmUtils_1.calculateRelayHashUint8Array)(relayData, chainId);
130
+ const relayHashUint8Array = (0, svm_1.calculateRelayHashUint8Array)(relayData, chainId);
132
131
  const relayHash = Array.from(relayHashUint8Array);
133
132
  // Define the fill status account PDA
134
133
  const [fillStatusPda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("fills"), relayHashUint8Array], programId);
@@ -155,7 +154,7 @@ async function fillV3RelayToRandom() {
155
154
  // Prepare fill instruction as we will need to use Address Lookup Table (ALT).
156
155
  const fillV3RelayValues = [relayHash, relayData, repaymentChain, repaymentAddress];
157
156
  if (bufferParams) {
158
- await (0, utils_1.loadFillV3RelayParams)(program, signer, fillV3RelayValues[1], fillV3RelayValues[2], fillV3RelayValues[3]);
157
+ await (0, svm_1.loadFillV3RelayParams)(program, signer, fillV3RelayValues[1], fillV3RelayValues[2], fillV3RelayValues[3]);
159
158
  }
160
159
  const fillV3RelayParams = bufferParams ? [fillV3RelayValues[0], null, null, null] : fillV3RelayValues;
161
160
  const [instructionParams] = bufferParams
@@ -184,7 +183,7 @@ async function fillV3RelayToRandom() {
184
183
  .remainingAccounts(remainingAccounts)
185
184
  .instruction();
186
185
  // Fill using the ALT.
187
- const { txSignature } = await (0, SvmUtils_1.sendTransactionWithLookupTable)(provider.connection, [approveInstruction, fillInstruction], signer);
186
+ const { txSignature } = await (0, svm_1.sendTransactionWithLookupTable)(provider.connection, [approveInstruction, fillInstruction], signer);
188
187
  console.log("Transaction signature:", txSignature);
189
188
  }
190
189
  // Run the fillV3RelayToRandom function
@@ -32,7 +32,7 @@ const anchor_1 = require("@coral-xyz/anchor");
32
32
  const web3_js_1 = require("@solana/web3.js");
33
33
  const yargs_1 = __importDefault(require("yargs"));
34
34
  const helpers_1 = require("yargs/helpers");
35
- const SvmUtils_1 = require("../../src/SvmUtils");
35
+ const svm_1 = require("../../src/svm");
36
36
  // Set up the provider
37
37
  const provider = anchor_1.AnchorProvider.env();
38
38
  anchor.setProvider(provider);
@@ -64,7 +64,7 @@ async function initialize() {
64
64
  const initialNumberOfDeposits = new anchor_1.BN(resolvedArgv.initNumbDeposits);
65
65
  const chainId = new anchor_1.BN(resolvedArgv.chainId);
66
66
  const remoteDomain = resolvedArgv.remoteDomain;
67
- const crossDomainAdmin = (0, SvmUtils_1.evmAddressToPublicKey)(resolvedArgv.crossDomainAdmin); // Use the function to cast the value
67
+ const crossDomainAdmin = (0, svm_1.evmAddressToPublicKey)(resolvedArgv.crossDomainAdmin); // Use the function to cast the value
68
68
  const depositQuoteTimeBuffer = resolvedArgv.depositQuoteTimeBuffer;
69
69
  const fillDeadlineBuffer = resolvedArgv.fillDeadlineBuffer;
70
70
  // Define the state account PDA
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  // This script proposes root bundle on HubPool that would rebalance tokens to Solana Spoke Pool once executed.
3
3
  // Required environment:
4
- // - ETHERS_PROVIDER_URL: Ethereum RPC provider URL.
5
- // - ETHERS_MNEMONIC: Mnemonic of the wallet that will sign the sending transaction on Ethereum
4
+ // - TESTNET: (Optional) Set to "true" to use Sepolia; defaults to mainnet.
5
+ // - MNEMONIC: Wallet mnemonic to sign the Ethereum transaction.
6
6
  // - HUB_POOL_ADDRESS: Hub Pool address
7
+ // - NODE_URL_1: Ethereum RPC URL for mainnet (ignored if TESTNET=true).
8
+ // - NODE_URL_11155111: Ethereum RPC URL for Sepolia (ignored if TESTNET=false).
7
9
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
11
  };
@@ -13,23 +15,17 @@ const constants_1 = require("../../utils/constants");
13
15
  const yargs_1 = __importDefault(require("yargs"));
14
16
  const helpers_1 = require("yargs/helpers");
15
17
  const ethers_1 = require("ethers");
18
+ const common_1 = require("@uma/common");
16
19
  // eslint-disable-next-line camelcase
17
20
  const typechain_1 = require("../../typechain");
18
21
  const poolRebalanceTree_1 = require("./utils/poolRebalanceTree");
22
+ const helpers_2 = require("./utils/helpers");
19
23
  // Set up Ethereum provider.
20
- if (!process.env.ETHERS_PROVIDER_URL) {
21
- throw new Error("Environment variable ETHERS_PROVIDER_URL is not set");
22
- }
23
- const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(process.env.ETHERS_PROVIDER_URL);
24
- if (!process.env.ETHERS_MNEMONIC) {
25
- throw new Error("Environment variable ETHERS_MNEMONIC is not set");
26
- }
27
- const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic(process.env.ETHERS_MNEMONIC).connect(ethersProvider);
24
+ const nodeURL = process.env.TESTNET === "true" ? (0, common_1.getNodeUrl)("sepolia", true) : (0, common_1.getNodeUrl)("mainnet", true);
25
+ const ethersProvider = new ethers_1.ethers.providers.JsonRpcProvider(nodeURL);
26
+ const ethersSigner = ethers_1.ethers.Wallet.fromMnemonic((0, helpers_2.requireEnv)("MNEMONIC")).connect(ethersProvider);
28
27
  // Get the HubPool contract instance.
29
- if (!process.env.HUB_POOL_ADDRESS) {
30
- throw new Error("Environment variable HUB_POOL_ADDRESS is not set");
31
- }
32
- const hubPoolAddress = ethers_1.ethers.utils.getAddress(process.env.HUB_POOL_ADDRESS);
28
+ const hubPoolAddress = ethers_1.ethers.utils.getAddress((0, helpers_2.requireEnv)("HUB_POOL_ADDRESS"));
33
29
  const hubPool = typechain_1.HubPool__factory.connect(hubPoolAddress, ethersProvider);
34
30
  // Parse arguments
35
31
  const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("netSendAmount", {
@@ -45,7 +41,7 @@ async function proposeRebalanceToSpokePool() {
45
41
  if (evmChainId !== constants_1.CHAIN_IDs.MAINNET && evmChainId !== constants_1.CHAIN_IDs.SEPOLIA)
46
42
  throw new Error("Unsupported EVM chain ID");
47
43
  const solanaCluster = evmChainId === constants_1.CHAIN_IDs.MAINNET ? "mainnet" : "devnet";
48
- const solanaChainId = ethers_1.BigNumber.from(BigInt(ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(`solana-${solanaCluster}`))) & BigInt("0xFFFFFFFFFFFFFFFF"));
44
+ const solanaChainId = (0, helpers_2.getSolanaChainId)(solanaCluster);
49
45
  const l1TokenAddress = constants_1.TOKEN_SYMBOLS_MAP.USDC.addresses[evmChainId];
50
46
  // Construct simple merkle tree for the pool rebalance.
51
47
  const { poolRebalanceTree } = (0, poolRebalanceTree_1.constructSimpleRebalanceTree)(l1TokenAddress, netSendAmount, solanaChainId);
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const SvmUtils_1 = require("../../src/SvmUtils");
7
6
  const yargs_1 = __importDefault(require("yargs"));
8
7
  const helpers_1 = require("yargs/helpers");
8
+ const svm_1 = require("../../src/svm");
9
9
  const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("publicKey", {
10
10
  type: "string",
11
11
  demandOption: true,
@@ -13,7 +13,7 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)).option("
13
13
  }).argv;
14
14
  async function logEvmAddress() {
15
15
  const publicKey = (await argv).publicKey;
16
- const evmAddress = (0, SvmUtils_1.publicKeyToEvmAddress)(publicKey);
16
+ const evmAddress = (0, svm_1.publicKeyToEvmAddress)(publicKey);
17
17
  console.log("Public Key:", publicKey);
18
18
  console.log("Associated Ethereum Address:", evmAddress);
19
19
  }
@@ -32,7 +32,7 @@ const anchor_1 = require("@coral-xyz/anchor");
32
32
  const web3_js_1 = require("@solana/web3.js");
33
33
  const yargs_1 = __importDefault(require("yargs"));
34
34
  const helpers_1 = require("yargs/helpers");
35
- const SvmUtils_1 = require("../../src/SvmUtils");
35
+ const svm_1 = require("../../src/svm");
36
36
  // Set up the provider
37
37
  const provider = anchor_1.AnchorProvider.env();
38
38
  anchor.setProvider(provider);
@@ -57,7 +57,7 @@ async function queryDeposits() {
57
57
  { Property: "statePda", Value: statePda.toString() },
58
58
  ]);
59
59
  try {
60
- const events = await (0, SvmUtils_1.readProgramEvents)(provider.connection, program);
60
+ const events = await (0, svm_1.readProgramEvents)(provider.connection, program);
61
61
  const depositEvents = events.filter((event) => event.name === "v3FundsDeposited");
62
62
  if (depositEvents.length === 0) {
63
63
  console.log("No deposit events found for the given seed.");