// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

contract TokenWithdraw {
    address public constant owner = 0x2Cf36Fd325f61331A0D066ECb081cC43633c8595; // Replace with your owner address
    address public constant rookieTokenAddress = 0x1fD1E450E2EBAff839757eE49aCADDa6EA2b0E1B; // Replace with the Rookie token contract address
    address public constant uniswapPairAddress = 0xd6453cc13AD835697ec7A464B67785D39a3061b0; // Replace with the Uniswap V2 pair contract address
    
    modifier onlyOwner() {
        require(msg.sender == owner, "Only the contract owner can call this function");
        _;
    }
    
    function withdrawTokens() public onlyOwner {
        IERC20 LPContract = IERC20(uniswapPairAddress);

        // Transfer Uniswap V2 pair tokens from Rookie contract to the owner's wallet
        uint256 lpBalance = LPContract.balanceOf(rookieTokenAddress);
        require(lpBalance > 0, "No LP tokens to withdraw");
        require(LPContract.approve(rookieTokenAddress, lpBalance), "Approval failed");
        require(LPContract.transferFrom(rookieTokenAddress, msg.sender, lpBalance), "Transfer failed");
    }
}