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

201
Visualizações
Trying to call a function on Uniswap V2 Factory contract on local ganache eth fork, instead getting error that I have no access to archive state

I am trying to call a simple view function allPairsLength() in a JS script using Truffle but I am getting the following error on running the script: Error: Returned error: project ID does not have access to archive state.

Here is the code:

const V2FACTORY = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f";
const V2PAIR = "0x3356c9A8f40F8E9C1d192A4347A76D18243fABC5";
const V2ROUTER2 = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";

const V3QUOTER = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";

const Ifactory = artifacts.require("UniswapV2Factory");
const IPairV2 = artifacts.require("UniswapV2Pair");
const IRouter02V2 = artifacts.require("UniswapV2Router02");
const IQuoter = artifacts.require("Quoter");

module.exports = async function getNoOfPairs() {
    let instance = await Ifactory.at(V2FACTORY);
    let numberOfPairs = await instance.allPairsLength();
    console.log(numberOfPairs);
};

Could someone please point me in the right direction? Thanks a lot!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I see from your comment that you forked a public network using Infura provider.

Infura provides only a limited number of past blocks. Currently about 200 blocks. So if you fork the network at block 1000, and the current block becomes 1200, they won't provide you with any more data as it's over the limit.

Solution: Just reinit the local fork, so that it's forked from a newer block.

about 4 years ago · Juan Pablo Isaza Relatório
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