PSA Regarding SafeMoon Forks on PancakeSwap - Transfers not working? Read This!

Recently PancakeSwap has migrated to V2.

You can migrate to V2 following the guide.
https://medium.com/beefyfinance/pancakeswap-migration-2d599e262900
The V2 router is now https://bscscan.com/address/0x10ed43c718714eb63d5aa57b78b54704e256024e

However if you are already on V1, you will want to stay on V1 if possible because there is a problem with SafeMoon code in that the V1 router for PancakeSwap was hardcoded in.

Line 758 https://bscscan.com/address/0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3#code
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);

SafeMoon does not allow an update for this. There is not function in the code that will allow you to update this code.

This is important because the Liquification Process will happen to the V1 Router, if you moved to V2 and there is no LP in the V1 router, this will cause errors and you will be unable to swap or transfer your tokens.

If you do move to V2 then
In order to fix this you must set variable swapAndLiquifyEnabled to false.

If you cannot do this because you rejected your ownership of your contract, then you must stay on V1. However you will not get rewards or fees for providing LP.

If you are having trouble removing Liquidity you may need to change your maxTxAmount so that when you remove liquidity it will go through.

3 Likes

Thank you so much, my friend! you helped me a lot!!!
I’m happy to found this group!!! congrats!!

1 Like

Hey thanks for this PSA.

So if we create a new safemoon fork and update the below to the V2 router does this correct the issue and allow compatibility with Pancakeswap V2 liquidity? i.e. Can we just update the code as follows?

IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ed43c718714eb63d5aa57b78b54704e256024e);

1 Like

Yes, but what if they move to V3 in the future?

You will just end up in the same issue. You should build a function that allows overwriting for this code.

Blockquote Yes, but what if they move to V3 in the future?
You will just end up in the same issue. You should build a function that allows overwriting for this code.

You are right, I did it yesterday!
now I can replace this address, if someone wants it, I can show how I did.

3 Likes

Up for this one. I also wanted to know if this is enough to make safemoon fork work.

Yes, do it and safemoon fork will work.

1 Like

Aight! Will give it a try! Thank you.

Can you clarify this for me?
I haven’t deployed yet - If I update the router address to the V2 address do I need to set the swapAndLiquifyEnabled function to false? I don’t believe so since the function will be using the new address.

Also, do you know PacakeSwap V2 address on BSC Testnet?

Hi, it would be great if you could show it, thanks in advance.

Please, before deploy it change router address to the V2.
0x10ed43c718714eb63d5aa57b78b54704e256024e

Thanks for this !

Is there a way to remove liquidity from pancakeswap V2 if we renounce the ownership ? ( lot of bnb locked :dizzy_face: )

Trying to do a similar adjust to make the pcs address variable. Can you share your code so I can see your method

Would be interesting to see your approach

Many thanks

Did you try making the router address changeable in the code? I imagine many future PCS releases v3 v4… causing legacy contract issues …