6

I'm working on a revenue distribution contract that lumps eth by week. In order to test it, I need some way to set the now variable. Is there any way to do that?

Using solidity/geth.

2

Use ethersim to test your contract. With ethersim you can jump in time by calling the time()-function.

https://github.com/iurimatias/EtherSim/releases/tag/0.4.0

4

Make a function to get now and make its behaviour dependent on configuration which you make default to the real now in production and in an automated test you specify the now in your test fixture.

  • That should work but im hoping for a better alternative. I dont want unecessary test code in my production contracts. – Aakil Fernandes May 25 '16 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.