0

I am looking way to create a report on how specific function responses change block by block.

Something like:

   const responses = []

   
   for(let i = 0; i < blockNumberList.length; i++){
     const blockNumber = blockNumberList[i]
     const response = await contract.foo() // <-- should return response by block number
     responses.push(response)
   } 

What I do now:

I have hardhat project with config like:

hardhat: {
  forking: {
    url: ''https://mainnet.infura.io/v3/key',
      blockNumber: 13413700,
    },
},

and function call like:

  const response = contract.func()

If I change manually blocknumber and restart harhad console, I get different responses by blocknumber.

I am looking more efficient way to collect responses than collect then manually changing config.

2
  • I do not understand. A transaction cannot know in which block it will be included and you cannot force a transaction to be included into a specific block. So what are you trying to achieve exactly ? Oct 14 at 13:07
  • @Itération122442 Look I updated the question, I tried explaining how I deal with it now. Oct 14 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.