0

Hi everyone I am getting the error below when I try to write to a Uniswap function using web3 in python. I can call any function, but I cannot get python to write to uniswap except to add liquidity. Is there something I am doing wrong? Thanks in advance.

MESSAGE ERROR

web3.exceptions.ContractLogicError: execution reverted: UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT
MY SOURCE CODE:

transaction = contract.functions.swapExactETHForTokens(
                                                 w3.toWei(1,'ether'),
                                                 [w3.toChecksumAddress('0xc778417E063141139Fce010982780140Aa0cD5Ab'),w3.toChecksumAddress('0xbf7a7169562078c96f0ec1a8afd6ae50f12e5a99')],
                                                w3.toChecksumAddress('0xmymetamask'),17426800000).buildTransaction()
UNISWAP SOLIDITY FUNCTION PARAMETERS 

function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
  external
  payable
  returns (uint[] memory amounts);
1

insufficient input amount means the router contract didn't receive the expected amount of your inbound token (WETH)

do you have enough eth in your calling address to support the call?

1
  • Yes I have a sufficient amount of WETH. Is there anything I have to approve prior to calling the function? I notice that the Uniswap documentation has a three part process. Additionally, I can write to the Uniswap contract from Etherscan, but I notice it has one additional parameter. When I plug it into python, I get an error saying it is not the right amount.
    – Jo Cuff
    Jul 16 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.