# WETH Deployment Methods ## Current Deployment Status ### WETH9 Deployment - **Current Method**: Standard `new WETH()` (CREATE opcode) - **Address**: Non-deterministic (depends on deployer nonce) - **Ethereum Mainnet Address**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` ### WETH10 Deployment - **Current Method**: Standard `new WETH10()` (CREATE opcode) - **Address**: Non-deterministic (depends on deployer nonce) - **Ethereum Mainnet Address**: `0xf4BB2e28688e89fCcE3c0580D37d36A7672E8A9f` --- ## Can We Match Ethereum Mainnet Addresses? ### WETH9: ❌ **NO** **Reason**: WETH9 on Ethereum Mainnet was deployed using the `CREATE` opcode (not CREATE2). The address was determined by: - Deployer address - Deployer nonce (transaction count) Since the nonce is chain-specific, it's **impossible** to replicate the exact Ethereum Mainnet address on ChainID 138. ### WETH10: ⚠️ **POSSIBLY** **Reason**: WETH10 may have been deployed with CREATE2. To match the address, we need: 1. **Exact same bytecode** (must match byte-for-byte) 2. **Same deployer address** (or factory address) 3. **Same salt** (if deployed with CREATE2) If WETH10 on Ethereum Mainnet was deployed with CREATE2, we can match the address by: - Using the same bytecode - Using the same CREATE2Factory address (or deploying from the same address) - Using the same salt --- ## CREATE2 Deployment Scripts We've created CREATE2 deployment scripts: 1. **`script/DeployWETHWithCREATE2.s.sol`** - Deploys WETH9 using CREATE2 - Creates a **new deterministic address** for ChainID 138 - Will NOT match Ethereum Mainnet (since Mainnet used CREATE) 2. **`script/DeployWETH10WithCREATE2.s.sol`** - Deploys WETH10 using CREATE2 - Attempts to match Ethereum Mainnet address - Will match if WETH10 on Mainnet was deployed with CREATE2 and we use the same parameters --- ## Usage ### Deploy WETH9 with CREATE2 (New Deterministic Address) ```bash forge script script/DeployWETHWithCREATE2.s.sol:DeployWETHWithCREATE2 \ --rpc-url $RPC_URL \ --broadcast \ --private-key $PRIVATE_KEY ``` ### Deploy WETH10 with CREATE2 (Attempt to Match Mainnet) ```bash forge script script/DeployWETH10WithCREATE2.s.sol:DeployWETH10WithCREATE2 \ --rpc-url $RPC_URL \ --broadcast \ --private-key $PRIVATE_KEY ``` --- ## Benefits of CREATE2 1. **Deterministic Addresses**: Same address across deployments if parameters match 2. **Predictable**: Can compute address before deployment 3. **Cross-Chain Compatibility**: Same address on different chains if parameters match 4. **Upgrade Safety**: Can deploy new version to same address after self-destruct --- ## Important Notes 1. **WETH9 on Ethereum Mainnet**: Cannot be replicated (was CREATE, not CREATE2) 2. **WETH10 on Ethereum Mainnet**: May be replicable if deployed with CREATE2 3. **Bytecode Must Match**: For address matching, bytecode must be identical 4. **Salt Must Match**: If using CREATE2, the salt must be the same 5. **Deployer Must Match**: The deployer address (or factory) must be the same --- ## Recommendation For ChainID 138, we recommend: - **Option 1**: Use CREATE2 for deterministic addresses (new addresses, but predictable) - **Option 2**: Use standard CREATE (current method) for simplicity - **Option 3**: If WETH10 was deployed with CREATE2 on Mainnet, attempt to match the address The choice depends on whether you need: - **Address matching with Mainnet**: Only possible for WETH10 if it was deployed with CREATE2 - **Deterministic addresses**: Use CREATE2 with known salt - **Simplicity**: Use standard CREATE (current method)