-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelper.js
27 lines (24 loc) · 833 Bytes
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { network } = require("hardhat");
// This function is used to Mine blocks in localnetwork
// because when a proposal is created there is a votingDelay, after that delay only
// user can mark their vote (votingDelay is measured in block so we mine blocks)
// (ONLY FOR LOCAL NETWORK)
async function mineBlocks(count) {
for (let i = 0; i < count; i++) {
await network.provider.request({
method: "evm_mine",
params: [],
});
}
console.log(`Mined ${count} blocks`);
}
// Function used to move time forward (since MIN_DELAY time needed to pass inorder to execute the proposal)
// and instead of block it uses seconds
async function moveTime(amount) {
await network.provider.send("evm_increaseTime", [amount]);
console.log(`Moved ${amount} seconds`);
}
module.exports = {
mineBlocks,
moveTime,
};