I'm a newbie, have been learning Solidity for 6 months now. I have been trying to fix this problem for couple of months but still got no hope.

I'm trying to learn how to add liquidity to Uniswap by using my contract. The problem is when I'm trying to call addLiquidityETH from Uniswap on my contract with Remix it always failed and show the following errors.

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution reverted: UniswapV2Library: INSUFFICIENT_AMOUNT { "originalError": { "code": 3, "data": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000025556e697377617056324c6962726172793a20494e53554646494349454e545f414d4f554e54000000000000000000000000000000000000000000000000000000", "message": "execution reverted: UniswapV2Library: INSUFFICIENT_AMOUNT" } }`.

Can anybody help me understand what's wrong with my code?

pragma solidity ^0.6.6;

interface IUniswap {
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);


interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);

contract TestAddLiquidity {

    address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // Ropsten

    IUniswap public uniswap;

    constructor() public {
        uniswap = IUniswap(UNISWAP_ROUTER_ADDRESS);
    function addLiq(address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline) external payable {
        IERC20(token).approve(UNISWAP_ROUTER_ADDRESS, amountTokenDesired);
        uniswap.addLiquidityETH(token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline);

It would appreciate it if you could give me some advice.

Thank you

  • 1
    Here is how you investigate your problem: 1. You open the code of the contract on etherscan. 2. You search for INSUFFICIENT_AMOUNT, and find out that it appears only in one place in the code - require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT'). 3. You conclude that one of your input amounts or one of the intermediate results must have been zero. Jan 6, 2021 at 5:36
  • Thank you very much, I found the problem and have fixed it now.
    – Vivid R.
    Jan 18, 2021 at 5:55

1 Answer 1


Just for the others who might be facing the same issue (it took me quite a while to fix it).

The problem I faced was that I was calling function addLiquidityETH() without sending the ethers to Uniswap smart contract, so {value: msg.value} has to be added to the call:

uniswap.addLiquidityETH{ value: msg.value }(
  • This syntax throws a syntax error for me, any reason why? thanks :) Feb 26, 2021 at 15:15
  • What is your syntax error? what pragma version in your contract? Feb 26, 2021 at 15:46
  • thanks for replying, my solution was to call the code like so: result = await router.addLiquidityETH(LToken1.address, web3.utils.toWei('0.01'), web3.utils.toWei('0.01'), web3.utils.toWei('0.1'), myAddress, 1712933164,{value:web3.utils.toWei('0.1')}); Feb 26, 2021 at 16:22
  • 3
    It certainly doesn't work because that is Solidity syntax for your smart contract that is calling Router02. The call from JS should be something like this: await uniswap.methods.addLiquidityETH(tokenAddress, tokenAmount, tokenAmountMin, ethAmountMin, deadline).send({ from: from, value: ethAmount }) Feb 26, 2021 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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