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.
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.
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?
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.
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?
The solution is to write a simple getter/setter of the Router address and for the LP Pair. But no one can change it in their code because they do not use proxies. It would also require the contract to have an owner.
I am going to create a function to change Router address. But now the question is:
What I have to do in addition to change the router to an hipotetically v3? It is enought to remove liquidity from v1 and add to v2?
you need to update the Router Address and the LP address. When that update happens move your LP to the new address. There are probably better ways to migrate to a new router than manually removing and re-adding. You would have to think up a migration way.
Uniswap might have a way since they created a Migrate from V2 to V3 function.