This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
can we freeze the time for new transactions #4027
Answered
by
MicaiahReid
mookim-eth
asked this question in
Q&A
-
Some networks like Celo, require price oracle report to keep basic tokens functioning. In this case, as new transactions are minted in a block whose timestamp is set to current time, the forking cannot be used after serveral minutes. (error like this moolamarket/moola-fix#3 ) Can we just freeze the time, aka set the same timestamp (can be the time of forking block) for new blocks? |
Beta Was this translation helpful? Give feedback.
Answered by
MicaiahReid
Dec 14, 2022
Replies: 1 comment 1 reply
-
I'm not sure I understand exactly what you need to do, but maybe this pattern will help: // ...ganache provider is already instantiated with startup options...
await provider.send("miner_stop"); // stop automatic mining so we can control when blocks are mined
// ...send whatever transactions you need in the block...
const timestamp = Date.now(); // set to whatever timestamp you want the block to have
await provider.send("evm_mine", [{timestamp: timestamp}] ); // mine a block with whatever timestamp you need Does this help for your use-case? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mookim-eth
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure I understand exactly what you need to do, but maybe this pattern will help:
Does this help for your use-case?