web3. Py failed to execute swaptokensforexacteth transaction

Q & A of Denglian community 2022-04-04 22:12:39 阅读数:941

web3. web py failed execute

Show Fail with error 'PancakeRouter: EXCESSIVE_INPUT_AMOUNT'


I see my fist There are so many quantities , There won't be enough

pancakeswap2_txn = contract.functions.swapTokensForExactETH(116159,#fist The number of 0,path[],sender_address,(int(time.time()) + 10000)).buildTransaction({'from': sender_address,'gas': 250000,'gasPrice': web3.toWei('5','gwei'),'nonce': nonce,})

Take the answer 1:
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)

swapTokensForExactETH The first parameter of the method is obtained ETH The number of , The second parameter refers to the maximum amount of money you are willing to spend token To exchange ETH. The second parameter is 0, That must be wrong .'PancakeRouter: EXCESSIVE_INPUT_AMOUNT' This error report refers to the second parameter of the amountInMax The value is too small , Less than the actual cost

版权声明:本文为[Q & A of Denglian community]所创,转载请带上原文链接,感谢。 https://netfreeman.com/2022/04/202204040101514138.html