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

/**
 * @title DVMFactoryAdapter
 * @notice Wraps DODO DVMFactory.createDODOVendingMachine as createDVM for DODOPMMIntegration
 * @dev DODOPMMIntegration expects IDODOVendingMachine.createDVM(); official DODO uses createDODOVendingMachine.
 */
interface IDVMFactoryOfficial {
    function createDODOVendingMachine(
        address baseToken,
        address quoteToken,
        uint256 lpFeeRate,
        uint256 i,
        uint256 k,
        bool isOpenTWAP
    ) external returns (address newVendingMachine);
}

contract DVMFactoryAdapter {
    IDVMFactoryOfficial public immutable dodoFactory;

    constructor(address _dodoFactory) {
        require(_dodoFactory != address(0), "zero factory");
        dodoFactory = IDVMFactoryOfficial(_dodoFactory);
    }

    function createDVM(
        address baseToken,
        address quoteToken,
        uint256 lpFeeRate,
        uint256 i,
        uint256 k,
        bool isOpenTWAP
    ) external returns (address dvm) {
        return dodoFactory.createDODOVendingMachine(baseToken, quoteToken, lpFeeRate, i, k, isOpenTWAP);
    }
}
