MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / increaseTimeByDate

Function increaseTimeByDate

CLI/commands/helpers/time.js:51–68  ·  view source on GitHub ↗
(toTime)

Source from the content-addressed store, hash-verified

49}
50
51async function increaseTimeByDate(toTime) {
52 if (await web3.eth.net.getId() === 15) {
53 if (toTime.isValid()) {
54 let currentTime = (await web3.eth.getBlock('latest')).timestamp;
55 if (toTime.unix() > currentTime) {
56 await jumpToTime(toTime.unix());
57 currentTime = (await web3.eth.getBlock('latest')).timestamp;
58 console.log(chalk.green(`Current datetime is ${currentTime} or ${moment.unix(currentTime).format("MM/DD/YYYY HH:mm:ss")}`));
59 } else {
60 console.log(chalk.red(`It is not possible to go back in time. Please try again with a time in the future to travel to`));
61 }
62 } else {
63 console.log(chalk.red(`Date format is not valid. Please use a valid Unix epoch time`));
64 }
65 } else {
66 console.log(chalk.red(`Time traveling is only possible over develpment network`));
67 }
68}
69
70async function increaseTimeByDuration(duration) {
71 if (await web3.eth.net.getId() === 15) {

Callers 2

increaseTimeToDateFunction · 0.85
increaseTimeToEpochDateFunction · 0.85

Calls 1

jumpToTimeFunction · 0.70

Tested by

no test coverage detected