Prerequisites
Before deploying to L1, ensure you have:- Hardhat environment configured
- Private key with sufficient L1 native tokens for gas
- Network RPC endpoint configured
- Verified contract addresses for:
- OmniBridge
- Wrapped token (e.g., WETH)
- Multisig address
Configuration
Update theconfig.js file with your L1 network parameters:
config.js
Network Examples
- Ethereum Mainnet
- BSC
Deployment Process
Generate Deterministic Address
The deployment script uses CREATE2 to calculate the deterministic address before deployment:The address is computed from:
- SingletonFactory address
- Salt value
- Contract bytecode with constructor arguments
Check Existing Deployment
The script automatically checks if the contract is already deployed:This prevents accidental re-deployment and wasted gas.
Deploy via SingletonFactory
Deploy the contract using the SingletonFactory:The deployment uses:
- Fixed gas limit: 3,000,000
- Deterministic salt from config
- Pre-computed bytecode with constructor parameters
Deployment Script
Thescripts/deployL1Unwrapper.js script handles the deployment:
scripts/deployL1Unwrapper.js
L1Unwrapper Contract
The L1Unwrapper contract receives wrapped tokens from the bridge and unwraps them to native tokens before sending to the recipient.Constructor Parameters
_omniBridge: Address of the OmniBridge contract on L1_weth: Address of the wrapped token (WETH, WBNB, etc.)_multisig: Multisig address for emergency operations
Key Functions
The L1Unwrapper must be set as the recipient in the bridge call data for proper operation. See contracts/TornadoPool.sol:275-279 for the implementation.
Verification
After deployment, verify the contract functionality:- Check contract code: Ensure bytecode is deployed
- Verify constructor args: Confirm correct parameters
- Test unwrapping: Perform a test transaction (on testnet first)
- Record address: Save the deployed address for L2 configuration
Troubleshooting
Contract Already Deployed
If you see “Contract already deployed. Skipping…”:- The contract exists at the deterministic address
- No action needed unless you need to change constructor parameters
- To deploy with different parameters, change the salt value
Gas Estimation Failed
- Ensure your account has sufficient ETH for gas
- Check network congestion and adjust gas price
- Verify SingletonFactory exists at the configured address
Verification Failed
- Confirm constructor arguments match deployment
- Check Etherscan API key in
.env - Ensure contract source matches deployed bytecode