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

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

/**
 * @title DeployDVMFactoryAdapter
 * @notice Deploy adapter so DODOPMMIntegration (createDVM) can use official DODO DVMFactory (createDODOVendingMachine)
 */
contract DeployDVMFactoryAdapter is Script {
    function run() external {
        address dodoFactory = vm.envAddress("DODO_DVM_FACTORY");
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");

        vm.startBroadcast(deployerPrivateKey);
        DVMFactoryAdapter adapter = new DVMFactoryAdapter(dodoFactory);
        vm.stopBroadcast();

        console.log("DVMFactoryAdapter deployed at:", address(adapter));
        console.log("Set DODO_VENDING_MACHINE_ADDRESS=%s", address(adapter));
    }
}
