Skip to content
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

How can I use EstimateGasAsync? help. #974

Open
ycc3000 opened this issue Sep 16, 2023 · 3 comments
Open

How can I use EstimateGasAsync? help. #974

ycc3000 opened this issue Sep 16, 2023 · 3 comments

Comments

@ycc3000
Copy link

ycc3000 commented Sep 16, 2023

dear,
I use below code, but got 'TransferHelper: TRANSFER_FROM_FAILED', if I set AmountToSend then I got 'execution reverted: eth_estimateGas'.
var func = new SwapExactTokensForTokensSupportingFeeOnTransferTokensFunction { AmountIn = amountIn, AmountOutMin = amountOutMin, Path = path, To = to, Deadline = deadline }; func.AmountToSend = 10000; var estimate = await uniswapV2Router02.ContractHandler.EstimateGasAsync(func);

@juanfranblanco
Copy link
Member

juanfranblanco commented Sep 17, 2023

There is a problem with your data input, hence is failing both to estimate and execute the transaction. The error is returned by the smart contract.

@juanfranblanco
Copy link
Member

There is a problem with your data input, hence is failing both to estimate and execute the transaction

Also you are also setting the AmountToSend, check the Uniswap V2 V3 repository for an example.

@ycc3000
Copy link
Author

ycc3000 commented Sep 17, 2023

thank you very much, and do you mean Nethereum.Uniswap V2 and V3?
I use var estimate = await _web3.TransactionManager.EstimateGasAsync(new CallInput { From = to }); and it works but always got 53000 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants