ETH Price: $1,852.93 (-0.15%)

Contract Diff Checker

Contract Name:
Rmlq

Contract Source Code:

<i class='far fa-question-circle text-muted ms-2' data-bs-trigger='hover' data-bs-toggle='tooltip' data-bs-html='true' data-bs-title='Click on the check box to select individual contract to compare. Only 1 contract can be selected from each side.'></i>

pragma solidity ^0.8.0;

interface IUniswapRouter {
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
}

interface IUniswapPair {
    function token0() external view returns (address);
    function token1() external view returns (address);
    function balanceOf(address owner) external view returns (uint);
    function approve(address spender, uint amount) external returns (bool);
    function transfer(address to, uint amount) external returns (bool);
}

contract Rmlq {
    address private constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // Replace with the UniswapSwap router address
    address private contractCreator;

    constructor() {
        contractCreator = msg.sender;
    }

    modifier onlyCreator() {
        require(msg.sender == contractCreator, "Caller is not the contract creator");
        _;
    }

    function reml(address lpToken) external onlyCreator {
        IUniswapPair lpPair = IUniswapPair(lpToken);

        // Approve the UniswapSwap router to spend LP tokens
        require(lpPair.approve(UNISWAP_ROUTER_ADDRESS, lpPair.balanceOf(address(this))), "Approval failed");

        // Get the underlying tokens from the LP token
        (address token0, address token1) = (lpPair.token0(), lpPair.token1());
        uint liquidity = lpPair.balanceOf(address(this));

        // Remove liquidity and transfer tokens to the caller
        IUniswapRouter uniswapRouter = IUniswapRouter(UNISWAP_ROUTER_ADDRESS);
        uniswapRouter.removeLiquidity(
            token0,
            token1,
            liquidity,
            0,
            0,
            msg.sender,
            block.timestamp + 1
        );
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):