-
-
Save CinnamonGrrrl/74d8aa9daf76402afa467de0457bac93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/test/helpers/increaseTime.js | |
module.exports.increaseTime = function increaseTime(duration) { | |
const id = Date.now(); | |
return new Promise((resolve, reject) => { | |
web3.currentProvider.sendAsync( | |
{ | |
jsonrpc: "2.0", | |
method: "evm_increaseTime", | |
params: [duration], | |
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); | |
} | |
); | |
} | |
); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment