Changing Factory address for AMM DEX


I am using the Pancakeswap fork and I need to deploy a new factory contract and I would like to know if I need to deploy also the router or it is enough to deploy the factory contract? After that, I wanted to migrate from the old factory to the new factory.

The factory contract is a core contract, whereas a router contract is peripherical. Upgrading a factory contract does not need to upgrade the router contract.

Yeah, but I need to change the factory address in the router too otherwise, I will be not able to use it. I've checked that and it is not possible to change the factory address on router therefore I need to deploy a new one or I am wrong?

In that case, yes, you'll need to deploy a new router contract, since factory is an immutable variable and it cannot be changed once the contract has been deployed.