diff --git a/config/deploy/mainnet/eth_config_input.json b/config/deploy/mainnet/eth_config_input.json index 7b4b29f..1af82b9 100644 --- a/config/deploy/mainnet/eth_config_input.json +++ b/config/deploy/mainnet/eth_config_input.json @@ -8,6 +8,7 @@ "axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5" }, "stark_exchange_migration": { + "version": 2, "implementation_address": "0x0000000000000000000000000000000000000000" } } diff --git a/config/deploy/mainnet/eth_deployed.json b/config/deploy/mainnet/eth_deployed.json index aa4296d..b7f37db 100644 --- a/config/deploy/mainnet/eth_deployed.json +++ b/config/deploy/mainnet/eth_deployed.json @@ -8,6 +8,7 @@ "axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5" }, "stark_exchange_migration": { + "version": 1, "implementation_address": "0x58b5484F489f7858DC83a5a677338074b57de806" } -} \ No newline at end of file +} diff --git a/config/deploy/sandbox/eth_config_input.json b/config/deploy/sandbox/eth_config_input.json index 4ff292d..9000543 100644 --- a/config/deploy/sandbox/eth_config_input.json +++ b/config/deploy/sandbox/eth_config_input.json @@ -8,6 +8,7 @@ "axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31" }, "stark_exchange_migration": { + "version": 2, "implementation_address": "0x0000000000000000000000000000000000000000" } } diff --git a/config/deploy/sandbox/eth_deployed.json b/config/deploy/sandbox/eth_deployed.json index f3dc81d..90803ab 100644 --- a/config/deploy/sandbox/eth_deployed.json +++ b/config/deploy/sandbox/eth_deployed.json @@ -8,6 +8,7 @@ "axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31" }, "stark_exchange_migration": { + "version": 1, "implementation_address": "0x9F9b4A495A62191A4225759Ae7C00906Cc6417B8" } -} \ No newline at end of file +} diff --git a/script/DeployEthContracts.s.sol b/script/DeployEthContracts.s.sol index d4fba6a..79f0637 100644 --- a/script/DeployEthContracts.s.sol +++ b/script/DeployEthContracts.s.sol @@ -6,12 +6,13 @@ import "forge-std/Script.sol"; import "forge-std/console.sol"; import {VaultRootSenderAdapter} from "../src/bridge/messaging/VaultRootSenderAdapter.sol"; import {StarkExchangeMigration} from "../src/bridge/starkex/StarkExchangeMigration.sol"; +import {StarkExchangeMigrationV2} from "../src/bridge/starkex/StarkExchangeMigrationV2.sol"; /** * @title DeployEthContracts * @notice Deploys the migration contracts on Ethereum: * 1. VaultRootSenderAdapter - * 2. StarkExchangeMigration (implementation only, no proxy) + * 2. StarkExchangeMigration implementation (version selected via config) * * @dev The StarkExchangeMigration is deployed as an implementation contract only. * The existing StarkEx bridge proxy on-chain will be upgraded to point to this @@ -36,8 +37,9 @@ contract DeployEthContracts is Script { address private axelarGasService; address private axelarGateway; - // StarkExchangeMigration + // StarkExchangeMigration implementation (version 1 or 2, selected via config) address private migrationImpl; + uint256 private migrationVersion; string private configFilePath; string private outputFilePath; @@ -62,6 +64,7 @@ contract DeployEthContracts is Script { // --- StarkExchangeMigration --- migrationImpl = vm.parseJsonAddress(config, "$.stark_exchange_migration.implementation_address"); + migrationVersion = vm.parseJsonUint(config, "$.stark_exchange_migration.version"); } /// @notice Deploys the Ethereum contracts. @@ -83,14 +86,20 @@ contract DeployEthContracts is Script { console.log("Using existing VaultRootSenderAdapter:", senderAdapter); } - // 2. Deploy StarkExchangeMigration implementation (if not already deployed) + // 2. Deploy StarkExchangeMigration implementation (if not already deployed). + // The version is selected via stark_exchange_migration.version in the config. // The constructor only calls _disableInitializers(). No proxy is deployed here. // The existing StarkEx bridge proxy will be upgraded separately via governance. + require(migrationVersion == 1 || migrationVersion == 2, "stark_exchange_migration.version must be 1 or 2"); if (migrationImpl == address(0)) { - migrationImpl = address(new StarkExchangeMigration()); - console.log("Deployed StarkExchangeMigration implementation:", migrationImpl); + if (migrationVersion == 1) { + migrationImpl = address(new StarkExchangeMigration()); + } else { + migrationImpl = address(new StarkExchangeMigrationV2()); + } + console.log("Deployed StarkExchangeMigration v%d implementation:", migrationVersion, migrationImpl); } else { - console.log("Using existing StarkExchangeMigration implementation:", migrationImpl); + console.log("Using existing StarkExchangeMigration v%d implementation:", migrationVersion, migrationImpl); } vm.stopBroadcast(); @@ -133,6 +142,6 @@ contract DeployEthContracts is Script { function _logSummary() private view { console.log("--- Ethereum Deployment Summary ---"); console.log("VaultRootSenderAdapter:", senderAdapter); - console.log("StarkExchangeMigration (impl):", migrationImpl); + console.log("StarkExchangeMigration v%d (impl):", migrationVersion, migrationImpl); } } diff --git a/script/README.md b/script/README.md index 06c63ae..c32a2a4 100644 --- a/script/README.md +++ b/script/README.md @@ -7,7 +7,7 @@ Solidity scripts for deploying and configuring the migration contracts using Fou | Script | Chain | Purpose | Executed By | |--------|-------|---------|-------------| | `DeployZkEVMContracts.s.sol` | zkEVM | Deploy VaultEscapeProofVerifier, VaultRootReceiverAdapter, VaultWithdrawalProcessor | Deployer | -| `DeployEthContracts.s.sol` | Ethereum | Deploy VaultRootSenderAdapter and StarkExchangeMigration implementation | Deployer | +| `DeployEthContracts.s.sol` | Ethereum | Deploy VaultRootSenderAdapter and StarkExchangeMigration implementation (version selected via config) | Deployer | | `GenerateAssetMappings.s.sol` | - | Generate asset mappings by querying bridge contract | Utility (offline) | | `VerifyAssetMappings.s.sol` | - | Verify asset mappings against bridge contract | Utility (read-only) | | `RegisterTokenMappings.s.sol` | zkEVM | Register token mappings on the processor | TOKEN_MAPPING_MANAGER | @@ -89,7 +89,7 @@ forge script script/DeployEthContracts.s.sol \ - `vault_root_sender_adapter.address` - `stark_exchange_migration.implementation_address` -**Note:** The `StarkExchangeMigration` is deployed as an implementation only. The existing StarkEx bridge proxy on-chain must be upgraded to point to this implementation separately (e.g., via governance), at which point `initialize` is called with the migration parameters. +**Note:** The `StarkExchangeMigration` is deployed as an implementation only (no proxy). The existing StarkEx bridge proxy on-chain must be upgraded to point to this implementation separately (e.g., via governance), at which point `initialize` is called with the appropriate parameters. Set `stark_exchange_migration.version` to `1` for `StarkExchangeMigration` or `2` for `StarkExchangeMigrationV2`. ### Step 4: Generate Asset Mappings (zkEVM) @@ -191,6 +191,7 @@ Deploys the Ethereum contracts for the migration system. "axelar_gateway": "0x..." }, "stark_exchange_migration": { + "version": 2, "implementation_address": "0x0000..." } }