// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {Script, console} from "forge-std/Script.sol";
import {CCIPRouter} from "../contracts/ccip/CCIPRouter.sol";
import {CCIPWETH9Bridge} from "../contracts/ccip/CCIPWETH9Bridge.sol";

/// @notice Event-only send router + WMON bridge on Monad for Monad→138 relay lane.
contract DeployMonad138OutboundLane is Script {
    function run() external {
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
        address deployer = vm.addr(deployerPrivateKey);
        address wmon = vm.envAddress("WETH9_MONAD");
        address feeToken = vm.envOr("CCIP_FEE_TOKEN", address(0));
        uint64 chain138Selector = uint64(vm.envUint("CHAIN138_SELECTOR"));

        console.log("Deployer:", deployer);
        console.log("WMON:", wmon);
        console.log("Fee token (0=native MON):", feeToken);

        vm.startBroadcast(deployerPrivateKey);

        CCIPRouter router = new CCIPRouter(feeToken, 0, 0);
        console.log("Monad event-only CCIPRouter:", address(router));

        router.addSupportedChain(chain138Selector);

        CCIPWETH9Bridge bridge = new CCIPWETH9Bridge(address(router), wmon, feeToken);
        console.log("Monad outbound CCIPWETH9Bridge:", address(bridge));

        vm.stopBroadcast();
    }
}
