Migrate AccessControl tests (#4694)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
const { time, mineUpTo } = require('@nomicfoundation/hardhat-network-helpers');
|
||||
|
||||
const mapObject = (obj, fn) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value)]));
|
||||
|
||||
module.exports = {
|
||||
clock: {
|
||||
blocknumber: () => time.latestBlock(),
|
||||
@ -13,6 +15,15 @@ module.exports = {
|
||||
},
|
||||
forward: {
|
||||
blocknumber: mineUpTo,
|
||||
timestamp: time.increaseTo,
|
||||
timestamp: (to, mine = true) => (mine ? time.increaseTo(to) : time.setNextBlockTimestamp(to)),
|
||||
},
|
||||
duration: time.duration,
|
||||
};
|
||||
|
||||
// TODO: deprecate the old version in favor of this one
|
||||
module.exports.bigint = {
|
||||
clock: mapObject(module.exports.clock, fn => () => fn().then(BigInt)),
|
||||
clockFromReceipt: mapObject(module.exports.clockFromReceipt, fn => receipt => fn(receipt).then(BigInt)),
|
||||
forward: module.exports.forward,
|
||||
duration: mapObject(module.exports.duration, fn => n => BigInt(fn(n))),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user