// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {Script, console} from "forge-std/Script.sol"; import "../../../contracts/bridge/trustless/SwapBridgeSwapCoordinator.sol"; /** * @title DeploySwapBridgeSwapCoordinator * @notice Deploys SwapBridgeSwapCoordinator for atomic swap-then-bridge flow * @dev Requires ENHANCED_SWAP_ROUTER and UNIVERSAL_CCIP_BRIDGE (or BRIDGE_ORCHESTRATOR) in env */ contract DeploySwapBridgeSwapCoordinator is Script { function run() external { uint256 deployerPrivateKey = vm.envOr("PRIVATE_KEY", uint256(0)); require(deployerPrivateKey != 0, "PRIVATE_KEY not set"); address deployer = vm.addr(deployerPrivateKey); address swapRouter = vm.envAddress("ENHANCED_SWAP_ROUTER"); address bridge = vm.envOr("UNIVERSAL_CCIP_BRIDGE", address(0)); if (bridge == address(0)) { bridge = vm.envOr("BRIDGE_ORCHESTRATOR", address(0)); } require(swapRouter != address(0), "ENHANCED_SWAP_ROUTER not set"); require(bridge != address(0), "UNIVERSAL_CCIP_BRIDGE or BRIDGE_ORCHESTRATOR not set"); vm.startBroadcast(deployerPrivateKey); SwapBridgeSwapCoordinator coordinator = new SwapBridgeSwapCoordinator(swapRouter, bridge); vm.stopBroadcast(); console.log("SwapBridgeSwapCoordinator deployed at:", address(coordinator)); console.log("Export: SWAP_BRIDGE_SWAP_COORDINATOR=%s", vm.toString(address(coordinator))); } }