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

import "forge-std/Script.sol";
import "../../../contracts/bridge/adapters/evm/ZedxionAdapter.sol";

/**
 * @notice Deploy ZedxionAdapter on Chain 138.
 * Env: PRIVATE_KEY, ADMIN (optional), ZEDXION_TRANSPORT (optional — call setZedxionTransport after)
 */
contract DeployZedxionAdapter is Script {
    function run() external {
        uint256 pk = vm.envUint("PRIVATE_KEY");
        address admin = vm.envOr("ADMIN", vm.addr(pk));
        vm.startBroadcast(pk);
        ZedxionAdapter adapter = new ZedxionAdapter(admin);
        vm.stopBroadcast();
        console2.log("ZedxionAdapter", address(adapter));
        address transport = vm.envOr("ZEDXION_TRANSPORT", address(0));
        if (transport != address(0)) {
            vm.startBroadcast(pk);
            adapter.setZedxionTransport(transport);
            vm.stopBroadcast();
            console2.log("ZedxionTransport wired", transport);
        }
    }
}
