{
    "Function": "slitherConstructorConstantVariables",
    "File": "src/LamboVEthRouter.sol",
    "Parent Contracts": [
        "lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol",
        "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
        "lib/openzeppelin-contracts/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract LamboVEthRouter is Ownable, ReentrancyGuard {\n    using SafeERC20 for IERC20;\n\n    address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n    uint256 public constant feeDenominator = 10000;\n\n    uint256 public feeRate;\n    address public immutable vETH;\n\n    event BuyQuote(address quoteToken, uint256 amountXIn, uint256 amountXOut);\n    event SellQuote(address quoteToken, uint256 amountYIn, uint256 amountXOut);\n    event UpdateFeeRate(uint256 newFeeRate);\n\n    constructor(address _vETH, address _multiSign) public Ownable(_multiSign) {\n        require(_vETH != address(0), \"Invalid vETH address\");\n\n        feeRate = 100;\n        vETH = _vETH;\n    }\n\n    function updateFeeRate(uint256 newFeeRate) external onlyOwner {\n        require(newFeeRate <= feeDenominator, \"Fee rate must be less than or equal to feeDenominator\");\n        feeRate = newFeeRate;\n        emit UpdateFeeRate(newFeeRate);\n    }\n\n    function createLaunchPadAndInitialBuy(\n        address lamboFactory,\n        string memory name,\n        string memory tickname,\n        uint256 virtualLiquidityAmount,\n        uint256 buyAmount\n    ) public payable nonReentrant returns (address quoteToken, address pool, uint256 amountYOut) {\n        require(VirtualToken(vETH).isValidFactory(lamboFactory), \"only Validfactory\");\n        (quoteToken, pool) = LamboFactory(lamboFactory).createLaunchPad(\n            name,\n            tickname,\n            virtualLiquidityAmount,\n            address(vETH)\n        );\n\n        amountYOut = _buyQuote(quoteToken, buyAmount, 0);\n    }\n\n    function getBuyQuote(address targetToken, uint256 amountIn) public view returns (uint256 amount) {\n        // TIPs: ETH -> vETH = 1:1\n        (uint256 reserveIn, uint256 reserveOut) = UniswapV2Library.getReserves(\n            LaunchPadUtils.UNISWAP_POOL_FACTORY_,\n            vETH,\n            targetToken\n        );\n\n        // Calculate the amount of Meme to be received\n        amountIn = amountIn - (amountIn * feeRate) / feeDenominator;\n        amount = UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);\n    }\n\n    function getSellQuote(address targetToken, uint256 amountIn) public view returns (uint256 amount) {\n        // TIPS: vETH -> ETH = 1: 1 - fee\n        (uint256 reserveIn, uint256 reserveOut) = UniswapV2Library.getReserves(\n            LaunchPadUtils.UNISWAP_POOL_FACTORY_,\n            targetToken,\n            vETH\n        );\n\n        // get vETH Amount\n        amount = UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);\n        amount = amount - (amount * feeRate) / feeDenominator;\n    }\n\n    function buyQuote(\n        address quoteToken,\n        uint256 amountXIn,\n        uint256 minReturn\n    ) public payable nonReentrant returns (uint256 amountYOut) {\n        amountYOut = _buyQuote(quoteToken, amountXIn, minReturn);\n    }\n\n    function sellQuote(\n        address quoteToken,\n        uint256 amountYIn,\n        uint256 minReturn\n    ) public nonReentrant returns (uint256 amountXOut) {\n        amountXOut = _sellQuote(quoteToken, amountYIn, minReturn);\n    }\n\n    //  ====================  internal ====================\n    function _sellQuote(\n        address quoteToken,\n        uint256 amountYIn,\n        uint256 minReturn\n    ) internal returns (uint256 amountXOut) {\n        IERC20(quoteToken).safeTransferFrom(msg.sender, address(this), amountYIn);\n\n        address pair = UniswapV2Library.pairFor(LaunchPadUtils.UNISWAP_POOL_FACTORY_, quoteToken, vETH);\n        (uint256 reserveIn, uint256 reserveOut) = UniswapV2Library.getReserves(\n            LaunchPadUtils.UNISWAP_POOL_FACTORY_,\n            quoteToken,\n            vETH\n        );\n\n        // Calculate the amount of vETH to be received\n        amountXOut = UniswapV2Library.getAmountOut(amountYIn, reserveIn, reserveOut);\n\n        // Transfer quoteToken to the pair\n        IERC20(quoteToken).safeTransfer(pair, amountYIn);\n\n        // Perform the swap\n        (uint256 amount0Out, uint256 amount1Out) = quoteToken < vETH\n            ? (uint256(0), amountXOut)\n            : (amountXOut, uint256(0));\n        IUniswapV2Pair(pair).swap(amount0Out, amount1Out, address(this), new bytes(0));\n\n        // Convert vETH to ETH and send to the user\n        VirtualToken(vETH).cashOut(amountXOut);\n\n        // caculate fee\n        uint256 fee = (amountXOut * feeRate) / feeDenominator;\n        amountXOut = amountXOut - fee;\n        require(amountXOut >= minReturn, \"Insufficient output amount. MinReturn Error.\");\n\n        // handle amountOut\n        (bool success, ) = msg.sender.call{value: amountXOut}(\"\");\n        require(success, \"Transfer to User failed\");\n\n        // handle fee\n        (success, ) = payable(owner()).call{value: fee}(\"\");\n        require(success, \"Transfer to owner() failed\");\n\n        // Emit the swap event\n        emit SellQuote(quoteToken, amountYIn, amountXOut);\n    }\n\n    function _buyQuote(address quoteToken, uint256 amountXIn, uint256 minReturn) internal returns (uint256 amountYOut) {\n        require(msg.value >= amountXIn, \"Insufficient msg.value\");\n\n        // handle fee\n        uint256 fee = (amountXIn * feeRate) / feeDenominator;\n        amountXIn = amountXIn - fee;\n        (bool success, ) = payable(owner()).call{value: fee}(\"\");\n        require(success, \"Transfer to Owner failed\");\n\n        // handle swap\n        address pair = UniswapV2Library.pairFor(LaunchPadUtils.UNISWAP_POOL_FACTORY_, vETH, quoteToken);\n\n        (uint256 reserveIn, uint256 reserveOut) = UniswapV2Library.getReserves(\n            LaunchPadUtils.UNISWAP_POOL_FACTORY_,\n            vETH,\n            quoteToken\n        );\n\n        // Calculate the amount of quoteToken to be received\n        amountYOut = UniswapV2Library.getAmountOut(amountXIn, reserveIn, reserveOut);\n        require(amountYOut >= minReturn, \"Insufficient output amount\");\n\n        // Transfer vETH to the pair\n        VirtualToken(vETH).cashIn{value: amountXIn}(amountXIn);\n        IERC20(vETH).safeTransfer(pair, amountXIn);\n\n        // Perform the swap\n        (uint256 amount0Out, uint256 amount1Out) = vETH < quoteToken\n            ? (uint256(0), amountYOut)\n            : (amountYOut, uint256(0));\n        IUniswapV2Pair(pair).swap(amount0Out, amount1Out, msg.sender, new bytes(0));\n\n        if (msg.value > (amountXIn + fee + 1)) {\n            (bool success, ) = payable(msg.sender).call{value: msg.value - amountXIn - fee - 1}(\"\");\n            require(success, \"ETH transfer failed\");\n        }\n\n        emit BuyQuote(quoteToken, amountXIn, amountYOut);\n    }\n\n    receive() external payable {}\n}"
}