sol-time-machine
v1.1.0
Published
Block manager library for Solidity tests
Downloads
7
Maintainers
Readme
sol-time-machine
Block manager for Solidity tests
Install
npm install sol-time-machine
Usage
const TimeMachine = require('sol-time-machine')
const timeMachine = new TimeMachine(global.web3)
snapshot/revert
// test.js
contract('Example', (accounts) => {
beforeEach(async () => {
await timeMachine.snapshot()
})
afterEach(async () => {
await timeMachine.revert()
})
// Your tests here...
})
mine
// advance 10 blocks
await timeMachine.mine(10)
mineTo
// advance to block number 10
await timeMachine.mineTo(10)