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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
Use ethersim to test your contract. With ethersim you can jump in time by calling the time()-function.
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.