Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
addLiquidity() function fails on UniswapV2 on local ganache instance?

addLiquidity() function reverts without any reason on local development instance of ganache, any ideas why this might be happening?

Some background:

  • I have forked the UniswapV2Factory and UniswapV2Router02 and deployed on ganache.
  • I have created 2 ERC20 tokens, and created a pair (via factory.createPair()) for them.
  • Minted both ERC20 tokens to my address.
  • I have approved token amounts to the router contract address (via erc20.approve() function)

This is how I am calling the addLiquidity Function

const blockNumber = await web3.eth.getBlockNumber();
const block = await web3.eth.getBlock(blockNumber);
const timestamp = block.timestamp + 300;

await router.addLiquidity(
    ERC20_TOKEN_1_ADDRESS,
    ERC20_TOKEN_2_ADDRESS,
    web3.utils.toWei('1', 'ether'),
    web3.utils.toWei('1', 'ether'),
    web3.utils.toWei('0.001', 'ether'),
    web3.utils.toWei('0.001', 'ether'),
    OWNER_ADDRESS,
    timestamp,
    { gas: 4000000 }
)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!