Migrate MerkleProof tests among other testing utilities (#4689)

This commit is contained in:
Hadrien Croubois
2023-10-23 20:24:46 +02:00
committed by GitHub
parent 149e1b79fe
commit 7c8b7a2728
17 changed files with 257 additions and 322 deletions

View File

@ -1,17 +1,18 @@
const ozHelpers = require('@openzeppelin/test-helpers');
const helpers = require('@nomicfoundation/hardhat-network-helpers');
const { time, mineUpTo } = require('@nomicfoundation/hardhat-network-helpers');
module.exports = {
clock: {
blocknumber: () => helpers.time.latestBlock(),
timestamp: () => helpers.time.latest(),
blocknumber: () => time.latestBlock(),
timestamp: () => time.latest(),
},
clockFromReceipt: {
blocknumber: receipt => Promise.resolve(receipt.blockNumber),
timestamp: receipt => web3.eth.getBlock(receipt.blockNumber).then(block => block.timestamp),
// TODO: update for ethers receipt
// timestamp: receipt => receipt.getBlock().then(block => block.timestamp),
},
forward: {
blocknumber: ozHelpers.time.advanceBlockTo,
timestamp: helpers.time.increaseTo,
blocknumber: mineUpTo,
timestamp: time.increaseTo,
},
};