I keep getting "Gas estimate failed" on a pancakeswap testnet for my new token.
Any idea what is causing this?
Dec 30, 2021, 1:29 PM
Could my token logic be too complex so it cant estimate gas, meaning it cant trade?
I really need help with this. I have absolutely no idea why its failing.
Dec 30, 2021, 1:48 PM
This may be a problem with the node. Try to change the rpc
Dec 30, 2021, 2:02 PM
Im using metamask with the Binance Smart Chain testnet? What other RPC's are there?
Dec 30, 2021, 2:09 PM
BSC RPC Endpoints:
• https://data-seed-prebsc-1-s1.binance.org:8545/
• https://data-seed-prebsc-2-s1.binance.org:8545/
• https://data-seed-prebsc-1-s2.binance.org:8545/
• https://data-seed-prebsc-2-s2.binance.org:8545/
• https://data-seed-prebsc-1-s3.binance.org:8545/
• https://data-seed-prebsc-2-s3.binance.org:8545/
• https://data-seed-prebsc-1-s1.binance.org:8545/
• https://data-seed-prebsc-2-s1.binance.org:8545/
• https://data-seed-prebsc-1-s2.binance.org:8545/
• https://data-seed-prebsc-2-s2.binance.org:8545/
• https://data-seed-prebsc-1-s3.binance.org:8545/
• https://data-seed-prebsc-2-s3.binance.org:8545/
Dec 30, 2021, 2:11 PM
I tried a few of these and im getting the exact same problem .
Its a new contract that i have never tried on pancakeswap before.
Could i be doing something in the contract that is breaking pancakeswap?
The contract successfully works on Address to Address transfers.
Im currently using https://pancake.kiemtienonline360.com/#/swap for testing pancakeswap functionality on the bsc testnet. Are there any others i can use?
Dec 30, 2021, 2:30 PM
Ok. Try setting a custom gasLimit. For example: await contract.testFunc({gasLimit: 500000})
Dec 30, 2021, 2:33 PM
Is that something i put into my contract?
Dec 30, 2021, 2:35 PM
No. Into front-end. Where called pancake func.
Dec 30, 2021, 2:41 PM
I cant modify that. Its pancakeswap, i cant cant control their UI.
It has something to do with my transfer method. I simplified it and it started working. I guess im doing too much and metamask cant figure out how much gas to estimate.
basic math?
Do you not know how to transfer funds from code?
What do the number of runs do when optimizing code?
Dec 30, 2021, 3:59 PM
Typically you would set the number of runs to be about as many times you expect the code to be executed. Higher runs can mean smaller gas usage for transactions, at the downside of larger bytecode (higher deployment gas usage).
Dec 30, 2021, 4:55 PM
So when you are ready to deploy to the main net you would set this to 10's of millions in the hope that the token is successful?
Dec 30, 2021, 5:21 PM
You usually set this to 999999 for maximum optimization.
Dec 30, 2021, 5:22 PM
no, a number that high would be overkill and really only increase your deployment cost...most people do a few hundred or a few thousand
Dec 30, 2021, 5:57 PM
Does metamask have a problem estimating gas for the transfer method which calls a bunch of nested methods? When I make my transfer method too complex I have problems with Pancakeswap interacting with metamask with a error estimating gas.
Dec 30, 2021, 7:17 PM