Skip to content
Verified contractExact

Rmlq

Address0xd7ea1b7f45508ced22ad2c39cd0caa48ccb0e3d2
Balance

0 ETH

 

Transactions

86

 

Compiler

solc 0.8.9

 

Same code

2 more contracts

 

Details

Compiler
solc 0.8.9+commit.e5eed63a
Language
solidity
Optimization
No
EVM version
london
License
Not stated
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
17,261,846
Creation transaction
0xb26a8fabb8…a5000f3fee

contracts/Rmlq.sol

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
        );
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "london",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.