Withdraw liquidity from PancakeSwap?

Hello. I have created a token(around 7 days ago), added liquidity on PancakeSwap and it was trading, everything was working fine. 23 April morning I withdrew liquidity and added it on PancakeSwap V2. Then, it was announced to withdraw liquidity from V2 PancakeSwap because there was a bug and when I tried to do it nothing happened. PancakeSwap developers said that there is a problem with Hardcode and that my token is linked with PancakeSwapRouter1. What can I do to withdraw liquidity?
Liquidity pair contract: 0x6d4d749c8763bcf4690a10f5e0297194059bb98a
Token contract: 0x1771ad5b28549467ad5fe68e9f271667a5930a2e

Code: https://bscscan.com/address/0x1771ad5b28549467ad5fe68e9f271667a5930a2e#code

Looks like lots of people are having similar problems.

Here are the steps I would take.

First go to your tokens contracts

https://bscscan.com/address/0x1771ad5b28549467ad5fe68e9f271667a5930a2e#writeContract
https://bscscan.com/address/0x6d4d749c8763bcf4690a10f5e0297194059bb98a#writeContract

You will need to approve a lot of the token (as much as you have provided liquidity) using the router address here.
https://bscscan.com/address/0x05ff2b0db69458a0750badebc4f9e13add608c7f#writeContract

From this contract you will need to try every single Remove Liquidity function.

removeLiquidity
removeLiquidityETH
removeLiquidityETHSupportingFeeOnTransferTokens

I don’t think the WithPermit functions apply here, so one of these 3 functions will work.
For deadline you need to get the UNIX timestamp from here.
https://www.unixtimestamp.com/

1 Like

Same issue for me, I hardcoded PS v1 router address in my contract - the v2 address is not to be found anywhere (that’s crazy) not to mention the lack of doc and warning for the devs on their website.

So, I added V2 liquidity for my ERC20 token but no one could swap it! I am now trying to recover the liquidity I injected for the token but it is not possible…

If anyone could help that would be super!

PS: I gave up ownership of the token…

I have the same issue, needs help to recover liquidity!

I checked it and it doesn’t work ;(

Metamask error:
“ALERT: Transaction error. Exception in the contract code.”

So you’re saying none of those functions worked for you? This might be a better question for PancakeSwap itself. These 3 functions should work, but perhaps not with how PancakeSwap has changed.

Can you show me your approval transaction?

I loose 1 BNB with it!
Did you recover something? I don’t know what I need to do!

1 Like

I worked with some people offline, check your MaxTx amount in your code.

If you are able to, set the max tx amount to max when removing liquidity.

2. _maxTxAmount: 1000000000000000000000000 uint256

Is it normal that Pancakeswap router V2 wants 0.2 Bnb gas fees for a write contract action

Hi, welcome! :wave:

I am not sure, maybe you can ask for Pancakeswap team for help.

No it is not. You likely have another error when withdrawing.

It is very urgent. I cannot remove the liquidity right now. I accidentally abandon the ownership of my contract. Is there any way to remedy it?

found any one solution?

I had the same issue, managed to get the liquidity back from PancakeSwap v1, then added it to v2 correctly. The whole problem seems to stem from setting the wrong IUniswapV2Router02 in the contract constructor. I copied the router address after seeing it in multiple threads and other forums too, should have spent a little more time to double check the address.

I had 1 BNB plus 90% of my token supply in v1 so I really wanted to get it back.

Here is how I got my BNB and tokens back (hope it helps):

From remix, go to the deploy and run section, then under deployed contracts you can see the token contract that you deployed to mainnet (you can also do this under the contract → write tab in your contract on bscscan but will probably need to verify the contract first).

These are the methods I called:

excludeFromFee: 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F
setLiquidityPercent: 0
setTaxFeePercent: 0
setMaxTxPercent: 100
swapAndLiquifyEnabled: false

I think the issue was the fees for liquidity and tax.

I used pancakeswap v1 in the browser to remove liquidity. You probably won’t see your liquidity at first, but paste in your token’s contract address and make sure your wallet is connected with the account that holds the LP tokens.

Once you see your pair, set the remove liquidity to 100%. You will probably leave 1 single token on the v1 but that is it (got 0.9999 BNB back plus the rest of the tokens). You will be requested to sign first, after accepting then click the remove and then you can approve the transaction.

If you add liquidity to Pancake v2 after this, you will need to keep swapAndLiquifyEnabled set to false, otherwise nobody can purchase your token, still trying to figure this part out :frowning:

The bad news:
Since the router is hard coded in the safemoon contract, you will probably need to deploy a new token to mainnet if you want the liquidity fee to go back to the v2 liquidity pool as the swapTokensForEth function uses the hard coded router address.

Pancakeswap V2 router (looks correct but double check it… I found this in my browser console under network requests):
0x10ED43C718714eb63d5aA57B78B54704E256024E

Who is the pancakeswap team?

If you can't remove liquidity pool from PancakeSwap, I can help you if you are the one who create that token, or if you can contact with that token's dev team. I have got a trouble too, my liquidity pool is looked, no one can swap token or add/remove pool. It is usually happened if you copy the contract of Safemoon. Now I have the solution, and I have took back my BNB, you can check here: https://bscscan.com/token/0x2aecde1c5f63cab2d405c61003c78d225c05a434.

If you guys need help, you can contact me at: chienthancantho@gmail.com or telegram @dekhisugireal

Thanks for reading guys!

When remove your LP please flow task:

1- Change received BNB to WBNB
2- Enable & Confirm

It's success.

If you like it ,can donate to me :slight_smile:

0xc48C452047E8Ab433D768E4A4E654ceb101bc8A1

1 Like

Hi

I can fix it, If you an not remove LP or members can not buy or sell your toke.

I can update anything on your bep20 token, If you made it on remix.etherum

telegram: bnbtoken22

Regards