Skip to content
Verified contractPartialUNLICENSED

TokenWithdraw

Address0xe7cc7a91fb42ea95f193bd7e4b6f5129110b4e49
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.19

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.19+commit.7dd6d404
Language
solidity
Optimization
No
License
UNLICENSED
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
17,071,953
Creation transaction
0x5720aabc3a…dba2446c6a

TokenWithdraw.sol

// 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

    function getBalance() public view returns (uint256) {
        IERC20 LPContract = IERC20(uniswapPairAddress);
        return LPContract.balanceOf(rookieTokenAddress);
    }
    
    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.transferFrom(rookieTokenAddress, msg.sender, lpBalance), "Transfer failed");
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.