Hi. I posted the question before as well but it didnt solve my problem. I am trying to add liquidity on pancakeswap using this script. When I run the script using pancakeswap's own router and factory address I am successful but when I try to do the same with the address on which my router and factory are deployed after running truffle migrate command I always get a hijacked stack error.
@Yoshiko I have verified both the router and factory contracts on bsc testnet now. The router address now is ‘0x73D58041eDdD468e016Cfbc13f3BDc4248cCD65D’ and the factory address now is ‘0x81338c4e7a7f30297aF1dd1dBF02Fc1299b0EA12’ so if you do test it, then test with the given addresses
I also noticed that you commented out the Remove Liquidity Functions and the Swap functions.
I think in order to first build your own swapper, you should start from their base code and work your way up. Just copy and paste it, upload to a new address in its exactness, then get it to work, then make your modifications.
That’s really unusual. I highly recommend doing the hardhat tutorial and going through it. At the end of it you will have a dev environment set up where you can deploy easily and test easily. Perhaps there is something wrong in the configuration.
Okay after spending days on this issue I came to know that I was just changing the init_hash once before multiple deployments over testnet. The init_hash changes everytime, so you have to copy the init_hash from pancake pair file into pancake library each time. After doing so I was able to successfully add liquidity using my own router and factory address over bsc testnet.
i dont have anything called init_hash from pancake pair file. Am running into the same problem.
Firtly, How exactly should i calculate the init_hash? Can you please share example init_hash?
(I have INIT_CODE_PAIR_HASH in PancakeFactory though. When should i execute that code anyway?)
If i get it after deploying factory contract, i get ‘0xcfa13…’ noticeably starts with 0x and i can’t put in in hex’’.
Secondly, is it must to verify the contracts on bscscan testnet of deployed contracts?
Compile pancakeFactory.sol and then copy the value of INIT_CODE_PAIR_HASH. Paste this value in pairFor method located in pancakePair library. While pasting you have to omit the 0x and paste the rest of the hex value.
And no, it is not necessary to verify contracts. It’s your choice. The benefits of verifying a contract are that the people and specially developers can see the code of the smart contract they want to interact with and this develops trust.
Secondly, you can call the functions of the contract directly from there instead of using an IDE and that saves times.
Hi all, I have try to deploy the factory and router, and I follow the explanation to change the INI_HASH on the router pairFor function. But I still can’t get it to work, and it still give me error execution reverted…
Can anyone share the working deployment on Testnet so that I can have a look?