-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: gas required exceeds allowance or always failing transaction #469
Comments
This seems to be an issue with certain contracts with certain backends, where the backend fails to correctly estimate the gas. It seems more common when a contract calls to another contract. Which provider are you using? The only really way to prevent this is to manually set your gas limit (instead of letting estimateGas from being used): let overrides = {
gasLimit: 750000
};
var transaction = await contract.transferFrom(from, to, amount, overrides); And then dial in the correct gas estimate per call. This can also be set in the ABI (and if you use viper will be added to the ABI for you). To use it in the Human-Readable ABI, you can use:
Not ideal, and if you find a way to make estimateGas behave, let me know. But for now, it seems like these cases require a manually set gasLimit. |
Hi, Thank you for your reply. if I do a transaction for 0 tokens it works perfectly what might be causing to fail the transaction it has ether in from an account and also enough ERC20 tokens. |
It is not using all the gas, so it is a revert (or require). Perhaps you are trying to transfer more tokens than you have? Or transferFrom more than your allowance? I would need to see the contract code to figure that out. |
@iamsuz Did you call the |
I have the same issue. but the contract i am running doesn't need any token transfer, when i am trying to update any value into the contract i get this error. If someone has a solution please do share. |
For what it's worth, this issue happens to me when I call a contract that calls another contracts. Take a look at Payroll.sol and the |
@PaulRBerg, if i am right, this screenshot here could be the reason why your transaction is failing. You cannot call |
@SirPhemmiey no, I did not use approve function my issue was, I was trying to transfer the more tokens than the contract had (my decimal was different when I was calling the contract and when I deployed the contract so could not figured out earlier). |
@SirPhemmiey of course I can call |
@PaulRBerg |
Sorry, we are discussing two different problems. Yes, you are entirely correct that the user must call The bug that I was talking about is that ethers throws an error when calling |
Oh Okay, I see. But if you're calling |
Has this been addressed? I feel at the very least we can agree this contract requires a hard-coded |
I'm going to close this now, but please feel free to re-open or continue discussing here (I monitor closed issues). Thanks! :) |
Hello having issues with trading bot gas fees on the ropenstine network Error: Returned values aren't valid, did it run Out of Gas? |
i am trying to make transfer from wallet B to wallet C and wallet A is the owner of ERC20 tokens
and i got error
(node:2168) UnhandledPromiseRejectionWarning: Error: gas required exceeds allowance or always failing transaction
forapproveAndCall
method.`const approveCall = async() => {
what went wrong ?
The text was updated successfully, but these errors were encountered: