0

I bought token via Uniswap which are not unseellable. I read somewhere that we can deploy a contract on the same account of the token for swap the token in eth.

I wrote a code and before deploying it can it work? From Babyben token I want to transfer them to my Eth Fiests

Here is the code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router02.sol";
import "./IERC20.sol";

contract BabyBenTokenHolder {
    address public constant WALLET_ADDRESS = 0xMY_WALLET_ADDRESS;
    address public constant RECIPIENT_ADDRESS = 0xRECIPIENT_TO_ETH_ASSET_ADDDRESS_SAME_AS_WALLET_ADDRESS;
    IERC20 public constant babyBenToken = IERC20(0xe92c3831cE16179E5c6E415387fA8aE07a412A2c); // Scam token contract address
    IUniswapV2Router02 public constant uniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);

    function releaseTokens() external {
        require(msg.sender == WALLET_ADDRESS, "Only the wallet address can release tokens");

        uint256 balance = babyBenToken.balanceOf(address(this));
        require(balance > 0, "No Baby Ben tokens available to release");

        // Approve Uniswap Router to spend Baby Ben tokens
        babyBenToken.approve(address(uniswapRouter), balance);

        // Swap Baby Ben tokens for ETH using Uniswap
        address[] memory path = new address[](2);
        path[0] = address(babyBenToken);
        path[1] = uniswapRouter.WETH();

        uniswapRouter.swapExactTokensForETH(
            balance,
            0,
            path,
            address(this),
            block.timestamp
        );

        // Transfer ETH to the recipient address
        uint256 ethBalance = address(this).balance;
        require(ethBalance > 0, "No ETH received after token swap");

        (bool success, ) = payable(RECIPIENT_ADDRESS).call{value: ethBalance}("");
        require(success, "Failed to send ETH to the recipient");
    }
}

Im writing the contract in Remix IDE I'll deploy it via metamask in my account where holding the scam tokens

It should work?

4
  • unseellable because they are blocked by Uniswap or because there is no liquidity pool for them anymore?! I would recommend to fork the mainnet and try on it before spending money on deployement and loss more tokens and eth
    – Majd TL
    Commented May 11, 2023 at 6:27
  • "Smart contract to get back funds" is missleading. you are trying to trade the token back to weth. with the current price which could be 0
    – Majd TL
    Commented May 11, 2023 at 6:28
  • There is liquidity I see. In uniswap when I m trying to swap back I get something like need to increase slippage. In the contract I see some condition that block selling. This is the contract etherscan.io/address/… Commented May 11, 2023 at 6:55
  • Theorically what Im trying to do it can work? Commented May 11, 2023 at 6:55

1 Answer 1

1

I read somewhere that we can deploy a contract on the same account of the token for swap the token in eth.

Don't believe stuff you read on Internet.

You cannot deploy "a contract on the same account on Ethereum."

3
  • If I deploy the contract via metamask the owner of the contract will be my metamask account Commented May 11, 2023 at 7:53
  • Do you have solution to get back fund that stucked? Commented May 11, 2023 at 7:53
  • No, your funds are gone. Commented May 11, 2023 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.