Smart Contract Refund Eth

hello good afternoon dilierm i had a question i opened a token on etherscan but i sent my eth and token to the contract address the open trading command is not working and I can't withdraw my contract coins can you help ?
Contract Adress

Hello @sqardsqard
I just checked your contract source code.
As I checked, it seems there is issue on manualSwap or openTrading function.
Did you unit test before deploy and verify contract?

yes, I get errors while opentrading, I verified my contract, I even tried to create a create pair via the remic ide, but I couldn't solve it

Both of your attempts to execute function createPair have failed:
image
Any subsequent attempt to execute a function which relies on this, is likely to fail just as well...

yes, but I can't create a new create pair,I can't do open trading, but it's necessary to create a pair with the contract open trading command, but I still have contract eth and tokens because open trading doesn't work. The error I got while trying out the remix is the Uniswap Exits error is there a solution to this contract can I withdraw eth and tokens back to my owner wallet?

The pair (WETH and your contract address) seems to already exist:
image

Which means that you cannot execute function createPair on this pair again.
Which means that you cannot execute function openTrading to completion.

You can view this on the Uniswap V2 Factory Contract, by entering on the getPair function:

  • 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
  • 0x292628413f836cf5565dcaB68B47c7596FdA4CB0

Would I be right to guess that you've created this pair directly through that contract?

so can I add the token and eth I have sent to the smart contract to this pair address?

Well, no, because:

function openTrading() external onlyOwner() {
    require(!tradingOpen,"trading is already open");
    uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
    _approve(address(this), address(uniswapV2Router), _tTotal);
    uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
    uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
    IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
    swapEnabled = true;
    tradingOpen = true;
}

As you can see, this function initializes a bunch of contract-level (state) variables which are required in those other functions (the ones which allow you to add liquidity through the contract, etc).

So you should create the pair (or - I suppose - should have created the pair) through this function any not by any other means.

I have to admit that all of these questions are a bit weird when coming from the person who deployed this contract. Are you really the one who wrote it? If not, then I suppose that you can consider the ETH spent here as your tuition fee on this "crash course".