add a TokenTimelock contract
This commit is contained in:
23
test/helpers/increaseTime.js
Normal file
23
test/helpers/increaseTime.js
Normal file
@ -0,0 +1,23 @@
|
||||
// Increases testrpc time by the passed duration (a moment.js instance)
|
||||
export default function increaseTime(duration) {
|
||||
const id = Date.now()
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
web3.currentProvider.sendAsync({
|
||||
jsonrpc: '2.0',
|
||||
method: 'evm_increaseTime',
|
||||
params: [duration.asSeconds()],
|
||||
id: id,
|
||||
}, err1 => {
|
||||
if (err1) return reject(err1)
|
||||
|
||||
web3.currentProvider.sendAsync({
|
||||
jsonrpc: '2.0',
|
||||
method: 'evm_mine',
|
||||
id: id+1,
|
||||
}, (err2, res) => {
|
||||
return err2 ? reject(err2) : resolve(res)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
6
test/helpers/latestTime.js
Normal file
6
test/helpers/latestTime.js
Normal file
@ -0,0 +1,6 @@
|
||||
import moment from 'moment'
|
||||
|
||||
// Returns a moment.js instance representing the time of the last mined block
|
||||
export default function latestTime() {
|
||||
return moment.unix(web3.eth.getBlock('latest').timestamp)
|
||||
}
|
||||
Reference in New Issue
Block a user