Refactor time helper and remove custom error helper. (#4803)

Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2023-12-22 20:50:25 +01:00
committed by GitHub
parent be0572a8dc
commit 015ef69287
32 changed files with 158 additions and 209 deletions

View File

@ -1,7 +1,7 @@
const { ethers } = require('hardhat');
const { forward } = require('./time');
const { ProposalState } = require('./enums');
const { unique } = require('./iterate');
const time = require('./time');
const timelockSalt = (address, descriptionHash) =>
ethers.toBeHex((ethers.toBigInt(address) << 96n) ^ ethers.toBigInt(descriptionHash), 32);
@ -131,17 +131,17 @@ class GovernorHelper {
/// Clock helpers
async waitForSnapshot(offset = 0n) {
const timepoint = await this.governor.proposalSnapshot(this.id);
return forward[this.mode](timepoint + offset);
return time.increaseTo[this.mode](timepoint + offset);
}
async waitForDeadline(offset = 0n) {
const timepoint = await this.governor.proposalDeadline(this.id);
return forward[this.mode](timepoint + offset);
return time.increaseTo[this.mode](timepoint + offset);
}
async waitForEta(offset = 0n) {
const timestamp = await this.governor.proposalEta(this.id);
return forward.timestamp(timestamp + offset);
return time.increaseTo.timestamp(timestamp + offset);
}
/// Other helpers