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

import {Script, console} from "forge-std/Script.sol";
import {DODOIntegrationExternalUnwinder} from "../../contracts/flash/DODOIntegrationExternalUnwinder.sol";

/**
 * @title DeployDODOIntegrationExternalUnwinder
 * @notice Deploy DODOIntegrationExternalUnwinder (unwind via another registered PMM pool).
 *
 * Env:
 *   PRIVATE_KEY                    required
 *   DODO_PMM_INTEGRATION_MAINNET   required (same integration as quote-push source pool)
 *
 * Usage:
 *   forge script script/deploy/DeployDODOIntegrationExternalUnwinder.s.sol:DeployDODOIntegrationExternalUnwinder \
 *     --rpc-url $ETHEREUM_MAINNET_RPC --broadcast -vvvv
 */
contract DeployDODOIntegrationExternalUnwinder is Script {
    function run() external {
        uint256 pk = vm.envUint("PRIVATE_KEY");
        address integration = vm.envAddress("DODO_PMM_INTEGRATION_MAINNET");
        address deployer = vm.addr(pk);

        console.log("Deployer:", deployer);
        console.log("DODO PMM integration:", integration);

        vm.startBroadcast(pk);
        DODOIntegrationExternalUnwinder unwinder = new DODOIntegrationExternalUnwinder(integration);
        vm.stopBroadcast();

        console.log("DODOIntegrationExternalUnwinder:", address(unwinder));
    }
}
