0

Title really says it all. I am writing a test for a smart contract that needs to wait 200 blocks before something can happen. Is there any way I can advance forward 200 blocks in order to test the condition?

gdoug
  • 101

1 Answers1

0

Took answer from here and made it work:

async function mineNBlocks(n: number, provider: MockProvider) {
  for (let index = 0; index < n; index++) {
    await provider.send('evm_mine', []);
  }
}

Calling it / checking it:

await mineNBlocks(100, provider);
console.log(await provider.getBlockNumber());
gdoug
  • 101