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

203
Views
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 answers
Answer question

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 Report
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!