In my code there is a function which will be called once every 2 months by me. I would like to make it impossible to call it more often than once every 2 months for some security reasons.
I found out that I can store time and in the very beginning of the function simply add assert until time gets greater than variable, and when function goes complete, it stores current time + 2 months to the variable.
It's pretty simple, but is it safe? Can time be anyhow hacked or written by block miners? Or maybe is there any other way to make it possible to lock function for specific amount of time?
web3.currentProvider.send({method: "evm_increaseTime", params: [60 * 60 * 24 * 60]})
. – goodvibration Nov 14 '18 at 3:39web3.providers[0].make_request("evm_increaseTime", [60 * 60 * 24 * 60])
. – goodvibration Nov 14 '18 at 3:41