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

import {Script, console} from "forge-std/Script.sol";
import {CCIPRelayBridge} from "../contracts/relay/CCIPRelayBridge.sol";
import {CCIPRelayRouter} from "../contracts/relay/CCIPRelayRouter.sol";

/// @notice Deploy WETH inbound CCIPRelayBridge on Chain 138 and authorize on existing relay router.
contract DeployChain138WethRelayBridge is Script {
    function run() external {
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
        address weth9 = vm.envAddress("WETH9");
        address relayRouter = vm.envAddress("CCIP_RELAY_ROUTER_CHAIN138");

        vm.startBroadcast(deployerPrivateKey);

        CCIPRelayBridge bridge = new CCIPRelayBridge(weth9, relayRouter);
        console.log("Chain138 WETH CCIPRelayBridge:", address(bridge));

        CCIPRelayRouter(relayRouter).authorizeBridge(address(bridge));
        console.log("Authorized on CCIPRelayRouter:", relayRouter);

        vm.stopBroadcast();
    }
}
