1

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

error

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

debug

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:

debug2

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?

Craig
  • 113
  • 4
  • You should provide your Solidity code in question to we can understand the problem. – Kiasha Apr 27 '21 at 08: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 Apr 27 '21 at 08:42
  • what means address(0) in constructor? – Kiasha Apr 27 '21 at 08:47
  • @Kiasha 0x0000000000000000000000000000000000000000 – Craig Apr 27 '21 at 08: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 Apr 27 '21 at 09:00
  • @Kiasha I'm not entirely sure. I thought maybe it's implemented here https://bscscan.com/address/0x05ff2b0db69458a0750badebc4f9e13add608c7f#code but it's not. Areas of interest around lines 51 and 362. Still not seeing where factory() is implemented. – Craig Apr 27 '21 at 09:16
  • Please how did you deploy this on ganache? I am assuming this is where the bug is? IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); – Olayinka Joseph Bolaji May 27 '21 at 13:18

1 Answers1

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());

Diego Ferri
  • 926
  • 8
  • 12