useDApp
useDApp copied to clipboard
Incorrect estimation of the gas limit, when wanting to execute an external function in a contract
Describe the bug Apparently in useDapp, when wanting to execute an external function in a smart contract, it incorrectly estimates the gas limit, causing the transaction to be rejected due to insufficient gas.
To Reproduce It can be easily reproduced with a contract similar to this one that is deployed on BSC Mainnet which is a pancake yield farm strategy.
https://bscscan.com/address/0x45014e81a703dadDe911a91256c7718809fe448D#writeContract
you can generate the action button in the "Earn" function and verify the gas that is proposed in the metamask wallet, then try to generate the same transaction in the "Earn" function on the bscscan website and verify the gas proposed in the metamask wallet, noting in a simple way that the gas proposed by a website that uses UseDapp will be showing a lower gas limit causing the transaction to be rejected
Software versions
useDapp version 1.1.5 Package manager is NPM Node version 16.11.1 Additional context
The problem continues despite the fact that this bug has been marked as solved, although you can actually use a "gasLimit" by adjusting it manually, the most advisable thing would be for ethers to do it automatically,
*NOTE, the problem started to appear after adding the limit gas buffer
This issue is actually more widespread than you think. Having a similar issue where gas estimation on a contract function that previously worked perfectly is now failing proper gas estimation. See here: https://github.com/TrueFiEng/useDApp/issues/931
@RetroDefi I am trying to repro it. Do you maybe have a similar contract on a testnet that fails, so I can try it out?
I have been unsuccessful in trying to reproduce the issue so far: https://github.com/TrueFiEng/useDApp/issues/931#issuecomment-1220913721
@RetroDefi I am trying to repro it. Do you maybe have a similar contract on a testnet that fails, so I can try it out?
I have been unsuccessful in trying to reproduce the issue so far: #931 (comment)
Understood, I will try to create a contract as quickly as possible so that it can be replicated in testnet, I just did a clean installation of dependencies and apparently it did not happen again with the mainnet contract in which I showed that the problem appeared.
Please do not close the thread yet, until we test more on testnet and see that usedapp works in various scenarios ;)
Not closing until we are absolutely sure everything works properly.
Not closing until we are absolutely sure everything works properly.
Hello , sorry for the delay in updating , until now I could not replicate it apparently UseDapp works perfectly when estimating the gas again