Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/deploy/mainnet/eth_config_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5"
},
"stark_exchange_migration": {
"version": 2,
"implementation_address": "0x0000000000000000000000000000000000000000"
}
}
3 changes: 2 additions & 1 deletion config/deploy/mainnet/eth_deployed.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"axelar_gateway": "0x4F4495243837681061C4743b74B3eEdf548D56A5"
},
"stark_exchange_migration": {
"version": 1,
"implementation_address": "0x58b5484F489f7858DC83a5a677338074b57de806"
}
}
}
1 change: 1 addition & 0 deletions config/deploy/sandbox/eth_config_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31"
},
"stark_exchange_migration": {
"version": 2,
"implementation_address": "0x0000000000000000000000000000000000000000"
}
}
3 changes: 2 additions & 1 deletion config/deploy/sandbox/eth_deployed.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"axelar_gateway": "0xe432150cce91c13a887f7D836923d5597adD8E31"
},
"stark_exchange_migration": {
"version": 1,
"implementation_address": "0x9F9b4A495A62191A4225759Ae7C00906Cc6417B8"
}
}
}
23 changes: 16 additions & 7 deletions script/DeployEthContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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.
Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
}
5 changes: 3 additions & 2 deletions script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -191,6 +191,7 @@ Deploys the Ethereum contracts for the migration system.
"axelar_gateway": "0x..."
},
"stark_exchange_migration": {
"version": 2,
"implementation_address": "0x0000..."
}
}
Expand Down
Loading