Detailed answer
Professional blockchain deployments use automated, reproducible deployment scripts — never manual Remix deploys. Foundry scripts provide Solidity-based deployment with environment variable configuration. Hardhat Ignition offers JavaScript/TypeScript deployment with complex dependency graphs. Always verify initialization, proxy implementation, and multisig ownership after deployment. Run test transactions before announcing production deployment.
Foundry Deployment Script
// script/Deploy.s.sol
// Run: forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast --verify
contract DeployScript is Script {
function run() external {
uint256 deployerKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
address deployer = vm.addr(deployerKey);
console.log("Deploying from:", deployer);
console.log("Chain ID:", block.chainid);
vm.startBroadcast(deployerKey);
TokenVault vault = new TokenVault();
console.log("TokenVault deployed:", address(vault));
bytes memory initData = abi.encodeWithSelector(
TokenVault.initialize.selector,
deployer,
address(usdc),
500
);
ERC1967Proxy proxy = new ERC1967Proxy(address(vault), initData);
console.log("Proxy deployed:", address(proxy));
TokenVault(address(proxy)).setKeeper(keeper);
console.log("Keeper set:", keeper);
vm.stopBroadcast();
_writeDeployment(block.chainid, address(proxy), address(vault));
}
}Multi-Chain Deployment Script
#!/bin/bash
# deploy-all.sh: Deploy to multiple chains in sequence
set -e
CHAINS=("arbitrum" "optimism" "base" "polygon")
CHAIN_IDS=(42161 10 8453 137)
for i in "${!CHAINS[@]}"; do
CHAIN="${CHAINS[$i]}"
echo "Deploying to $CHAIN..."
forge script script/Deploy.s.sol \
--rpc-url $(eval echo \$${CHAIN^^}_RPC_URL) \
--broadcast \
--verify \
--etherscan-api-key $(eval echo \$${CHAIN^^}_ETHERSCAN_KEY)
echo "Deployed to $CHAIN successfully"
doneAdditional questions
Should we use Foundry scripts or Hardhat Ignition for production?
Both are production-ready. Foundry scripts: better for teams already using Foundry for testing (single toolchain). Hardhat Ignition: better for teams with existing Hardhat codebases, complex deployment graphs with many interdependencies, or teams that prefer JavaScript/TypeScript tooling. The most important property of either: idempotent deployments (running the script twice doesn't deploy twice).