Why does SafeMoon have references to Uniswap instead of Pancakeswap?

I don’t know if I am totally correct or totally wrong, but in the solidity code of Safemoon, it mentions that it only adds the liquidity to uniswap as its a ERC20 token. There is no mention on pancakeswap in the whole code and the send liquidity function contains only uniswap.

image

Also, on the other hand, the address provided in the uniswap variable belongs to pancakeswap. Not sure why they used the variable as “Uniswap” and then inserted a address belonging to somewhere else.

Hi Jidnyesh! Welcome to Open Zeppelin.

Please make new topics with specific questions if it’s a different question. I’ve made your post into a new one.

The reason why it references uniswapV2Router is because Pancakeswap V1 is effectively the same thing as Uniswap V2, just on different networks. So when SafeMoon created their contract code, they didn’t bother to rename it.

It still works just fine with Pancakeswap V1.

As DEXes update, you may need to update their router code. For example here is Uniswap V3 has many contracts you might want to reference if you plan to do something with their pool

And now when Pancakswap V1 is almost depreciated, how can I change it to Pancakswap V2, as I am creating a BEP20 token I cannot use uniswap.

It does not matter the name. It still functions correctly with Pancakeswap V2, even if the name of the variable references Uniswap. This is because the router interface (code for the router) is the same, or very similar between Uniswap and Pancakeswap.

You must change the router address in your contract to the correct router address of Pancakeswap V2.

Please search the forum for solutions to your questions on Safemoon first.

You can check here:

The differences are really few as you can see

2 Likes

Can you explain how is this related to the question?
Which two codes do you want me to compare?

You said this

I sent the link that shows that you can still use pancake v1 interface because there is nay important difference from v2.

2 Likes

To be honest I believe the explanation is quite simple. The original devs didnt know much about solidity, they took parts of code from other contracts and glued it together. For example the transferTokens has so much redundant code…

1 Like