Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

107
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda