Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda