1

I wrote a smart contract which interacts with the Pancakeswap/Uniswap interface in order to swap tokens at Pancakeswap. My problem is that I can deploy the contract but the swapping functions are not working (transfers are fine between wallets) and I can't debug it with Remix. I spent the whole day experimenting with Hardhat where I could deploy my contract as well, but I was not able to run tests with the JS file, because it reverted where I call the createPair() function of the Uniswap interface. As the error is:

Transaction reverted: function call to a non-contract account

I assume the problem is I am trying to initialize the router from a test network which doesn't have the address of the Pancakeswap router/factory, therefore it detects the address invalid.. Other detail is the function which causes the issue is working perfectly when I deploy it on the Smart Chain. My question is what's the recommended protocol for debugging complicated smart contracts what are utilizing the Pancakeswap/Uniswap interface? Do I have to test features like token pairing and swapping always on the "main net"?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.