Hot answers tagged


Change web3.currentProvider.sendAsync to web3.currentProvider.send With truffle 5 you are using web3 1.0. However, the sendAsync is the legacy function of 0.20.


The only option to do this is to use the takeSnapshot and revertToSnapshot functions in that same repo. When you are at a state you know you want to return to, call takeSnapshot in order to get a snapshot ID. When you want to revert to that state, simply run revertToSnapshot with that specific ID. As a note, the snapshotting function in Ganache was finicky ...


What is the time unit for this contract, and the time scale? Is it payment per second, or payment per day? In the UTC time scale seconds are measured by hyperfine oscillations of cesium and days are measured by the rotating earth. In UTC (and only UTC) the duration of one day is not related to the duration of one second. Unix timestamps are, over the long ...


If you are OK with being overly simplistic and ignoring leap seconds and leap years, you can simply do uint timeInSevenYearsFromNow = now + 7 * 365 days; In older versions of solidity you could use years as a unit, but this was depreciated due to the complexity of accurately tracking time over long periods.

Only top voted, non community-wiki answers of a minimum length are eligible