I'm trying to fork a token contract and deploy it locally using ganache but I keep running into the following error:


I have tried to debug the error using truffle debug 'transaction' and find the following:


Now since there's no assert(), revert(), or require() statement I believe it's an out-of-gas exception error. However, one odd thing I've noticed is that after commenting out those two lines and trying to compile it still throws an error on those lines:


According to this post, comments do not affect the gas cost and I don't see how commented out code could be throwing one of the other errors.

Does anyone know what's going on here?

  • You should provide your Solidity code in question to we can understand the problem.
    – Kiasha
    Commented Apr 27, 2021 at 8:33
  • @Kiasha Hi, the code in question is linked at the very start of the post. I've simply copy pasted that code and then imported its artifact into 1_initial_migration.js and and then attempted to deploy it.
    – Craig
    Commented Apr 27, 2021 at 8:42
  • what means address(0) in constructor?
    – Kiasha
    Commented Apr 27, 2021 at 8:47
  • @Kiasha 0x0000000000000000000000000000000000000000
    – Craig
    Commented Apr 27, 2021 at 8:50
  • Why are you using a function in constructor that never implemented beforehand. I mean .factory() in: uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH());
    – Kiasha
    Commented Apr 27, 2021 at 9:00

1 Answer 1


Just before those lines I see Bonfire creating a pair on Uniswap. Did you deployed that contract as well on Ganache? is Ganache forking mainnet?

IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);

// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
            .createPair(address(this), _uniswapV2Router.WETH());
  • 1
    I haven't deployed that contract on Ganache or forked the mainnet. I suppose that is likely the error then?
    – Craig
    Commented Apr 27, 2021 at 8:54
  • Probably and this could explain the out-of-gas error. Commented Apr 27, 2021 at 9:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.