Gas Estimation Failed Deploying Contract

Hi! I have a quick question, when I try to deploy a contract I’m facing an error I’ve attached it. I can’t fix the problem could you please help me? Thank you!

Gas estimation failed
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { “code”: -32000, “message”: “execution reverted” }

https://www.paste.tc/basliksiz-574 (Soliditycode)

Hi, welcome! :wave:

It seems like you are trying to deploy this contract on the BSC-Mainnet, so do you can not deploy this contract on the BSC-Mainnet?

Hi! I’m not deploying on the BSC-Mainnet, I’m on BSC Testnet and thank you so much for your attention.

Also, when I try to deploy this contract on the BSC Mainnet, the error is not popping up.

yeah, cause at the line 835:

IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E);

This is the BSC-Mainnet contract address, so you can only deploy it on the BSC_Mainnet rather than BSC-Testnet.

2 Likes

Thank you so much! It’s fixed. I have one more question, I’ve successfully deployed this contract to BSC-Testnet and I’ve arranged the PancakeSwap testnet router. As you see in line 780, It’s my friend’s testnet wallet address but when I bought my token on PancakeSwap (test), the fee of charity which is 3% didn’t go to his address. (Also when I bought 1 token, it gives me 0.93) How can I fix this issue? And as I said before, thank you so much!

New solidity code: https://www.paste.tc/basliksiz-578

Could you please share the transaction hash?

Thank you so much! My friend told me that I need to change “_isExcludedFromFee[owner()] = true” to false. Have a nice day Skyge!

1 Like

HI

I am also getting the same “Gas Estimation” error when trying to deploy the contract on test Net

The address on router i have given the Test Net address only

IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0xD99D1c33F9fC3444f8101754aBC46c52416550D1);

Can someonel please help what else can be the issue

HI

I am also getting the same “Gas Estimation” error when trying to deploy the contract on test Net

The address on router i have given the Test Net address only

IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0xD99D1c33F9fC3444f8101754aBC46c52416550D1);

Can someonel please hel what else can be the issue