pancakeswap / pancake-swap-periphery

GNU General Public License v3.0
191 stars 459 forks source link

CREATE2 init code hash is not correct #13

Open preston4896 opened 3 years ago

preston4896 commented 3 years ago

Hi there, as I was trying to call the pairFor() method from the PancakeLibrary to compute the CREATE2 address of a token pair, I noticed that the address did not match the ones returned from the router.

After a closer look, I realized the hardcoded value, see line 24 of Pancake Library does not match the INIT_CODE_PAIR_HASH that was computed by the Factory. You can find the actual value here.

Using the value obtained from BSCscan, it resolves the issue that I had and I was able to get the correct pair address. I thought I would raise this issue for anyone who's also having a hard time with this.

Sam-Devs commented 3 years ago

Hello Preston, you have to change the init hash with a new one.

LaceLetho commented 3 years ago

Thanks for your reminding, encounter the same issue and solved😄